Commit 68fd5fb8a4d87aad689459aa5ae5675f993ade5a
Exists in
master
and in
29 other branches
Merge branch 'ActionItem2562' into ActionItem2520
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,9 +51,7 @@ function check_captcha(button, confirm_action) { | ||
51 | <script type="text/javascript">jQuery(function() { document.location.href = '#page-comment-form'; });</script> | 51 | <script type="text/javascript">jQuery(function() { document.location.href = '#page-comment-form'; });</script> |
52 | <% end %> | 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 | <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form') if display_link && @comment.reply_of_id.blank? %> | 56 | <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form') if display_link && @comment.reply_of_id.blank? %> |
59 | <% 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| %> | 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,7 +44,6 @@ function save_comment(button) { | ||
44 | this.value = ''; | 44 | this.value = ''; |
45 | }); | 45 | }); |
46 | page_comment_form.find('.errorExplanation').remove(); | 46 | page_comment_form.find('.errorExplanation').remove(); |
47 | - show_display_comment_button(); | ||
48 | } else if(data.render_target == 'form') { | 47 | } else if(data.render_target == 'form') { |
49 | //Comment with errors | 48 | //Comment with errors |
50 | $.scrollTo(page_comment_form); | 49 | $.scrollTo(page_comment_form); |
@@ -55,7 +54,6 @@ function save_comment(button) { | @@ -55,7 +54,6 @@ function save_comment(button) { | ||
55 | $('#'+ data.render_target).replaceWith(data.html); | 54 | $('#'+ data.render_target).replaceWith(data.html); |
56 | $('#' + data.render_target).effect("highlight", {}, 3000); | 55 | $('#' + data.render_target).effect("highlight", {}, 3000); |
57 | $.colorbox.close(); | 56 | $.colorbox.close(); |
58 | - show_display_comment_button(); | ||
59 | } else { | 57 | } else { |
60 | //New comment of article | 58 | //New comment of article |
61 | comment_div.find('.article-comments-list').append(data.html); | 59 | comment_div.find('.article-comments-list').append(data.html); |
@@ -66,7 +64,6 @@ function save_comment(button) { | @@ -66,7 +64,6 @@ function save_comment(button) { | ||
66 | 64 | ||
67 | page_comment_form.find('.errorExplanation').remove(); | 65 | page_comment_form.find('.errorExplanation').remove(); |
68 | $.colorbox.close(); | 66 | $.colorbox.close(); |
69 | - show_display_comment_button(); | ||
70 | } | 67 | } |
71 | 68 | ||
72 | comment_div.find('.comment-count').add('#article-header .comment-count').each(function() { | 69 | comment_div.find('.comment-count').add('#article-header .comment-count').each(function() { |
@@ -81,14 +78,15 @@ function save_comment(button) { | @@ -81,14 +78,15 @@ function save_comment(button) { | ||
81 | if(data.msg != null) { | 78 | if(data.msg != null) { |
82 | display_notice(data.msg); | 79 | display_notice(data.msg); |
83 | } | 80 | } |
84 | - | ||
85 | close_loading(); | 81 | close_loading(); |
86 | toggleBox($button.closest('.post_comment_box')); | 82 | toggleBox($button.closest('.post_comment_box')); |
83 | + show_display_comment_button(); | ||
87 | $button.removeClass('comment-button-loading'); | 84 | $button.removeClass('comment-button-loading'); |
88 | $button.enable(); | 85 | $button.enable(); |
89 | }, 'json'); | 86 | }, 'json'); |
90 | } | 87 | } |
91 | 88 | ||
92 | function show_display_comment_button() { | 89 | function show_display_comment_button() { |
90 | + if(jQuery('.post_comment_box.opened').length==0) | ||
93 | jQuery('.display-comment-form').show(); | 91 | jQuery('.display-comment-form').show(); |
94 | } | 92 | } |