diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index bfef279..81b3078 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -8,9 +8,9 @@ class ProfileController < PublicController helper TagsHelper def index - @network_activities = !@profile.is_a?(Person) ? @profile.tracked_notifications.paginate(:per_page => 15, :page => params[:page]) : [] + @network_activities = !@profile.is_a?(Person) ? @profile.tracked_notifications.visible.paginate(:per_page => 15, :page => params[:page]) : [] if logged_in? && current_person.follows?(@profile) - @network_activities = @profile.tracked_notifications.paginate(:per_page => 15, :page => params[:page]) if @network_activities.empty? + @network_activities = @profile.tracked_notifications.visible.paginate(:per_page => 15, :page => params[:page]) if @network_activities.empty? @activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) end @tags = profile.article_tags @@ -178,7 +178,7 @@ class ProfileController < PublicController @scrap.receiver= receiver @tab_action = params[:tab_action] @message = @scrap.save ? _("Message successfully sent.") : _("You can't leave an empty message.") - activities = @profile.activities.paginate(:per_page => 30, :page => params[:page]) if params[:not_load_scraps].nil? + activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) if params[:not_load_scraps].nil? render :partial => 'profile_activities_list', :locals => {:activities => activities} end @@ -189,8 +189,13 @@ class ProfileController < PublicController @comment.source_type, @comment.source_id = (@activity.target_type == 'Article' ? ['Article', @activity.target_id] : [@activity.class.to_s, @activity.id]) @tab_action = params[:tab_action] @message = @comment.save ? _("Comment successfully added.") : _("You can't leave an empty comment.") - activities = @profile.activities.paginate(:per_page => 30, :page => params[:page]) if params[:not_load_scraps].nil? - render :partial => 'profile_activities_list', :locals => {:activities => activities} + if @tab_action == 'wall' + activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) if params[:not_load_scraps].nil? + render :partial => 'profile_activities_list', :locals => {:activities => activities} + else + network_activities = @profile.tracked_notifications.visible.paginate(:per_page => 15, :page => params[:page]) + render :partial => 'profile_network_activities', :locals => {:network_activities => network_activities} + end end def view_more_activities diff --git a/app/views/profile/_add_member_in_community.rhtml b/app/views/profile/_add_member_in_community.rhtml index 118a275..3cc3227 100644 --- a/app/views/profile/_add_member_in_community.rhtml +++ b/app/views/profile/_add_member_in_community.rhtml @@ -1 +1 @@ -<%= render :partial => 'default_activity', :locals => {:activity => activity} %> +<%= render :partial => 'default_activity', :locals => { :activity => activity, :tab_action => tab_action } %> diff --git a/app/views/profile/_create_article.rhtml b/app/views/profile/_create_article.rhtml index 31cff3b..62324ea 100644 --- a/app/views/profile/_create_article.rhtml +++ b/app/views/profile/_create_article.rhtml @@ -19,4 +19,4 @@ -<%= render :partial => 'profile_comments', :locals => { :activity => activity } %> +<%= render :partial => 'profile_comments', :locals => { :activity => activity, :tab_action => tab_action } %> diff --git a/app/views/profile/_default_activity.rhtml b/app/views/profile/_default_activity.rhtml index 0195183..2558d54 100644 --- a/app/views/profile/_default_activity.rhtml +++ b/app/views/profile/_default_activity.rhtml @@ -10,4 +10,4 @@ -<%= render :partial => 'profile_comments', :locals => { :activity => activity } %> +<%= render :partial => 'profile_comments', :locals => { :activity => activity, :tab_action => tab_action } %> diff --git a/app/views/profile/_join_community.rhtml b/app/views/profile/_join_community.rhtml deleted file mode 100644 index 118a275..0000000 --- a/app/views/profile/_join_community.rhtml +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => 'default_activity', :locals => {:activity => activity} %> diff --git a/app/views/profile/_join_community.rhtml b/app/views/profile/_join_community.rhtml new file mode 120000 index 0000000..208830a --- /dev/null +++ b/app/views/profile/_join_community.rhtml @@ -0,0 +1 @@ +_add_member_in_community.rhtml \ No newline at end of file diff --git a/app/views/profile/_new_friendship.rhtml b/app/views/profile/_new_friendship.rhtml deleted file mode 100644 index 118a275..0000000 --- a/app/views/profile/_new_friendship.rhtml +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => 'default_activity', :locals => {:activity => activity} %> diff --git a/app/views/profile/_new_friendship.rhtml b/app/views/profile/_new_friendship.rhtml new file mode 120000 index 0000000..208830a --- /dev/null +++ b/app/views/profile/_new_friendship.rhtml @@ -0,0 +1 @@ +_add_member_in_community.rhtml \ No newline at end of file diff --git a/app/views/profile/_profile_activities_list.rhtml b/app/views/profile/_profile_activities_list.rhtml index c634368..462cc1d 100644 --- a/app/views/profile/_profile_activities_list.rhtml +++ b/app/views/profile/_profile_activities_list.rhtml @@ -2,7 +2,7 @@ <% activities.each do |a| %> <% activity = a.klass.constantize.find(a.id) %> <% if activity.kind_of?(ActionTracker::Record) %> - <%= render :partial => 'profile_activity', :locals => {:activity => activity} if activity.visible? %> + <%= render :partial => 'profile_activity', :locals => { :activity => activity, :tab_action => 'wall' } if activity.visible? %> <% else %> <%= render :partial => 'profile_scrap', :locals => {:scrap => activity } %> <% end %> diff --git a/app/views/profile/_profile_activity.rhtml b/app/views/profile/_profile_activity.rhtml index a300225..c0042d8 100644 --- a/app/views/profile/_profile_activity.rhtml +++ b/app/views/profile/_profile_activity.rhtml @@ -1,4 +1,4 @@
- <% form_remote_tag :url => {:controller => 'profile', :action => 'leave_comment_on_activity'}, :update => 'profile_activities', :html => { :class => 'profile-wall-reply-form' } do %> + <% update_area = tab_action == 'wall' ? 'profile_activities' : 'network-activities' %> + <% 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 %> <%= text_area :comment, :body, {:id => "reply_content_#{activity.id}", :cols => 50, :rows => 1, diff --git a/app/views/profile/_profile_comments.rhtml b/app/views/profile/_profile_comments.rhtml new file mode 100644 index 0000000..cfa110d --- /dev/null +++ b/app/views/profile/_profile_comments.rhtml @@ -0,0 +1,13 @@ +