Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83c15bd
commit 90bf1c4
Showing
7 changed files
with
77 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,15 +17,23 @@ $comments_count = $("#comments-count-of-commentable-<%= @commentable.id %>"); | |
$comments_count.html("<%= @commentable.comments.size %>").effect('highlight',{}, 1000); | ||
// $comment_parent.append("<%#=j render @comment %>").find('li').last().effect("highlight", {}, 1000); | ||
$comment_form[0].reset(); | ||
$comment_form.remove(); | ||
// when a reply was created | ||
<% if @comment.parent %> | ||
$comment_form.remove(); | ||
<% if @comment.parent.present? %> | ||
// console.log("start"); | ||
$comment = $("#comment_<%= @comment.parent.id %>") | ||
$comment = $("#comment_<%= @comment.parent.id %>"); | ||
// console.log("end"); | ||
$restore_link = $comment.find('a.delete-comment-link')[0] | ||
$reply_link = $comment.find('a.reply-comment-link')[0] | ||
$reply_link.href = $restore_link.href + "/reply" | ||
$restore_link = $comment.find('a.delete-comment-link')[0]; | ||
$reply_link = $comment.find('a.reply-comment-link')[0]; | ||
$reply_link.href = $restore_link.href + "/reply"; | ||
// suggested by Aleksandr Balakiriev | ||
<%# if @comment.parent.replies.size == 1 %> | ||
<!-- console.log(">>>>> first reply was created....");--> | ||
<!-- $edit_link = $comment.find('a.edit-comment-link')[0];--> | ||
<!-- $delete_link = $comment.find('a.delete-comment-link')[0];--> | ||
<!-- $edit_link.parentNode.remove();--> | ||
<!-- $delete_link.parentNode.remove();--> | ||
<%# end %> | ||
This comment has been minimized.
Sorry, something went wrong.
luciuschoi
Author
Owner
|
||
<% end %> | ||
$("#comment_new_chars_counter").html("Remaining : 255"); | ||
<% else # if some errors occurs on creating a comment... %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
$comments_count = $("#comments-count-of-commentable-<%= @commentable.id %>"); | ||
<% if @comment.errors.empty? %> | ||
$comments_count.html("<%= @commentable.comments.size %>").effect('highlight',{}, 1000); | ||
$("#comment_<%= @comment.id %>").effect("highlight", { color: '#f7937c' }, 500).slideUp('fast'); | ||
<% if @comment.parent && can?(:update, @comment.parent) %> | ||
// added edit and destroy link | ||
$links = $("#comment_<%= @comment.id %> .dot-bullet a"); | ||
$edit_link = $links[0]; | ||
$delete_link = $links[1]; | ||
$edit_link.href = "<%= edit_post_comment_url(@comment.parent.commentable, @comment.parent) %>" | ||
$delete_link.href = "<%= post_comment_url(@comment.parent.commentable, @comment.parent) %>" | ||
$new_edit_link = document.createElement('span'); | ||
$new_edit_link.className= 'dot-bullet ml-1'; | ||
$new_edit_link.appendChild($edit_link); | ||
$new_delete_link = document.createElement('span'); | ||
$new_delete_link.className= 'dot-bullet ml-1'; | ||
$new_delete_link.appendChild($delete_link); | ||
$("#comment_<%= @comment.parent.id %> .comment-info small .dot-bullet")[0].after($new_edit_link, $new_delete_link); | ||
console.log($edit_link); | ||
console.log($delete_link); | ||
<% end %> | ||
<!-- $comments_count.html("<%#= @commentable.comments.size %>").effect('highlight',{}, 1000);--> | ||
<!-- $("#comment_<%#= @comment.id %>").effect("highlight", { color: '#f7937c' }, 500).slideUp('fast');--> | ||
This comment has been minimized.
Sorry, something went wrong.
luciuschoi
Author
Owner
|
||
<% else %> | ||
$("#comments-widget-of-commentable-<%= @commentable.id %> .comments-header").after("<div class='alert alert-warning alert-dismissible fade in' role='alert'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><%= @comment.errors.full_messages.join('') %></div>").next().delay(1500).slideUp('fast'); | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In this contenxt, I think that comments and replies had better to be shown with ascending order of
created_at
attribute.