socialforge/app/views/users/index.html.erb

150 lines
5.1 KiB
Plaintext
Raw Normal View History

2013-08-01 10:33:49 +08:00
<% if User.current.admin? %>
<div class="contextual">
<%= link_to l(:label_user_new), new_user_path, :class => 'icon icon-add' %>
</div>
<h3><%= l(:label_user_plural)%></h3>
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %>
2013-08-01 10:33:49 +08:00
<fieldset>
<legend>
<%= l(:label_filter_plural) %>
</legend>
<label for='status'><%= l(:field_status) %>:</label>
<%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
<% if @groups.present? %>
<label for='group_id'><%= l(:label_group) %>:</label>
<%= select_tag 'group_id', content_tag('option') + options_from_collection_for_select(@groups, :id, :name, params[:group_id].to_i), :onchange => "this.form.submit(); return false;" %>
<% end %>
<label for='name'><%= l(:label_user) %>:</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:label_search), :class => "small", :name => nil %><!--Modified by young-->
2013-08-01 10:33:49 +08:00
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list">
<thead>
<tr>
<%= sort_header_tag('login', :caption => l(:field_login)) %>
<%= sort_header_tag('firstname', :caption => l(:field_firstname)) %>
<%= sort_header_tag('lastname', :caption => l(:field_lastname)) %>
<%= sort_header_tag('mail', :caption => l(:field_mail)) %>
2013-08-17 10:34:19 +08:00
2013-08-01 10:33:49 +08:00
<%= sort_header_tag('admin', :caption => l(:field_admin), :default_order => 'desc') %>
<%= sort_header_tag('created_on', :caption => l(:field_created_on), :default_order => 'desc') %>
<%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on), :default_order => 'desc') %>
<th></th>
</tr>
</thead>
<tbody>
<% for user in @users -%>
<tr class="<%= user.css_classes %> <%= cycle("odd", "even") %>">
<td class="username"><%= avatar(user, :size => "14") %><%= link_to h(user.login), edit_user_path(user) %></td>
<td class="firstname"><%= h(user.firstname) %></td>
<td class="lastname"><%= h(user.lastname) %></td>
<td class="email"><%= mail_to(h(user.mail)) %></td>
<td align="center"><%= checked_image user.admin? %></td>
<td class="created_on" align="center"><%= format_time(user.created_on) %></td>
<td class="last_login_on" align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
<td class="buttons"> <%= change_status_link(user) %>
<%= delete_link user_path(user, :back_url => users_path(params)) unless User.current == user %> </td>
</tr>
<% end -%>
</tbody>
</table>
</div>
<div class="pagination">
<ul>
<%= pagination_links_full @user_pages, @user_count %>
<ul>
</div>
<% html_title(l(:label_user_plural)) -%>
<% else %>
2013-08-06 21:43:06 +08:00
<div class="project-search-block">
<span><%= l(:label_user_plural)%></span>
2013-08-01 10:33:49 +08:00
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %>
2013-08-06 21:43:06 +08:00
<div class="project-search">
2013-08-01 10:33:49 +08:00
<%= text_field_tag 'name', params[:name], :size => 30 %>
2013-09-30 09:42:13 +08:00
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %><!--Modified by young-->
2013-09-30 09:42:13 +08:00
2013-08-01 10:33:49 +08:00
<% end %>
2013-08-06 21:43:06 +08:00
</div>
</div>
2013-09-30 09:42:13 +08:00
2013-09-29 19:46:59 +08:00
<%= sort_user(@s_type, @project_type)%>
2013-09-30 09:42:13 +08:00
2013-08-01 10:33:49 +08:00
2013-08-28 09:34:54 +08:00
2013-08-01 10:33:49 +08:00
<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>
2013-11-01 15:48:23 +08:00
<%= image_tag(url_to_avatar(user), :class => 'avatar') %>
<%= content_tag "span", link_to_user(user), :class => "nomargin avatar_name" %>
2013-10-22 16:15:27 +08:00
<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">
2013-08-01 10:33:49 +08:00
<% 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 %>
2013-08-01 10:33:49 +08:00
<%= 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>
2013-08-01 10:33:49 +08:00
</div>
<% end -%>
<% end -%>
2013-08-01 10:33:49 +08:00
</div>
<div class="pagination">
<ul>
<%= pagination_links_full @user_pages, @user_count %>
</ul>
2013-08-01 10:33:49 +08:00
</div>
<% html_title(l(:label_user_plural)) -%>
<% end -%>