新增一个user列表页面

This commit is contained in:
huangjingquan 2013-11-08 11:25:33 +08:00
parent dd6563cf8c
commit 6e9f3d53e5
3 changed files with 119 additions and 88 deletions

View File

@ -2,24 +2,34 @@
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %> <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
<% end %> <% end %>
<!-- modified by huang -->
<div class="top-content">
<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %> <%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %>
<div class="project-search-block"> <table width="940px">
<table width="100%" valign="center">
<tr> <tr>
<td width="16%"><span style="margin-left:0px"><%= l(:label_project_plural)%></span></td> <td class="info_font" style="width: 220px; color: #15bccf""><%= l(:label_project_deposit) %></td>
<td class="location-list"><strong>当前位置 : </strong></td>
<td valign="center"><%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %></td> <td rowspan="2">
<% if User.current.logged? %>
<td align="right"> <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
<div class="project-search"> <% end %>
</td>
<td rowspan="2" >
<div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30 %>
<%= hidden_field_tag 'project_type', params[:project_type] %> <%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
</div></td> </div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><a><%= link_to "forge.trustie.net/projects", :controller => 'projects', :action => 'index', :project_type => 0 %> </a></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_project_deposit), :controller => 'projects', :action => 'index', :project_type => 0 %></td>
</tr> </tr>
</table> </table>
</div>
<% end %> <% end %>
</div>
<!-- end -->
<%= sort_project(@s_type, @project_type) %> <%= sort_project(@s_type, @project_type) %>

View File

@ -0,0 +1,49 @@
<div class="autoscroll">
<% for user in @users -%>
<% unless user.id == 1%>
<div class="well">
<%= content_tag "p", "#{format_date(user.created_on)} #{l(:label_member_since)}", :class => "float_right member_since" %>
<%= image_tag "/images/time_member.png", :class => "img_member_time"%>
<div>
<%= image_tag(url_to_avatar(user), :class => 'avatar') %>
<%= content_tag "span", link_to_user(user), :class => "nomargin avatar_name" %>
<div style="position:relative;float:left;margin-top:-2px;margin-left: 160px">
<%= l(:label_user_grade) %>: <span style="color:#ec6300"><%= user.user_status.grade %></span>
</div>
</div>
<div style="margin-top: 20px;margin-left:66px">
<%= l(:label_x_has_fans,:count=>user.watcher_users.count)%>
<%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %>
</div>
<div class="user-bottom">
<% unless user.memberships.empty? %>
<% cond = Project.visible_condition(User.current) + "AND projects.project_type <> 1" %>
<% memberships = user.memberships.all(:conditions => cond) %>
<%= l(:label_x_contribute_to, :count => memberships.count) %>
<% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% end %>
<p>
<% unless user.memberships.empty? %>
<% cond = Project.visible_condition(User.current) + "AND projects.project_type = 1" %>
<% memberships = user.memberships.all(:conditions => cond) %>
<%= l(:label_x_course_contribute_to, :count => memberships.count) %>
<% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% end %>
</p>
<%= user.changesets.count == 0 ? '' : "#{l(:label_x_total_commit, :count => user.changesets.count)}" %>
</div>
</div>
<% end -%>
<% end -%>
</div>

View File

@ -66,80 +66,52 @@
<% html_title(l(:label_user_plural)) -%> <% html_title(l(:label_user_plural)) -%>
<% else %> <% else %>
<!-- modified by huang -->
<div class="project-search-block"> <div class="top-content">
<span><%= l(:label_user_plural)%></span>
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %> <%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %>
<table width="940px">
<tr>
<td class="info_font" style="width: 220px; color: #15bccf""><%= l(:label_software_user ) %></td>
<td class="location-list"><strong>当前位置 : </strong></td>
<td rowspan="2">
</td>
<td rowspan="2" >
<div class="project-search" style="float: right">
<div class="project-search"> <div class="project-search">
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:label_search), :class => "small", :name => nil %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %><!--Modified by young--> </div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><a><%= link_to "forge.trustie.net/users", :controller => 'users', :action => 'index' %> </a></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_software_user), :controller => 'users', :action => 'index' %></td>
</tr>
</table>
<% end %> <% end %>
</div> </div>
</div> <!-- end -->
<%= sort_user(@s_type, @project_type)%> <%= sort_user(@s_type, @project_type)%>
<!-- <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">
<li>
<%= link_to l(:label_sort_by_time), users_path(:user_sort_type => '0') %>
</li>
<li>
<%= link_to l(:label_sort_by_active), users_path(:user_sort_type => '1') %>
</li>
<li>
<%= link_to l(:label_sort_by_influence), users_path(:user_sort_type => '2') %>
</li>
</ul>
</div> -->
<%= render :partial => 'user_show' %>
<div class="autoscroll">
<% for user in @users -%>
<% unless user.id == 1%>
<div class="well">
<%= content_tag "p", "#{format_date(user.created_on)} #{l(:label_member_since)}", :class => "float_right member_since" %>
<%= image_tag "/images/time_member.png", :class => "img_member_time"%>
<div>
<%= image_tag(url_to_avatar(user), :class => 'avatar') %>
<%= content_tag "span", link_to_user(user), :class => "nomargin avatar_name" %>
<div style="position:relative;float:left;margin-top:-2px;margin-left: 160px">
<%= l(:label_user_grade) %>: <span style="color:#ec6300"><%= user.user_status.grade %></span>
</div>
</div>
<div style="margin-top: 20px;margin-left:66px">
<%= l(:label_x_has_fans,:count=>user.watcher_users.count)%>
<%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %>
</div>
<div class="user-bottom">
<% unless user.memberships.empty? %>
<% cond = Project.visible_condition(User.current) + "AND projects.project_type <> 1" %>
<% memberships = user.memberships.all(:conditions => cond) %>
<%= l(:label_x_contribute_to, :count => memberships.count) %>
<% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% end %>
<p><% unless user.memberships.empty? %>
<% cond = Project.visible_condition(User.current) + "AND projects.project_type = 1" %>
<% memberships = user.memberships.all(:conditions => cond) %>
<%= l(:label_x_course_contribute_to, :count => memberships.count) %>
<% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% end %>
</p>
<%= user.changesets.count == 0 ? '' : "#{l(:label_x_total_commit, :count => user.changesets.count)}" %>
</div>
</div>
<% end -%>
<% end -%>
</div>
<div class="pagination"> <div class="pagination">
<ul> <ul>
<%= pagination_links_full @user_pages, @user_count %> <%= pagination_links_full @user_pages, @user_count %>