pull/503/head
Yunus Emre Kalkan 7 years ago
parent 5a38f854bd
commit 736845063e

@ -6,6 +6,7 @@
"Title": "Title",
"Delete": "Delete",
"Reply": "Reply",
"ReplyTo": "Reply To {0}",
"ContinueReading": "Continue Reading",
"DaysAgo": "{0} days ago",
"YearsAgo": "{0} years ago",

@ -5,6 +5,7 @@
"Title": "Başlık",
"Delete": "Sil",
"Reply": "Yanıtla",
"ReplyTo": "{0}'a cevap ver",
"Menu:BlogManagement": "Blog Yönetimi",
"ContinueReading": "Devamı...",
"DaysAgo": "{0} Gün Önce",

@ -23,6 +23,9 @@
<abp-style src="/Pages/Blog/Shared/Styles/blog.css" />
</abp-style-bundle>
}
<abp-input asp-for="FocusCommentId"/>
<div class="vs-blog">
<div class="row">
<div class="col-md-12 mx-auto">
@ -173,8 +176,8 @@
<div class="comment-form mt-4 replyForm">
<div class="clearfix bg-light p-4">
<h3 class="mt-0">
@L["ReplyTo"]
@(commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName)
@L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName]
</h3>
<div>
<form method="post">
@ -185,6 +188,7 @@
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4"></textarea>
</div>
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Comment"].Value" />
<abp-button button-type="Danger" class="btn-rounded float-right replyCancelButton" text="@L["Cancel"].Value" />
</form>
</div>
</div>
@ -201,6 +205,7 @@
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4">@commentWithRepliesDto.Comment.Text</textarea>
</div>
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" />
<abp-button button-type="Danger" class="btn-rounded float-right editCancelButton" text="@L["Cancel"].Value" />
</form>
</div>
</div>
@ -249,8 +254,7 @@
<div class="comment-form mt-4 replyForm">
<div class="clearfix bg-light p-4">
<h3 class="mt-0">
@L["ReplyTo"]
@(commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName)
@L["ReplyTo",commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName]
</h3>
<div>
<form method="post">
@ -260,6 +264,7 @@
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4"></textarea>
</div>
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" />
<abp-button button-type="Danger" class="btn-rounded float-right replyCancelButton" text="@L["Cancel"].Value" />
</form>
</div>
</div>
@ -276,6 +281,7 @@
<textarea class="form-control no-border" name="text" id="textBoxId" rows="4">@reply.Text</textarea>
</div>
<abp-button button-type="Primary" class="btn-rounded float-right" type="submit" text="@L["Submit"].Value" />
<abp-button button-type="Danger" class="btn-rounded float-right editCancelButton" text="@L["Cancel"].Value" />
</form>
</div>
</div>

@ -31,6 +31,9 @@ namespace Volo.Blogging.Pages.Blog.Posts
public int CommentCount { get; set; }
[HiddenInput]
public Guid FocusCommentId { get; set; }
public PostWithDetailsDto Post { get; set; }
public IReadOnlyList<CommentWithRepliesDto> CommentsWithReplies { get; set; }
@ -51,13 +54,15 @@ namespace Volo.Blogging.Pages.Blog.Posts
public async Task OnPostAsync()
{
await _commentAppService.CreateAsync(new CreateCommentDto()
var comment = await _commentAppService.CreateAsync(new CreateCommentDto()
{
RepliedCommentId = NewComment.RepliedCommentId,
PostId = NewComment.PostId,
Text = NewComment.Text
});
FocusCommentId = comment.Id;
await GetData();
}

@ -3,6 +3,7 @@
var l = abp.localization.getResource('Blogging');
$('div .replyForm').hide();
$('div .editForm').hide();
$('form[class="editFormClass"]').submit(function (event) {
@ -25,6 +26,16 @@
});
});
$('.editCancelButton').click(function (event) {
event.preventDefault();
$('div .editForm').hide();
});
$('.replyCancelButton').click(function (event) {
event.preventDefault();
$('div .replyForm').hide();
});
$('.replyLink').click(function (event) {
event.preventDefault();
$('div .editForm').hide();
@ -44,7 +55,7 @@
}
});
$('.deleteLink').click(function(event) {
$('.deleteLink').click(function (event) {
event.preventDefault();
var linkElement = $(this);
var deleteCommentId = linkElement.attr('data-deleteid');
@ -53,7 +64,7 @@
abp.message.confirm(
l('CommentDeletionWarningMessage'), // TODO: localize
l('Are you sure?'),
function(isConfirmed) {
function (isConfirmed) {
if (isConfirmed) {
$.ajax({
type: "POST",
@ -79,7 +90,7 @@
abp.message.confirm(
l('PostDeletionWarningMessage'), // TODO: localize
l('AreYouSure'),
function(isConfirmed) {
function (isConfirmed) {
if (isConfirmed) {
$.ajax({
type: "POST",
@ -119,4 +130,10 @@
}
});
if ($('#FocusCommentId').val() != '00000000-0000-0000-0000-000000000000') {
$('html, body').animate({
scrollTop: ($('#' + $('#FocusCommentId').val()).offset().top - 150)
}, 500);
}
})(jQuery);

Loading…
Cancel
Save