diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index 3e63569..6de2dd0 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -8,10 +8,10 @@ class ProfileController < PublicController helper TagsHelper def index - @network_activities = !@profile.is_a?(Person) ? @profile.tracked_notifications.paginate(:per_page => 30, :page => params[:page]) : [] + @network_activities = !@profile.is_a?(Person) ? @profile.tracked_notifications.paginate(:per_page => 15, :page => params[:page]) : [] if logged_in? && current_person.follows?(@profile) - @network_activities = @profile.tracked_notifications.paginate(:per_page => 30, :page => params[:page]) if @network_activities.empty? - @activities = @profile.activities.paginate(:per_page => 30, :page => params[:page]) + @network_activities = @profile.tracked_notifications.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 unless profile.display_info_to?(user) @@ -186,8 +186,6 @@ class ProfileController < PublicController @comment = Comment.new(params[:comment]) @comment.author = user @activity = ActionTracker::Record.find(params[:source_id]) - #FIXME pq n colocar source direto? - #@comment.source = ActionTracker::Record.find(params[:source_id]) @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.") @@ -201,12 +199,12 @@ class ProfileController < PublicController end def view_more_activities - @activities = @profile.activities.paginate(:per_page => 30, :page => params[:page]) + @activities = @profile.activities.paginate(:per_page => 10, :page => params[:page]) render :partial => 'profile_activities_list', :locals => {:activities => @activities} end def view_more_network_activities - @activities = @profile.tracked_notifications.paginate(:per_page => 30, :page => params[:page]) + @activities = @profile.tracked_notifications.paginate(:per_page => 10, :page => params[:page]) render :partial => 'profile_network_activities', :locals => {:network_activities => @activities} end diff --git a/app/models/article.rb b/app/models/article.rb index abf6554..e15b38a 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -62,7 +62,7 @@ class Article < ActiveRecord::Base validate :translation_must_have_language def is_trackable? - self.published? && self.notifiable? && self.advertise? + self.published? && self.notifiable? && self.advertise? && self.profile.public_profile end def external_link=(link) diff --git a/app/views/profile/_comment.rhtml b/app/views/profile/_comment.rhtml index b9d886f..ba73efc 100644 --- a/app/views/profile/_comment.rhtml +++ b/app/views/profile/_comment.rhtml @@ -1,4 +1,7 @@ -<%# Comment %> +<% Comment %> +<% Profile %> +<% Person %> +
  • diff --git a/app/views/profile/_create_article.rhtml b/app/views/profile/_create_article.rhtml index 702c612..08a47ba 100644 --- a/app/views/profile/_create_article.rhtml +++ b/app/views/profile/_create_article.rhtml @@ -10,7 +10,14 @@ <%= content_tag(:p, link_to(_('See complete forum'), activity.get_url), :class => 'see-forum') if activity.target.is_a?(Forum) %>

    <%= time_ago_as_sentence(activity.created_at) %>

    - <%= link_to_function _('Comment'), "$('reply_content_#{activity.id}').focus()" %> + <%= link_to_function s_('profile|Comment'), "$('reply_content_#{activity.id}').focus()" %> <%= link_to_remote(content_tag(:span, _('Remove')), :url =>{:action => 'remove_activity', :activity_id => activity.id, :only_hide => true}, :confirm => _('Are you sure?'), :update => "profile-activity-item-#{activity.id}") if logged_in? && current_person == @profile %>
    + +
    + + +<%= render :partial => 'profile_comment_form', :locals => { :activity => activity } %> diff --git a/app/views/profile/_default_activity.rhtml b/app/views/profile/_default_activity.rhtml index a811c0f..b0a8190 100644 --- a/app/views/profile/_default_activity.rhtml +++ b/app/views/profile/_default_activity.rhtml @@ -5,7 +5,14 @@

    <%= link_to activity.user.name, activity.user.url %> <%= describe activity %>

    <%= time_ago_as_sentence(activity.created_at) %>

    - <%= link_to_function _('Comment'), "$('reply_content_#{activity.id}').focus()" %> + <%= link_to_function s_('profile|Comment'), "$('reply_content_#{activity.id}').focus()" %> <%= link_to_remote(content_tag(:span, _('Remove')), :confirm => _('Are you sure?'), :url =>{:action => 'remove_activity', :activity_id => activity.id}, :update => "profile-activity-item-#{activity.id}") if logged_in? && current_person == @profile %>
    + +
    + + +<%= render :partial => 'profile_comment_form', :locals => { :activity => activity } %> diff --git a/app/views/profile/_leave_scrap.rhtml b/app/views/profile/_leave_scrap.rhtml index c363075..307fede 100644 --- a/app/views/profile/_leave_scrap.rhtml +++ b/app/views/profile/_leave_scrap.rhtml @@ -1 +1,12 @@ -NÂO DEVE APARECER +
    + <%= link_to(profile_image(activity.user, :minor), activity.user.url) %> +
    +
    +

    <%= link_to activity.user.name, activity.user.url %> <%= describe activity %>

    +

    <%= time_ago_as_sentence(activity.created_at) %>

    +
    + <%= link_to_remote(content_tag(:span, _('Remove')), :confirm => _('Are you sure?'), :url =>{:action => 'remove_activity', :activity_id => activity.id}, :update => "profile-activity-item-#{activity.id}") if logged_in? && current_person == @profile %> +
    +
    + +
    diff --git a/app/views/profile/_leave_scrap_to_self.rhtml b/app/views/profile/_leave_scrap_to_self.rhtml deleted file mode 100644 index ab8c8e0..0000000 --- a/app/views/profile/_leave_scrap_to_self.rhtml +++ /dev/null @@ -1 +0,0 @@ -NÃO É PRA APARECER diff --git a/app/views/profile/_leave_scrap_to_self.rhtml b/app/views/profile/_leave_scrap_to_self.rhtml new file mode 120000 index 0000000..56c0e42 --- /dev/null +++ b/app/views/profile/_leave_scrap_to_self.rhtml @@ -0,0 +1 @@ +_leave_scrap.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 19ae645..c634368 100644 --- a/app/views/profile/_profile_activities_list.rhtml +++ b/app/views/profile/_profile_activities_list.rhtml @@ -8,3 +8,9 @@ <% end %> <% end %> <% end %> + +<% if activities.current_page < activities.total_pages %> +
    + <%= button_to_remote :add, _('View more'), :url => {:action => 'view_more_activities', :page => (activities.current_page + 1)}, :update => "profile_activities_page_#{activities.current_page}" %> +
    +<% end %> diff --git a/app/views/profile/_profile_activity.rhtml b/app/views/profile/_profile_activity.rhtml index fbf2ca0..a300225 100644 --- a/app/views/profile/_profile_activity.rhtml +++ b/app/views/profile/_profile_activity.rhtml @@ -1,11 +1,4 @@
  • <%= render :partial => activity.verb, :locals => { :activity => activity }%>
    - - - - <%= render :partial => 'profile_comment_form', :locals => { :activity => activity } %> -
  • diff --git a/app/views/profile/_profile_scrap.rhtml b/app/views/profile/_profile_scrap.rhtml index dd9db38..bb59872 100644 --- a/app/views/profile/_profile_scrap.rhtml +++ b/app/views/profile/_profile_scrap.rhtml @@ -9,30 +9,17 @@
    <% if logged_in? && current_person.follows?(scrap.sender) %> - <%= link_to_function _('Comment'), "hide_and_show(['#profile-wall-reply-response-#{scrap.id}'],['#profile-wall-reply-#{scrap.id}', '#profile-wall-reply-form-#{scrap.id}']);$('reply_content_#{scrap.id}').value='';$('reply_content_#{scrap.id}').focus();$('scrap_id_#{scrap.id}').value='#{scrap.id}';return false", :class => "profile-send-reply" %> + <%= link_to_function s_('profile|Comment'), "hide_and_show(['#profile-wall-message-response-#{scrap.id}'],['#profile-wall-reply-#{scrap.id}', '#profile-wall-reply-form-#{scrap.id}']);$('reply_content_#{scrap.id}').value='';$('reply_content_#{scrap.id}').focus();return false", :class => "profile-send-reply" %> <% end %> <%= link_to_remote(content_tag(:span, _('Remove')), :confirm => _('Are you sure?'), :url =>{:action => 'remove_scrap', :scrap_id => scrap.id}, :update => "profile-activity-item-#{scrap.id}") if logged_in? && user.can_control_scrap?(scrap) %>
    -