Commit 4a00fbd9335f7dc7098f5d11ffba2d50ca147ae4
1 parent
9b2304e3
Exists in
master
and in
28 other branches
Fixed network activities
Showing
17 changed files
with
38 additions
and
20 deletions
Show diff stats
app/controllers/public/profile_controller.rb
... | ... | @@ -8,9 +8,9 @@ class ProfileController < PublicController |
8 | 8 | helper TagsHelper |
9 | 9 | |
10 | 10 | def index |
11 | - @network_activities = !@profile.is_a?(Person) ? @profile.tracked_notifications.paginate(:per_page => 15, :page => params[:page]) : [] | |
11 | + @network_activities = !@profile.is_a?(Person) ? @profile.tracked_notifications.visible.paginate(:per_page => 15, :page => params[:page]) : [] | |
12 | 12 | if logged_in? && current_person.follows?(@profile) |
13 | - @network_activities = @profile.tracked_notifications.paginate(:per_page => 15, :page => params[:page]) if @network_activities.empty? | |
13 | + @network_activities = @profile.tracked_notifications.visible.paginate(:per_page => 15, :page => params[:page]) if @network_activities.empty? | |
14 | 14 | @activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) |
15 | 15 | end |
16 | 16 | @tags = profile.article_tags |
... | ... | @@ -178,7 +178,7 @@ class ProfileController < PublicController |
178 | 178 | @scrap.receiver= receiver |
179 | 179 | @tab_action = params[:tab_action] |
180 | 180 | @message = @scrap.save ? _("Message successfully sent.") : _("You can't leave an empty message.") |
181 | - activities = @profile.activities.paginate(:per_page => 30, :page => params[:page]) if params[:not_load_scraps].nil? | |
181 | + activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) if params[:not_load_scraps].nil? | |
182 | 182 | render :partial => 'profile_activities_list', :locals => {:activities => activities} |
183 | 183 | end |
184 | 184 | |
... | ... | @@ -189,8 +189,13 @@ class ProfileController < PublicController |
189 | 189 | @comment.source_type, @comment.source_id = (@activity.target_type == 'Article' ? ['Article', @activity.target_id] : [@activity.class.to_s, @activity.id]) |
190 | 190 | @tab_action = params[:tab_action] |
191 | 191 | @message = @comment.save ? _("Comment successfully added.") : _("You can't leave an empty comment.") |
192 | - activities = @profile.activities.paginate(:per_page => 30, :page => params[:page]) if params[:not_load_scraps].nil? | |
193 | - render :partial => 'profile_activities_list', :locals => {:activities => activities} | |
192 | + if @tab_action == 'wall' | |
193 | + activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) if params[:not_load_scraps].nil? | |
194 | + render :partial => 'profile_activities_list', :locals => {:activities => activities} | |
195 | + else | |
196 | + network_activities = @profile.tracked_notifications.visible.paginate(:per_page => 15, :page => params[:page]) | |
197 | + render :partial => 'profile_network_activities', :locals => {:network_activities => network_activities} | |
198 | + end | |
194 | 199 | end |
195 | 200 | |
196 | 201 | def view_more_activities | ... | ... |
app/views/profile/_add_member_in_community.rhtml
app/views/profile/_create_article.rhtml
app/views/profile/_default_activity.rhtml
app/views/profile/_join_community.rhtml
... | ... | @@ -1 +0,0 @@ |
1 | -<%= render :partial => 'default_activity', :locals => {:activity => activity} %> |
app/views/profile/_new_friendship.rhtml
... | ... | @@ -1 +0,0 @@ |
1 | -<%= render :partial => 'default_activity', :locals => {:activity => activity} %> |
app/views/profile/_profile_activities_list.rhtml
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | <% activities.each do |a| %> |
3 | 3 | <% activity = a.klass.constantize.find(a.id) %> |
4 | 4 | <% if activity.kind_of?(ActionTracker::Record) %> |
5 | - <%= render :partial => 'profile_activity', :locals => {:activity => activity} if activity.visible? %> | |
5 | + <%= render :partial => 'profile_activity', :locals => { :activity => activity, :tab_action => 'wall' } if activity.visible? %> | |
6 | 6 | <% else %> |
7 | 7 | <%= render :partial => 'profile_scrap', :locals => {:scrap => activity } %> |
8 | 8 | <% end %> | ... | ... |
app/views/profile/_profile_activity.rhtml
1 | 1 | <li class='profile-activity-item <%= activity.verb %>' id='profile-activity-item-<%= activity.id %>'> |
2 | - <%= render :partial => activity.verb, :locals => { :activity => activity }%> | |
2 | + <%= render :partial => activity.verb, :locals => { :activity => activity, :tab_action => tab_action }%> | |
3 | 3 | <hr /> |
4 | 4 | </li> | ... | ... |
app/views/profile/_profile_comment_form.rhtml
1 | 1 | <div id='profile-wall-reply-<%= activity.id%>'> |
2 | 2 | <div id='profile-wall-reply-form-<%= activity.id%>'> |
3 | 3 | <p class='profile-wall-reply'> |
4 | - <% form_remote_tag :url => {:controller => 'profile', :action => 'leave_comment_on_activity'}, :update => 'profile_activities', :html => { :class => 'profile-wall-reply-form' } do %> | |
4 | + <% update_area = tab_action == 'wall' ? 'profile_activities' : 'network-activities' %> | |
5 | + <% form_remote_tag :url => {:controller => 'profile', :action => 'leave_comment_on_activity', :tab_action => tab_action}, :html => { :class => 'profile-wall-reply-form', 'data-update' => update_area } do %> | |
5 | 6 | <%= text_area :comment, :body, {:id => "reply_content_#{activity.id}", |
6 | 7 | :cols => 50, |
7 | 8 | :rows => 1, | ... | ... |
... | ... | @@ -0,0 +1,13 @@ |
1 | +<hr /> | |
2 | + | |
3 | +<% if activity.comments_count > 2 %> | |
4 | + <div class='view-all-comments icon-chat'> | |
5 | + <%= link_to(_("View all %s comments") % activity.comments_count, '#') %> | |
6 | + </div> | |
7 | +<% end %> | |
8 | + | |
9 | +<ul class="profile-wall-activities-comments" style="<%= 'display:none;' if (activity.comments_count > 2) %>" > | |
10 | + <%= render :partial => 'comment', :collection => activity.comments %> | |
11 | +</ul> | |
12 | + | |
13 | +<%= render :partial => 'profile_comment_form', :locals => { :activity => activity, :tab_action => tab_action } %> | ... | ... |
app/views/profile/_profile_network.rhtml
app/views/profile/_profile_network_activities.rhtml
1 | 1 | <% network_activities.each do |activity| %> |
2 | - <li class='profile-activity-item <%= activity.verb %>' id='profile-network-item-<%= activity.id %>'> | |
3 | - <%= render :partial => activity.verb, :locals => { :activity => activity }%> | |
4 | - <hr/> | |
5 | - </li> | |
2 | + <%= render :partial => 'profile_activity', :locals => { :activity => activity, :tab_action => 'network' } if activity.visible? %> | |
6 | 3 | <% end %> |
7 | 4 | <% if network_activities.current_page < network_activities.total_pages %> |
8 | 5 | <div id='profile_network_activities_page_<%= network_activities.current_page %>'> | ... | ... |
app/views/profile/_upload_image.rhtml
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | <div title='<%= activity.target.class.short_description %>' class='profile-activity-icon icon-new icon-newgallery'></div> |
15 | 15 | |
16 | 16 | <% if activity.get_view_url.size == 1 %> |
17 | - <%= render :partial => 'profile_comments', :locals => { :activity => activity } %> | |
17 | + <%= render :partial => 'profile_comments', :locals => { :activity => activity, :tab_action => tab_action } %> | |
18 | 18 | <% end %> |
19 | 19 | |
20 | 20 | <br/> | ... | ... |
public/javascripts/application.js
... | ... | @@ -724,7 +724,8 @@ jQuery(function($){ |
724 | 724 | loading_for_button($(field)); |
725 | 725 | }, |
726 | 726 | success: function(data) { |
727 | - $('#profile_activities').html(data); | |
727 | + var update = form.attr('data-update'); | |
728 | + $('#'+update).html(data); | |
728 | 729 | $(field).val($(field).attr('title')); |
729 | 730 | } |
730 | 731 | }); | ... | ... |
vendor/plugins/action_tracker/lib/action_tracker_model.rb