Commit 01c2e8721d6560e3667d430a22171d7bbce07b02

Authored by Antonio Terceiro
2 parents 3cafda05 9cd15003

Merge branch 'comment_bug' into 'master'

Comment view bug

When an article doesn't accept comments, it still used to show the comment div. In some themes it can be a problem.

i.e https://beta.softwarepublico.gov.br/social/spb/ajuda

This is an example of a theme environment with this problem. Note that there is an empty border div in the bottom of the page.

See merge request !431
Showing 1 changed file with 22 additions and 23 deletions   Show diff stats
app/views/content_viewer/view_page.html.erb
... ... @@ -70,37 +70,36 @@
70 70  
71 71 <%= @plugins.dispatch(:article_extra_contents, @page).collect { |content| instance_exec(&content) }.join("") %>
72 72  
73   -<div class="comments" id="comments_list">
74   -
75   - <% if @page.accept_comments? || @comments_count > 0 %>
  73 +<% if @page.accept_comments? || @comments_count > 0 %>
  74 + <div class="comments" id="comments_list">
76 75 <h3 <%= 'class="no-comments-yet"' if @comments_count == 0 %>>
77 76 <%= display_number_of_comments(@comments_count) %>
78 77 </h3>
79   - <% end %>
80 78  
81   - <% if @comments.present? && @comments.count > 1 %>
82   - <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form', :id => 'top-post-comment-button', :onclick => "jQuery('#page-comment-form .display-comment-form').first().click();") if @page.accept_comments? %>
  79 + <% if @comments.present? && @comments.count > 1 %>
  80 + <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form', :id => 'top-post-comment-button', :onclick => "jQuery('#page-comment-form .display-comment-form').first().click();") if @page.accept_comments? %>
  81 +
  82 + <%= hidden_field_tag("page_url", url_for(:controller=>'content_viewer', :action=>'view_page', :profile=>profile.identifier, :page => @page.explode_path)) %>
  83 + <%= javascript_include_tag "comment_order.js" %>
  84 + <div class="comment-order">
  85 + <%= form_tag({:controller=>'content_viewer' , :action=>'view_page'}, {:method=>'get', :id=>"form_order"}) do %>
  86 + <%= select_tag 'comment_order', options_for_select({_('Oldest first')=>'oldest', _('Newest first')=>'newest'}, @comment_order) %>
  87 + <% end %>
  88 + </div>
  89 + <% end %>
83 90  
84   - <%= hidden_field_tag("page_url", url_for(:controller=>'content_viewer', :action=>'view_page', :profile=>profile.identifier, :page => @page.explode_path)) %>
85   - <%= javascript_include_tag "comment_order.js" %>
86   - <div class="comment-order">
87   - <%= form_tag({:controller=>'content_viewer' , :action=>'view_page'}, {:method=>'get', :id=>"form_order"}) do %>
88   - <%= select_tag 'comment_order', options_for_select({_('Oldest first')=>'oldest', _('Newest first')=>'newest'}, @comment_order) %>
  91 + <ul class="article-comments-list">
  92 + <% if @comments.present? %>
  93 + <%= render :partial => 'comment/comment', :collection => @comments %>
  94 + <%= pagination_links @comments, :param_name => 'comment_page' %>
89 95 <% end %>
90   - </div>
91   - <% end %>
  96 + </ul>
92 97  
93   - <ul class="article-comments-list">
94   - <% if @comments.present? %>
95   - <%= render :partial => 'comment/comment', :collection => @comments %>
96   - <%= pagination_links @comments, :param_name => 'comment_page' %>
  98 + <% if @page.accept_comments? %>
  99 + <div id='page-comment-form' class='page-comment-form'><%= render :partial => 'comment/comment_form', :locals =>{:url => {:controller => :comment, :action => :create}, :display_link => true, :cancel_triggers_hide => true}%></div>
97 100 <% end %>
98   - </ul>
99   -
100   - <% if @page.accept_comments? %>
101   - <div id='page-comment-form' class='page-comment-form'><%= render :partial => 'comment/comment_form', :locals =>{:url => {:controller => :comment, :action => :create}, :display_link => true, :cancel_triggers_hide => true}%></div>
102   - <% end %>
103   -</div><!-- end class="comments" -->
  101 + </div><!-- end class="comments" -->
  102 +<% end %>
104 103  
105 104 </div><!-- end id="article" -->
106 105 <%= add_zoom_to_article_images %>
... ...