Revision 912:5e80956cc792 app/views/roles

View differences:

app/views/roles/_form.html.erb
1
<%= error_messages_for 'role' %>
2

  
3
<div class="box">
4
<% unless @role.builtin? %>
5
<p><%= f.text_field :name, :required => true %></p>
6
<p><%= f.check_box :assignable %></p>
7
<% end %>
8
<p><%= f.select :issues_visibility, Role::ISSUES_VISIBILITY_OPTIONS.collect {|v| [l(v.last), v.first]} %></p>
9
<% if @role.new_record? && @roles.any? %>
10
<p><label for="copy_workflow_from"><%= l(:label_copy_workflow_from) %></label>
11
<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@roles, :id, :name)) %></p>
12
<% end %>
13
</div>
14

  
15
<h3><%= l(:label_permissions) %></h3>
16
<div class="box" id="permissions">
17
<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
18
<% perms_by_module.keys.sort.each do |mod| %>
19
    <fieldset><legend><%= mod.blank? ? l(:label_project) : l_or_humanize(mod, :prefix => 'project_module_') %></legend>
20
    <% perms_by_module[mod].each do |permission| %>
21
        <label class="floating">
22
        <%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
23
        <%= l_or_humanize(permission.name, :prefix => 'permission_') %>
24
        </label>
25
    <% end %>
26
    </fieldset>
27
<% end %>
28
<br /><%= check_all_links 'permissions' %>
29
<%= hidden_field_tag 'role[permissions][]', '' %>
30
</div>
app/views/roles/_form.rhtml
1
<%= error_messages_for 'role' %> 
2

  
3
<div class="box">
4
<% unless @role.builtin? %>
5
<p><%= f.text_field :name, :required => true %></p>
6
<p><%= f.check_box :assignable %></p>
7
<% end %>
8
<p><%= f.select :issues_visibility, Role::ISSUES_VISIBILITY_OPTIONS.collect {|v| [l(v.last), v.first]} %></p>
9
<% if @role.new_record? && @roles.any? %>
10
<p><label><%= l(:label_copy_workflow_from) %></label>
11
<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@roles, :id, :name)) %></p>
12
<% end %>
13
</div>
14

  
15
<h3><%= l(:label_permissions) %></h3>
16
<div class="box" id="permissions">
17
<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
18
<% perms_by_module.keys.sort.each do |mod| %>
19
    <fieldset><legend><%= mod.blank? ? l(:label_project) : l_or_humanize(mod, :prefix => 'project_module_') %></legend>
20
    <% perms_by_module[mod].each do |permission| %>
21
        <label class="floating">
22
        <%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
23
        <%= l_or_humanize(permission.name, :prefix => 'permission_') %>
24
        </label>
25
    <% end %>
26
    </fieldset>
27
<% end %>
28
<br /><%= check_all_links 'permissions' %>
29
<%= hidden_field_tag 'role[permissions][]', '' %>
30
</div>
app/views/roles/edit.html.erb
1
<h2><%= link_to l(:label_role_plural), :controller => 'roles', :action => 'index' %> &#187; <%=h @role.name %></h2>
2

  
3
<% labelled_tabular_form_for :role, @role, :url => { :action => 'edit' }, :html => {:id => 'role_form'} do |f| %>
4
<%= render :partial => 'form', :locals => { :f => f } %>
5
<%= submit_tag l(:button_save) %>
6
<% end %>
app/views/roles/edit.rhtml
1
<h2><%= link_to l(:label_role_plural), :controller => 'roles', :action => 'index' %> &#187; <%=h @role.name %></h2> 
2

  
3
<% labelled_tabular_form_for :role, @role, :url => { :action => 'edit' }, :html => {:id => 'role_form'} do |f| %>
4
<%= render :partial => 'form', :locals => { :f => f } %>
5
<%= submit_tag l(:button_save) %>
6
<% end %>
app/views/roles/index.html.erb
8 8
  <thead><tr>
9 9
    <th><%=l(:label_role)%></th>
10 10
    <th><%=l(:button_sort)%></th>
11
	<th></th>
11
  <th></th>
12 12
  </tr></thead>
13 13
  <tbody>
14 14
<% for role in @roles %>
15 15
  <tr class="<%= cycle("odd", "even") %>">
16
  <td><%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, :action => 'edit', :id => role)) %></td>
16
  <td><%= content_tag(role.builtin? ? 'em' : 'span', link_to(h(role.name), :action => 'edit', :id => role)) %></td>
17 17
  <td align="center" style="width:15%;">
18 18
  <% unless role.builtin? %>
19 19
    <%= reorder_links('role', {:action => 'edit', :id => role}) %>
......
21 21
  </td>
22 22
  <td class="buttons">
23 23
    <%= link_to(l(:button_delete), { :action => 'destroy', :id => role },
24
    															:method => :post, 
25
    															:confirm => l(:text_are_you_sure),
26
    															:class => 'icon icon-del') unless role.builtin? %>
24
                                  :method => :post,
25
                                  :confirm => l(:text_are_you_sure),
26
                                  :class => 'icon icon-del') unless role.builtin? %>
27 27
  </td>
28 28
  </tr>
29 29
<% end %>
app/views/roles/new.html.erb
1
<h2><%= link_to l(:label_role_plural), :controller => 'roles', :action => 'index' %> &#187; <%=l(:label_role_new)%></h2>
2

  
3
<% labelled_tabular_form_for :role, @role, :url => { :action => 'new' }, :html => {:id => 'role_form'} do |f| %>
4
<%= render :partial => 'form', :locals => { :f => f } %>
5
<%= submit_tag l(:button_create) %>
6
<% end %>
app/views/roles/new.rhtml
1
<h2><%= link_to l(:label_role_plural), :controller => 'roles', :action => 'index' %> &#187; <%=l(:label_role_new)%></h2> 
2

  
3
<% labelled_tabular_form_for :role, @role, :url => { :action => 'new' }, :html => {:id => 'role_form'} do |f| %>
4
<%= render :partial => 'form', :locals => { :f => f } %>
5
<%= submit_tag l(:button_create) %>
6
<% end %>
app/views/roles/report.html.erb
1
<h2><%= link_to l(:label_role_plural), :controller => 'roles', :action => 'index' %> &#187; <%=l(:label_permissions_report)%></h2>
2

  
3
<% form_tag({:action => 'report'}, :id => 'permissions_form') do %>
4
<%= hidden_field_tag 'permissions[0]', '', :id => nil %>
5
<div class="autoscroll">
6
<table class="list">
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 colspan="<%= @roles.size + 1 %>">
25
            <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
26
            <%= l_or_humanize(mod, :prefix => 'project_module_') %>
27
          </td>
28
        </tr>
29
    <% end %>
30
    <% perms_by_module[mod].each do |permission| %>
31
        <tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
32
        <td>
33
            <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
34
                                                                :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
35
            <%= l_or_humanize(permission.name, :prefix => 'permission_') %>
36
        </td>
37
        <% @roles.each do |role| %>
38
        <td align="center">
39
        <% if role.setable_permissions.include? permission %>
40
          <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
41
        <% end %>
42
        </td>
43
        <% end %>
44
        </tr>
45
    <% end %>
46
<% end %>
47
</tbody>
48
</table>
49
</div>
50
<p><%= check_all_links 'permissions_form' %></p>
51
<p><%= submit_tag l(:button_save) %></p>
52
<% end %>
app/views/roles/report.rhtml
1
<h2><%= link_to l(:label_role_plural), :controller => 'roles', :action => 'index' %> &#187; <%=l(:label_permissions_report)%></h2>
2

  
3
<% form_tag({:action => 'report'}, :id => 'permissions_form') do %>
4
<%= hidden_field_tag 'permissions[0]', '', :id => nil %>
5
<div class="autoscroll">
6
<table class="list">
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 colspan="<%= @roles.size + 1 %>">
25
        		<span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
26
        		<%= l_or_humanize(mod, :prefix => 'project_module_') %>
27
        	</td>
28
        </tr>
29
    <% end %>
30
    <% perms_by_module[mod].each do |permission| %>
31
        <tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
32
        <td>
33
            <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
34
                                                                :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
35
            <%= l_or_humanize(permission.name, :prefix => 'permission_') %>
36
        </td>
37
        <% @roles.each do |role| %>
38
        <td align="center">
39
        <% if role.setable_permissions.include? permission %>
40
          <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
41
        <% end %>
42
        </td>
43
        <% end %>
44
        </tr>
45
    <% end %>
46
<% end %>
47
</tbody>
48
</table>
49
</div>
50
<p><%= check_all_links 'permissions_form' %></p>
51
<p><%= submit_tag l(:button_save) %></p>
52
<% end %>

Also available in: Unified diff