To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / app / views / roles / permissions.html.erb @ 1531:ae8145b28b2b
History | View | Annotate | Download (2.17 KB)
| 1 |
<%= title [l(:label_role_plural), roles_path], l(:label_permissions_report) %>
|
|---|---|
| 2 |
|
| 3 |
<%= form_tag(permissions_roles_path, :id => 'permissions_form') do %>
|
| 4 |
<%= hidden_field_tag 'permissions[0]', '', :id => nil %>
|
| 5 |
<div class="autoscroll"> |
| 6 |
<table class="list permissions"> |
| 7 |
<thead>
|
| 8 |
<tr>
|
| 9 |
<th><%=l(:label_permissions)%></th> |
| 10 |
<% @roles.each do |role| %>
|
| 11 |
<th>
|
| 12 |
<%= content_tag(role.builtin? ? 'em' : 'span', h(role.name)) %>
|
| 13 |
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.role-#{role.id}')",
|
| 14 |
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
| 15 |
</th>
|
| 16 |
<% end %>
|
| 17 |
</tr>
|
| 18 |
</thead>
|
| 19 |
<tbody>
|
| 20 |
<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
|
| 21 |
<% perms_by_module.keys.sort.each do |mod| %>
|
| 22 |
<% unless mod.blank? %>
|
| 23 |
<tr class="group open"> |
| 24 |
<td>
|
| 25 |
<span class="expander" onclick="toggleRowGroup(this);"> </span> |
| 26 |
<%= l_or_humanize(mod, :prefix => 'project_module_') %>
|
| 27 |
</td>
|
| 28 |
<% @roles.each do |role| %>
|
| 29 |
<td class="role"><%= h(role.name) %></td> |
| 30 |
<% end %>
|
| 31 |
</tr>
|
| 32 |
<% end %>
|
| 33 |
<% perms_by_module[mod].each do |permission| %>
|
| 34 |
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>"> |
| 35 |
<td class="name"> |
| 36 |
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
| 37 |
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
| 38 |
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
| 39 |
</td>
|
| 40 |
<% @roles.each do |role| %>
|
| 41 |
<td>
|
| 42 |
<% if role.setable_permissions.include? permission %>
|
| 43 |
<%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
|
| 44 |
<% end %>
|
| 45 |
</td>
|
| 46 |
<% end %>
|
| 47 |
</tr>
|
| 48 |
<% end %>
|
| 49 |
<% end %>
|
| 50 |
</tbody>
|
| 51 |
</table>
|
| 52 |
</div>
|
| 53 |
<p><%= check_all_links 'permissions_form' %></p> |
| 54 |
<p><%= submit_tag l(:button_save) %></p> |
| 55 |
<% end %>
|