Commit e9867fe1c0f6df140f59a36996f48fde6a6ac87a

Authored by Daniela Feitosa
1 parent 2c2edc6e

Replaced link_to_remote by link_to

the method link_to_remote is deprecated on Rails 3

(ActionItem2899)
app/views/profile/_more_comments.rhtml
1 1 <div class='view-more-comments'>
2   - <%= link_to_remote(_('More'), :url => { :profile => @profile.identifier, :controller => 'profile', :action => 'more_comments', :activity => activity, :comment_page => (comment_page + 1)}) %>
  2 + <%= link_to(_('More'), :profile => @profile.identifier, :controller => 'profile', :action => 'more_comments', :activity => activity, :comment_page => (comment_page + 1)) %>
3 3 </div>
... ...
app/views/profile/_more_replies.rhtml
1 1 <div class='view-more-replies'>
2   - <%= link_to_remote(_('More'), :url => { :profile => @profile.identifier, :controller => 'profile', :action => 'more_replies', :activity => activity, :comment_page => (comment_page + 1)}) %>
  2 + <%= link_to(_('More'), :profile => @profile.identifier, :controller => 'profile', :action => 'more_replies', :activity => activity, :comment_page => (comment_page + 1)) %>
3 3 </div>
... ...
app/views/profile/_profile_comments.rhtml
... ... @@ -5,7 +5,7 @@
5 5 <% if activity.comments_count > 0 %>
6 6 <div id="profile-wall-activities-comments-more-<%= activity.id %>" class="profile-wall-activities-comments" >
7 7 <div class='view-all-comments icon-chat'>
8   - <%= link_to_remote(_("View all %s comments") % activity.comments_count, :url => { :profile => profile.identifier, :controller => 'profile', :action => 'more_comments', :activity => activity, :comment_page => (1)}) %>
  8 + <%= link_to(n_('View comment', "View all %s comments", activity.comments_count) % activity.comments_count, :profile => profile.identifier, :controller => 'profile', :action => 'more_comments', :activity => activity, :comment_page => (1)) %>
9 9 </div>
10 10 </div>
11 11 <% end %>
... ...
app/views/profile/_profile_scraps.rhtml
... ... @@ -21,12 +21,12 @@
21 21 </ul>
22 22  
23 23 <% if scrap.replies.count > 0 %>
24   - <div id="profile-wall-activities-comments-more-<%= activity.id %>" class="profile-wall-activities-comments">
25   - <div class='view-all-comments icon-chat'>
26   - <%= link_to_remote(_("View all %s comments") % scrap.replies.count, :url => { :profile => profile.identifier, :controller => 'profile', :action => 'more_replies', :activity => activity, :comment_page => (1)}) %>
27   - </div>
28   - </div>
  24 + <div id="profile-wall-activities-comments-more-<%= activity.id %>" class="profile-wall-activities-comments">
  25 + <div class='view-all-comments icon-chat'>
  26 + <%= link_to(n_('View comment', "View all %s comments", scrap.replies.count) % scrap.replies.count, :profile => profile.identifier, :controller => 'profile', :action => 'more_replies', :activity => activity, :comment_page => (1)) %>
  27 + </div>
  28 + </div>
29 29 <% end %>
30 30 <%= render :partial => 'profile_scrap_reply_form', :locals => { :scrap => scrap } %>
31   - <hr />
32   -</li>
33 31 \ No newline at end of file
  32 + <hr />
  33 +</li>
... ...
public/javascripts/application.js
... ... @@ -853,6 +853,12 @@ Array.min = function(array) {
853 853 return Math.min.apply(Math, array);
854 854 };
855 855  
  856 +function hideAndGetUrl(link) {
  857 + link.hide();
  858 + url = jQuery(link).attr('href');
  859 + jQuery.get(url);
  860 +}
  861 +
856 862 jQuery(function($){
857 863 $('.submit-with-keypress').live('keydown', function(e) {
858 864 field = this;
... ... @@ -875,12 +881,21 @@ jQuery(function($){
875 881 }
876 882 });
877 883  
878   - $('.view-all-comments').live('click', function(e) {
879   - var link = this;
880   - $(link).parent().find('.profile-wall-activities-comments').show();
881   - $(link).hide();
  884 + $('#content').delegate( '.view-all-comments a', 'click', function(e) {
  885 + hideAndGetUrl(this);
882 886 return false;
  887 + });
  888 +
  889 + $('#content').delegate('.view-more-replies a', 'click', function(e) {
  890 + hideAndGetUrl(this);
  891 + return false;
883 892 });
  893 +
  894 + $('#content').delegate('.view-more-comments a', 'click', function(e) {
  895 + hideAndGetUrl(this);
  896 + return false;
  897 + });
  898 +
884 899 $('.focus-on-comment').live('click', function(e) {
885 900 var link = this;
886 901 $(link).parents('.profile-activity-item').find('textarea').focus();
... ...