Commit b3f8c189a17afea29e2e06d8fd750eaa67f38b36
1 parent
4505dc33
Exists in
master
and in
23 other branches
displaying send comment button after save a new comment
Showing
2 changed files
with
3 additions
and
7 deletions
Show diff stats
app/views/comment/_comment_form.rhtml
| ... | ... | @@ -51,9 +51,7 @@ function check_captcha(button, confirm_action) { |
| 51 | 51 | <script type="text/javascript">jQuery(function() { document.location.href = '#page-comment-form'; });</script> |
| 52 | 52 | <% end %> |
| 53 | 53 | |
| 54 | -<% @form_div ||= 'closed' %> | |
| 55 | - | |
| 56 | -<div class="post_comment_box <%= ((defined? show_form) && show_form) ? 'opened' : 'closed' %> <%= @form_div %>"> | |
| 54 | +<div class="post_comment_box <%= ((defined? show_form) && show_form) ? 'opened' : 'closed' %>"> | |
| 57 | 55 | |
| 58 | 56 | <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form') if display_link && @comment.reply_of_id.blank? %> |
| 59 | 57 | <% remote_form_for(:comment, comment, :url => {:profile => profile.identifier, :controller => 'comment', :action => (edition_mode ? 'update' : 'create'), :id => (edition_mode ? comment.id : @page.id)}, :html => { :class => 'comment_form' } ) do |f| %> | ... | ... |
public/javascripts/comment_form.js
| ... | ... | @@ -44,7 +44,6 @@ function save_comment(button) { |
| 44 | 44 | this.value = ''; |
| 45 | 45 | }); |
| 46 | 46 | page_comment_form.find('.errorExplanation').remove(); |
| 47 | - show_display_comment_button(); | |
| 48 | 47 | } else if(data.render_target == 'form') { |
| 49 | 48 | //Comment with errors |
| 50 | 49 | $.scrollTo(page_comment_form); |
| ... | ... | @@ -55,7 +54,6 @@ function save_comment(button) { |
| 55 | 54 | $('#'+ data.render_target).replaceWith(data.html); |
| 56 | 55 | $('#' + data.render_target).effect("highlight", {}, 3000); |
| 57 | 56 | $.colorbox.close(); |
| 58 | - show_display_comment_button(); | |
| 59 | 57 | } else { |
| 60 | 58 | //New comment of article |
| 61 | 59 | comment_div.find('.article-comments-list').append(data.html); |
| ... | ... | @@ -66,7 +64,6 @@ function save_comment(button) { |
| 66 | 64 | |
| 67 | 65 | page_comment_form.find('.errorExplanation').remove(); |
| 68 | 66 | $.colorbox.close(); |
| 69 | - show_display_comment_button(); | |
| 70 | 67 | } |
| 71 | 68 | |
| 72 | 69 | comment_div.find('.comment-count').add('#article-header .comment-count').each(function() { |
| ... | ... | @@ -81,14 +78,15 @@ function save_comment(button) { |
| 81 | 78 | if(data.msg != null) { |
| 82 | 79 | display_notice(data.msg); |
| 83 | 80 | } |
| 84 | - | |
| 85 | 81 | close_loading(); |
| 86 | 82 | toggleBox($button.closest('.post_comment_box')); |
| 83 | + show_display_comment_button(); | |
| 87 | 84 | $button.removeClass('comment-button-loading'); |
| 88 | 85 | $button.enable(); |
| 89 | 86 | }, 'json'); |
| 90 | 87 | } |
| 91 | 88 | |
| 92 | 89 | function show_display_comment_button() { |
| 90 | + if(jQuery('.post_comment_box.opened').length==0) | |
| 93 | 91 | jQuery('.display-comment-form').show(); |
| 94 | 92 | } | ... | ... |