fixies the refact of blog spot index
This commit is contained in:
parent
64e00f5d90
commit
21cd878839
13 changed files with 46 additions and 31 deletions
|
|
@ -47,7 +47,7 @@ namespace Yavsc.Controllers
|
|||
await blogSpotService.UserPosts(id, User.GetUserId(),
|
||||
skip, take));
|
||||
}
|
||||
var byTitle = await this.blogSpotService.IndexByTitle(User, id, skip, take);
|
||||
IEnumerable<IGrouping<string,IBlogPost>> byTitle = await this.blogSpotService.IndexByTitle(User, id, skip, take);
|
||||
return View(byTitle);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class PermissionHandler : IAuthorizationHandler
|
|||
{
|
||||
return applicationDbContext.CircleMembers
|
||||
.Include(c => c.Circle)
|
||||
.Where(m=>m.MemberId==user.GetUserId() && m.Circle.OwnerId == blogPost.OwnerId)
|
||||
.Where(m=>m.MemberId==user.GetUserId() && m.Circle.OwnerId == blogPost.AuthorId)
|
||||
.Any();
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Yavsc.ViewComponents
|
|||
{
|
||||
if (target!=null)
|
||||
{
|
||||
var oid = target.OwnerId;
|
||||
var oid = target.AuthorId;
|
||||
ViewBag.ACL = dbContext.Circle.Where(
|
||||
c=>c.OwnerId == oid)
|
||||
.Select(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@model IEnumerable<IGrouping<string,BlogPost>>
|
||||
@model IEnumerable<IGrouping<string,IBlogPost>>
|
||||
@{
|
||||
ViewData["Title"] = "Blogs, l'index";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
@using Yavsc.Abstract.Identity
|
||||
@model ApplicationUser
|
||||
@{
|
||||
var avuri = "/Avatars/"+Model.UserName+".s.png";
|
||||
var userPosted = Model.Posts!=null && Model.Posts.Count()>=1;
|
||||
var avuri = "/Avatars/" + Model.UserName + ".s.png";
|
||||
}
|
||||
<div class="userinfo">
|
||||
@if (userPosted) { <a asp-controller="Blogspot" asp-action="Index"
|
||||
asp-route-id="@Model.UserName" class="btn btn-primary">
|
||||
<img src="@avuri" asp-append-version="true" class="smalltofhol" alt="@Model.UserName" title="@Model.UserName"/>
|
||||
</a>
|
||||
} else {
|
||||
Html.DisplayFor(m=>m.UserName);
|
||||
}
|
||||
<a title="Posts" asp-controller="Blogspot" asp-action="Index" asp-route-id="@Model.UserName" class="btn btn-primary">
|
||||
<img src="@avuri" asp-append-version="true" class="smalltofhol" alt="@Model.UserName" title="@Model.UserName" />
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
@using Yavsc.Abstract.Identity
|
||||
@model IApplicationUser
|
||||
@{
|
||||
var avuri = "/Avatars/" + Model.UserName + ".s.png";
|
||||
}
|
||||
<div class="userinfo">
|
||||
<a title="Posts" asp-controller="Blogspot" asp-action="Index" asp-route-id="@Model.UserName" class="btn btn-primary">
|
||||
<img src="@avuri" asp-append-version="true" class="smalltofhol" alt="@Model.UserName" title="@Model.UserName" />
|
||||
</a>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue