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>
}
</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; }
[BindProperty]
public BlogIndexViewModel Blog { get; set; }
public IndexModel(IBlogAppService blogAppService)
{
_blogAppService = blogAppService;
@ -36,33 +33,5 @@ namespace Volo.Blogging.Pages.Blog
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">
@L["Volosoft"]
<small class="text-muted">
BLOG
@L["Blog"]
</small>
</h1>
</div>
@ -62,8 +62,8 @@
</div>
<div class="col-sm-4 text-right">
<br />
<a href="#">
<i class="fa fa fa-angle-left"></i> Blog
<a asp-page="/Blog/Posts/Index" asp-route-blogShortName="@Model.BlogShortName">
<i class="fa fa fa-angle-left"></i> @L["Blog"]
</a>
<span class="vs-seperator">|</span>
<a href="#">
@ -251,14 +251,14 @@
@reply.Text
</p>
<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"]
</a>
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId))
{
<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"]
</a>
}
@ -266,7 +266,7 @@
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId))
{
<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"]
</a>
}

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

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

Loading…
Cancel
Save