summaryrefslogtreecommitdiffstats
path: root/app/views/roles
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-14 11:34:08 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-14 11:34:08 +0000
commit21c97c6a1376a38a3951c57069317c17c81029f8 (patch)
tree8d38f129585767d4c1eb2c78d0b9b978aff14d70 /app/views/roles
parent29348fafb7ca43cb00ef80f29e61167647df0cd8 (diff)
downloadredmine-21c97c6a1376a38a3951c57069317c17c81029f8.tar.gz
redmine-21c97c6a1376a38a3951c57069317c17c81029f8.zip
Added project module concept.
A project module (eg. issue tracking, news, wiki,...) is a set of permissions that can enabled/disabled at project level. For each project, modules can be enabled on the project settings view ('Modules' tab). This requires a specific permission: 'Select project modules' (if this permission is turned off, only Redmine administrators can choose which modules a project uses). When applying this migration, all modules are enabled for all existing projects. git-svn-id: http://redmine.rubyforge.org/svn/trunk@725 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/roles')
-rw-r--r--app/views/roles/_form.rhtml28
-rw-r--r--app/views/roles/report.rhtml24
2 files changed, 31 insertions, 21 deletions
diff --git a/app/views/roles/_form.rhtml b/app/views/roles/_form.rhtml
index 62e25e337..6213aa2fb 100644
--- a/app/views/roles/_form.rhtml
+++ b/app/views/roles/_form.rhtml
@@ -2,19 +2,23 @@
<div class="box">
<p><%= f.text_field :name, :required => true, :disabled => @role.builtin? %></p>
-</div>
<p><%= f.check_box :assignable %></p>
-<div class="clear"></div>
+</div>
-<fieldset class="box"><legend><%=l(:label_permissions)%></legend>
-<% @permissions.each do |permission| %>
- <div style="width:220px;float:left;">
- <%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
- <%= permission.name.to_s.humanize %>
- </div>
+<div class="box">
+<h3><%= l(:label_permissions) %></h3>
+
+<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
+<% perms_by_module.keys.sort.each do |mod| %>
+ <fieldset><legend><%= mod.blank? ? l(:label_project) : mod.humanize %></legend>
+ <% perms_by_module[mod].each do |permission| %>
+ <div style="width:220px;float:left;">
+ <%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
+ <%= permission.name.to_s.humanize %>
+ </div>
+ <% end %>
+ </fieldset>
<% end %>
+<br /><%= check_all_links 'role_form' %>
<%= hidden_field_tag 'role[permissions][]', '' %>
-<div class="clear"></div>
-<br />
-<%= check_all_links 'role_form' %>
-</fieldset>
+</div>
diff --git a/app/views/roles/report.rhtml b/app/views/roles/report.rhtml
index ca2f9d798..3d2ecc1e3 100644
--- a/app/views/roles/report.rhtml
+++ b/app/views/roles/report.rhtml
@@ -12,17 +12,23 @@
</tr>
</thead>
<tbody>
-<% @permissions.each do |permission| %>
- <tr class="<%= cycle('odd', 'even') %>">
- <td><%= permission.name.to_s.humanize %></td>
- <% @roles.each do |role| %>
- <td align="center">
- <% if role.setable_permissions.include? permission %>
- <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name) %>
+<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
+<% perms_by_module.keys.sort.each do |mod| %>
+ <% unless mod.blank? %>
+ <tr><%= content_tag('th', mod.humanize, :colspan => (@roles.size + 1)) %></th></tr>
<% end %>
- </td>
+ <% perms_by_module[mod].each do |permission| %>
+ <tr class="<%= cycle('odd', 'even') %>">
+ <td><%= permission.name.to_s.humanize %></td>
+ <% @roles.each do |role| %>
+ <td align="center">
+ <% if role.setable_permissions.include? permission %>
+ <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name) %>
+ <% end %>
+ </td>
+ <% end %>
+ </tr>
<% end %>
- </tr>
<% end %>
</tbody>
</table>