Patch #25491 » list-of-role-members.patch
app/controllers/roles_controller.rb Wed Mar 29 06:27:52 2017 +0000 → app/controllers/roles_controller.rb Fri Mar 31 17:06:38 2017 -0400 | ||
---|---|---|
99 | 99 |
redirect_to roles_path |
100 | 100 |
end |
101 | 101 | |
102 |
def members |
|
103 |
@role = Role.find(params[:id]) |
|
104 |
@projects_members = Member.joins(:roles, :user).where( |
|
105 |
:roles => {:id => @role} |
|
106 |
).group(:users, :id).group_by(&:project) |
|
107 |
end |
|
108 | ||
102 | 109 |
def permissions |
103 | 110 |
@roles = Role.sorted.to_a |
104 | 111 |
@permissions = Redmine::AccessControl.permissions.select { |p| !p.public? } |
app/views/roles/index.html.erb Wed Mar 29 06:27:52 2017 +0000 → app/views/roles/index.html.erb Fri Mar 31 17:06:38 2017 -0400 | ||
---|---|---|
16 | 16 |
<td class="name"><%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, edit_role_path(role))) %></td> |
17 | 17 |
<td class="buttons"> |
18 | 18 |
<%= reorder_handle(role) unless role.builtin? %> |
19 |
<%= link_to l(:label_member_plural), {:controller => 'roles', :action => 'members', :id => role.id}, :class => 'icon icon-user' unless role.members.count == 0 %> |
|
19 | 20 |
<%= link_to l(:button_copy), new_role_path(:copy => role), :class => 'icon icon-copy' %> |
20 | 21 |
<%= delete_link role_path(role) unless role.builtin? %> |
21 | 22 |
</td> |
... | ... | |
28 | 29 | |
29 | 30 |
<%= javascript_tag do %> |
30 | 31 |
$(function() { $("table.roles tbody").positionedItems({items: ".givable"}); }); |
31 |
<% end %> |
|
32 |
<% end %> |
/dev/null Thu Jan 01 00:00:00 1970 +0000 → app/views/roles/members.html.erb Fri Mar 31 17:06:38 2017 -0400 | ||
---|---|---|
1 |
<%= title [l(:label_role_plural), roles_path], @role.name, l(:label_member_plural) %> |
|
2 | ||
3 |
<% if @projects_members.empty? %> |
|
4 | ||
5 |
<p><%= l(:notice_file_not_found) %></p> |
|
6 | ||
7 |
<% else %> |
|
8 | ||
9 |
<% @projects_members.each do |project, members| next if members.count == 0 %> |
|
10 | ||
11 |
<h3><%= project.name %></h3> |
|
12 |
<div class="box tabular" id="members_list"> |
|
13 |
<div class="splitcontent"> |
|
14 |
<ul> |
|
15 |
<% members.each do |member| next if member.nil? or member.user.nil? %> |
|
16 |
<li><%= link_to_user(member.user) %></li> |
|
17 |
<% end %> |
|
18 |
</ul> |
|
19 |
</div> |
|
20 |
</div> |
|
21 |
<% end %> |
|
22 |
<% end %> |
config/routes.rb Wed Mar 29 06:27:52 2017 +0000 → config/routes.rb Fri Mar 31 17:06:38 2017 -0400 | ||
---|---|---|
332 | 332 |
match 'permissions', :via => [:get, :post] |
333 | 333 |
end |
334 | 334 |
end |
335 |
get '/roles/:id/members', :to => 'roles#members' |
|
336 | ||
335 | 337 |
resources :enumerations, :except => :show |
336 | 338 |
match 'enumerations/:type', :to => 'enumerations#index', :via => :get |
337 | 339 |
public/stylesheets/application.css Wed Mar 29 06:27:52 2017 +0000 → public/stylesheets/application.css Fri Mar 31 17:06:38 2017 -0400 | ||
---|---|---|
1302 | 1302 | |
1303 | 1303 |
.contextual>*:not(:first-child), .buttons>.icon:not(:first-child) { margin-left: 5px; } |
1304 | 1304 | |
1305 |
#members_list ul { |
|
1306 |
-moz-column-count: 3; |
|
1307 |
-webkit-column-count: 3; |
|
1308 |
column-count: 3; |
|
1309 |
list-style-position: inside; |
|
1310 |
} |
|
1311 | ||
1305 | 1312 |
img.gravatar { |
1306 | 1313 |
vertical-align: middle; |
1307 | 1314 |
border-radius: 20%; |