Translation & Localisation initialisation
This commit is contained in:
parent
1815d5e088
commit
9f10962dd0
23 changed files with 3797 additions and 310 deletions
|
|
@ -5,6 +5,9 @@ using Microsoft.Extensions.Logging;
|
|||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Yavsc.Models;
|
||||
using Microsoft.Data.Entity;
|
||||
using System.Linq;
|
||||
using Yavsc.Models.Blog;
|
||||
|
||||
namespace Yavsc.ViewComponents
|
||||
{
|
||||
|
|
@ -26,9 +29,31 @@ namespace Yavsc.ViewComponents
|
|||
}
|
||||
|
||||
// Renders blog index ofr the specified user by name
|
||||
public async Task<IViewComponentResult> InvokeAsync(string userName)
|
||||
public async Task<IViewComponentResult> InvokeAsync(string viewerId, int skip=0, int maxLen=25)
|
||||
{
|
||||
return View("Default");
|
||||
long[] usercircles = _context.Circle.Include(c=>c.Members).
|
||||
Where(c=>c.Members.Any(m=>m.MemberId == viewerId))
|
||||
.Select(c=>c.Id).ToArray();
|
||||
IQueryable<BlogPost> posts ;
|
||||
var allposts = _context.Blogspot
|
||||
.Include(b => b.Author)
|
||||
.Include(p=>p.ACL)
|
||||
.Include(p=>p.Tags)
|
||||
.Include(p=>p.Comments)
|
||||
.Where(p=>p.AuthorId == viewerId || p.Visible);
|
||||
|
||||
if (usercircles != null) {
|
||||
posts = allposts.Where(p=> p.ACL.Count==0 || p.ACL.Any(a=> usercircles.Contains(a.CircleId)))
|
||||
;
|
||||
}
|
||||
else {
|
||||
posts = allposts.Where(p => p.ACL.Count == 0);
|
||||
}
|
||||
|
||||
var data = posts.OrderByDescending( p=> p.DateCreated).ToArray();
|
||||
var grouped = data.GroupBy(p=> p.Title).Skip(skip).Take(maxLen);
|
||||
|
||||
return View("Default", grouped);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue