Commit 9cd1500309fb730a44e08ed027bf69923d3e4857

Authored by Gabriela Navarro
1 parent a6151343

Fix view to hide all tags related to comments when the article doesn't accept and have comments

Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com>
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
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,37 +70,36 @@
70 70
71 <%= @plugins.dispatch(:article_extra_contents, @page).collect { |content| instance_exec(&content) }.join("") %> 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 <h3 <%= 'class="no-comments-yet"' if @comments_count == 0 %>> 75 <h3 <%= 'class="no-comments-yet"' if @comments_count == 0 %>>
77 <%= display_number_of_comments(@comments_count) %> 76 <%= display_number_of_comments(@comments_count) %>
78 </h3> 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 <% end %> 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 <% end %> 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 </div><!-- end id="article" --> 104 </div><!-- end id="article" -->
106 <%= add_zoom_to_article_images %> 105 <%= add_zoom_to_article_images %>