diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3d38ddbf8..4dfb67c0c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -388,15 +388,14 @@ class UsersController < ApplicationController end def show + pre_count = 10 #limit case params[:type] when "1" if @user == User.current activity = Activity.where('user_id = ?', User.current.id).order('id desc') - @offset, @limit = api_offset_and_limit({:limit => 10}) @activity_count = activity.count - @activity_pages = Paginator.new @activity_count, @limit, params['page'] - @offset ||= @activity_pages.offset - @activity = activity.offset(@offset).limit(@limit) + @activity_pages = Paginator.new @activity_count, pre_count, params['page'] + @activity = activity.offset(@activity_pages.offset).limit(@activity_pages.per_page).all @state = 1 end when "2" @@ -405,28 +404,24 @@ class UsersController < ApplicationController message = JournalsForMessage.reference_message(@user.id) message += Journal.reference_message(@user.id) end - @offset, @limit = api_offset_and_limit({:limit => 10}) @activity_count = message.size - @info_pages = Paginator.new @activity_count, @limit, params['page'] - @offset ||= @info_pages.offset - + @info_pages = Paginator.new @activity_count, pre_count, params['page'] messages = message.sort {|x,y| y.created_on <=> x.created_on } - - @message = messages[@offset, @limit] + @message = messages[@info_pages.offset, @info_pages.per_page] @state = 2 else + where_condition = nil;#"act_type <> 'JournalsForMessage'" + where_condition = "act_type <> 'JournalsForMessage'" if @user == User.current watcher = User.watched_by(@user) watcher.push(User.current) - activity = Activity.where('user_id in (?)', watcher).order('id desc') + activity = Activity.where(where_condition).where('user_id in (?)', watcher).order('id desc') else - activity = Activity.where('user_id = ?', @user.id).order('id desc') + activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc') end - @offset, @limit = api_offset_and_limit({:limit => 10}) @activity_count = activity.count - @activity_pages = Paginator.new @activity_count, @limit, params['page'] - @offset ||= @activity_pages.offset - @activity = activity.offset(@offset).limit(@limit) + @activity_pages = Paginator.new @activity_count, pre_count, params['page'] + @activity = activity.offset(@activity_pages.offset).limit(@activity_pages.per_page).all @state = 0 end diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index a3472f040..affbc5f83 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -4,274 +4,248 @@
-
- <%= text_field_tag 'user', params[:user], :size => 30 %>
- <%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
- |
+
+
+ <%= text_field_tag 'user', params[:user], :size => 30 %>
+ <%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
+
+ |
<%= image_tag(url_to_avatar(e.user), :class => "avatar") %> | -
-
|
-
<%= image_tag(url_to_avatar(e.user), :class => "avatar") %> | +
+
|
+
+ <%= l(:label_user_activities_other) %> +
+ <% end %> + <% end %> + <% else %> - -<% unless @message.empty? %> -<%= l(:label_no_user_respond_you) %>
<% end %> -<%= l(:label_no_user_respond_you) %>
-<% end %> <% end %>