Browse Source

Blogging module fixes

pull/441/head
Yunus Emre Kalkan 8 years ago
parent
commit
d6eb1d8d2e
  1. 6
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml
  2. 31
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs
  3. 12
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml
  4. 3
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/detail.js

6
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml

@ -15,9 +15,3 @@
<li><a asp-page="./Posts/Index" asp-route-blogShortName="@blog.ShortName">@blog.Name</a></li> <li><a asp-page="./Posts/Index" asp-route-blogShortName="@blog.ShortName">@blog.Name</a></li>
} }
</ul> </ul>
<br/>
<br/>
<br/>
<abp-dynamic-form abp-model="Blog" submit-button="true"/>

31
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs

@ -14,9 +14,6 @@ namespace Volo.Blogging.Pages.Blog
public IReadOnlyList<BlogDto> Blogs { get; private set; } public IReadOnlyList<BlogDto> Blogs { get; private set; }
[BindProperty]
public BlogIndexViewModel Blog { get; set; }
public IndexModel(IBlogAppService blogAppService) public IndexModel(IBlogAppService blogAppService)
{ {
_blogAppService = blogAppService; _blogAppService = blogAppService;
@ -36,33 +33,5 @@ namespace Volo.Blogging.Pages.Blog
return Page(); return Page();
} }
public async Task<IActionResult> OnPostAsync()
{
await _blogAppService.Create(ObjectMapper.Map<BlogIndexViewModel, CreateBlogDto>(Blog));
var result = await _blogAppService.GetListAsync();
if (result.Items.Count == 1)
{
var blog = result.Items[0];
return RedirectToPage("./Posts/Index", new { blogShortName = blog.ShortName});
}
Blogs = result.Items;
return Page();
}
public class BlogIndexViewModel
{
[Required]
public string Name { get; set; }
[Required]
public string ShortName { get; set; }
public string Description { get; set; }
}
} }
} }

12
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml

@ -27,7 +27,7 @@
<h1 class="my-0 display-inline-block"> <h1 class="my-0 display-inline-block">
@L["Volosoft"] @L["Volosoft"]
<small class="text-muted"> <small class="text-muted">
BLOG @L["Blog"]
</small> </small>
</h1> </h1>
</div> </div>
@ -62,8 +62,8 @@
</div> </div>
<div class="col-sm-4 text-right"> <div class="col-sm-4 text-right">
<br /> <br />
<a href="#"> <a asp-page="/Blog/Posts/Index" asp-route-blogShortName="@Model.BlogShortName">
<i class="fa fa fa-angle-left"></i> Blog <i class="fa fa fa-angle-left"></i> @L["Blog"]
</a> </a>
<span class="vs-seperator">|</span> <span class="vs-seperator">|</span>
<a href="#"> <a href="#">
@ -251,14 +251,14 @@
@reply.Text @reply.Text
</p> </p>
<div class="comment-buttons font-75 bg-light"> <div class="comment-buttons font-75 bg-light">
<a href="#" class="tag" data-relpyid="@commentWithRepliesDto.Comment.Id"> <a href="#" class="tag replyLink" data-relpyid="@commentWithRepliesDto.Comment.Id">
<i class="fa fa-reply" aria-hidden="true"></i> @L["Reply"] <i class="fa fa-reply" aria-hidden="true"></i> @L["Reply"]
</a> </a>
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId))
{ {
<span class="seperator">|</span> <span class="seperator">|</span>
<a href="#" class="tag" data-deleteid="@reply.Id"> <a href="#" class="tag deleteLink" data-deleteid="@reply.Id">
<i class="fa fa-trash" aria-hidden="true"></i> @L["Delete"] <i class="fa fa-trash" aria-hidden="true"></i> @L["Delete"]
</a> </a>
} }
@ -266,7 +266,7 @@
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId))
{ {
<span class="seperator">|</span> <span class="seperator">|</span>
<a href="#" class="tag" data-updateid="@reply.Id"> <a href="#" class="tag updateLink" data-updateid="@reply.Id">
<i class="fa fa-pencil" aria-hidden="true"></i> @L["Edit"] <i class="fa fa-pencil" aria-hidden="true"></i> @L["Edit"]
</a> </a>
} }

3
modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/detail.js

@ -25,6 +25,7 @@
$('.replyLink').click(function (event) { $('.replyLink').click(function (event) {
event.preventDefault(); event.preventDefault();
$('div .editForm').hide();
var linkElement = $(this); var linkElement = $(this);
var replyCommentId = linkElement.attr('data-relpyid'); var replyCommentId = linkElement.attr('data-relpyid');
@ -68,6 +69,8 @@
$('.updateLink').click(function (event) { $('.updateLink').click(function (event) {
event.preventDefault(); event.preventDefault();
$('div .replyForm').hide();
var linkElement = $(this); var linkElement = $(this);
var updateCommentId = $(this).attr('data-updateid'); var updateCommentId = $(this).attr('data-updateid');

Loading…
Cancel
Save