user列表

This commit is contained in:
huangjingquan 2013-09-02 15:01:20 +08:00
parent 0aeb56f8f7
commit 77a47797d2
6 changed files with 34 additions and 9 deletions

View File

@ -179,6 +179,7 @@ class UsersController < ApplicationController
end end
@users = scope.offset(@offset).limit(limit).all.reverse @users = scope.offset(@offset).limit(limit).all.reverse
end end
@s_type = 0
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on } # @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
# @projects = @projects[@offset, @limit] # @projects = @projects[@offset, @limit]
when '1' when '1'
@ -192,6 +193,7 @@ class UsersController < ApplicationController
end end
@users = scope.includes(:user_status).reorder('user_statuses.changesets_count').offset(@offset).limit(limit).all.reverse @users = scope.includes(:user_status).reorder('user_statuses.changesets_count').offset(@offset).limit(limit).all.reverse
end end
@s_type = 1
#sort {|x,y| y.user_status.changesets_count <=> x.user_status.changesets_count} #sort {|x,y| y.user_status.changesets_count <=> x.user_status.changesets_count}
#@users = @users[@offset, @limit] #@users = @users[@offset, @limit]
when '2' when '2'
@ -207,6 +209,7 @@ class UsersController < ApplicationController
end end
#@users = @users[@offset, @limit] #@users = @users[@offset, @limit]
end end
@s_type = 2
else else
@offset ||= @user_pages.reverse_offset @offset ||= @user_pages.reverse_offset
unless @offset == 0 unless @offset == 0
@ -218,6 +221,7 @@ class UsersController < ApplicationController
end end
@users = scope.offset(@offset).limit(limit).all.reverse @users = scope.offset(@offset).limit(limit).all.reverse
end end
@s_type = 0
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on } # @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
# @projects = @projects[@offset, @limit] # @projects = @projects[@offset, @limit]
end end

View File

@ -91,4 +91,25 @@ module UsersHelper
content_tag('div', content, :class => "pagination") content_tag('div', content, :class => "pagination")
end end
# added by huang
def sort_user(state)
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0'), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1')))
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2')))
when 1
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0')))
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1'), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2')))
when 2
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0')))
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1')))
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2'), :class=>"selected"), :class=>"selected")
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
end
#end
end end

View File

@ -61,10 +61,10 @@
<td class="font_index"><%=link_to files_count, project_files_path(@project) %></td> <td class="font_index"><%=link_to files_count, project_files_path(@project) %></td>
<tr class="font_aram"> <tr class="font_aram">
<td align="center" width="60px"> <%= l(:label_member) %></td> <td align="center" width="58px"> <%= l(:label_member) %></td>
<td align="center" width="60px"><%= l(:label_user_watcher) %></td> <td align="center" width="58px"><%= l(:label_user_watcher) %></td>
<td align="center" width="60px"> <%= l(:label_project_issues) %></td> <td align="center" width="58px"> <%= l(:label_project_issues) %></td>
<td align="center" width="60px"><%= l(:label_attachment) %></td> <td align="center" width="58px"><%= l(:label_attachment) %></td>
</tr> </tr>
</table> </table>

View File

@ -84,9 +84,9 @@
<% end %> <% end %>
</div> </div>
</div> </div>
&nbsp; <%= sort_user(@s_type)%>
<div class="pagination" style="border-bottom: 1px solid rgb(223,223,223); width: 95%; margin-left: 2%; margin-top: 0px"> <!-- <div class="pagination" style="border-bottom: 1px solid rgb(223,223,223); width: 95%; margin-left: 2%; margin-top: 0px">
<ul style="margin-right:0px"> <ul style="margin-right:0px">
<li> <li>
<%= link_to l(:label_sort_by_time), users_path(:user_sort_type => '0') %> <%= link_to l(:label_sort_by_time), users_path(:user_sort_type => '0') %>
@ -98,7 +98,7 @@
<%= link_to l(:label_sort_by_influence), users_path(:user_sort_type => '2') %> <%= link_to l(:label_sort_by_influence), users_path(:user_sort_type => '2') %>
</li> </li>
</ul> </ul>
</div> </div> -->
<div class="autoscroll"> <div class="autoscroll">

View File

@ -1115,7 +1115,7 @@ en:
label_file_new: Download label_file_new: Download
label_user_edit: "Edit information" label_user_edit: "Edit information"
label_user_info: "User information" #huang 添加 label_user_info: "User information" #huang 添加
label_user_watcher: "Following" # huang添加的 # modified by bai label_user_watcher: "Followed" # huang添加的 # modified by bai
label_user_fans: "Followed by" # modified by bai label_user_fans: "Followed by" # modified by bai
label_user_commits: "Code commits" label_user_commits: "Code commits"
label_user_watchered: "Followed" # huang添加的 label_user_watchered: "Followed" # huang添加的

View File

@ -1571,7 +1571,7 @@ button.tab-right {
#content .tabs_new {height: 2.6em; margin-bottom:1.2em; margin-top: 0.8em; position:relative; overflow:hidden;} #content .tabs_new {height: 2.6em; margin-bottom:1.2em; margin-top: 0.8em; position:relative; overflow:hidden;}
#content .tabs_new ul {margin:0; position:absolute; bottom:0; padding-left: 0.5em; width: 2000px; border-bottom: 1px solid #15BCCF;font-size:14px;} #content .tabs_new ul {margin:0; position:absolute; bottom:0; padding-left: 0.5em; width: 2000px; border-bottom: 1px solid #15BCCF;font-size:14px;}
#content .tabs_new ul li { #content .tabs_new ul li {
width:80px; /*modified by linchun*/ width:85px; /*modified by linchun*/
float:left; float:left;
list-style-type:none; list-style-type:none;
white-space:nowrap; white-space:nowrap;