Commit 07f66267c81ba1d4fbb2bc6a89fec11fb3bbfb6c

Authored by Rodrigo Souto
1 parent fb090c19

comments: fix sort comments

ActionItem3185
app/views/content_viewer/view_page.html.erb
... ... @@ -83,17 +83,7 @@
83 83 <% if @page.accept_comments? && @comments.count > 1 %>
84 84 <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form', :id => 'top-post-comment-button', :onclick => "jQuery('#page-comment-form .display-comment-form').first().click();") %>
85 85  
86   - <%= hidden_field_tag("page_url", url_for(:controller=>'content_viewer', :action=>'view_page', :profile=>profile.identifier)) %>
87   - <%= javascript_include_tag "comment_order.js" %>
88   - <div class="comment-order">
89   - <%= form_tag({:controller=>'content_viewer' , :action=>'view_page'}, {:method=>'get', :id=>"form_order"}) do %>
90   - <%= select_tag 'comment_order', options_for_select({_('Oldest first')=>'oldest', _('Newest first')=>'newest'}, @comment_order) %>
91   - <% end %>
92   - </div>
93   - <% end %>
94   -
95   - <% if @page.accept_comments? and @comments.count > 1 %>
96   - <%= hidden_field_tag("page_url", url_for(:controller=>'content_viewer', :action=>'view_page', :profile=>profile.identifier)) %>
  86 + <%= hidden_field_tag("page_url", url_for(:controller=>'content_viewer', :action=>'view_page', :profile=>profile.identifier, :page => @page.explode_path)) %>
97 87 <%= javascript_include_tag "comment_order.js" %>
98 88 <div class="comment-order">
99 89 <%= form_tag({:controller=>'content_viewer' , :action=>'view_page'}, {:method=>'get', :id=>"form_order"}) do %>
... ...
public/javascripts/comment_order.js
1 1 function send_order(order, url) {
2   - open_loading(DEFAULT_LOADING_MESSAGE);
3   -
  2 + jQuery('.article-comments-list').addClass('fetching');
4 3 jQuery.ajax({
5 4 url:url,
6 5 data: {"comment_order":order},
7 6 success: function(response) {
8   - close_loading();
9 7 jQuery(".article-comments-list").html(response);
10 8 },
11   - error: function() { close_loading() }
  9 + complete: function(){ jQuery('.article-comments-list').removeClass('fetching') }
12 10 });
13 11 }
14 12  
... ...
public/stylesheets/application.css
... ... @@ -6690,3 +6690,7 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img {
6690 6690 #signup-form #result-strong {
6691 6691 color: green;
6692 6692 }
  6693 +
  6694 +.fetching {
  6695 + opacity: 0.3;
  6696 +}
... ...