Project

General

Profile

Patch #20287 » issue-20287-redmine-3.4.0.diff

Frederico Camara, 2017-07-05 12:50

View differences:

app/views/roles/permissions.html.erb
2 2

  
3 3
<%= form_tag(permissions_roles_path, :id => 'permissions_form') do %>
4 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>
5

  
6
<%= stylesheet_link_tag 'divgrid' %>
7
<%= javascript_include_tag 'divgrid' %>
8

  
9
<div style="position: relative; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
10
  <!-- Cell 0 -->
11
  <div id="g_bl" style="position: absolute; top: 0px; left: 0px; z-index: 2;">
12
    <div class="g_c g_h">&nbsp;</div>
13
  </div>
14
  <!-- Line 0  -->
15
  <div id="g_fl" class="ibf" style="position: absolute; top: 0px; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
16
    <div style="display: inline-block;">
17
      <div class="g_c">&nbsp;</div>
18
    </div>
10 19
    <% @roles.each do |role| %>
11
    <th>
12
        <%= link_to_function('',
13
                             "toggleCheckboxesBySelector('input.role-#{role.id}')",
14
                             :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
15
                             :class => 'icon-only icon-checked') %>
16
        <%= content_tag(role.builtin? ? 'em' : 'span', role.name) %>
17
    </th>
20
      <div style="display: inline-block;">
21
        <div class="g_c g_h">
22
          <%= content_tag(role.builtin? ? 'em' : 'span', role.name) %>
23
        </div>
24
      </div>
18 25
    <% end %>
19
    </tr>
20
</thead>
21
<tbody>
22
<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
23
<% perms_by_module.keys.sort.each do |mod| %>
24
    <% unless mod.blank? %>
25
        <tr class="group open">
26
          <td>
27
            <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
28
            <%= l_or_humanize(mod, :prefix => 'project_module_') %>
29
          </td>
30
          <% @roles.each do |role| %>
31
          <td class="role"><%= role.name %></td>
32
          <% end %>
33
        </tr>
26
  </div>
27
  <!-- Row 0 -->
28
  <div id="g_fr" style="position: absolute; top: 0px; left: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
29
    <% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
30
    <% even = true %>
31
    <% perms_by_module.keys.sort.each do |mod| %>
32
      <div class="g_c g_v g_s<%= (even)? " g_e":" g_o" %>">
33
        <%= l_or_humanize(mod, :prefix => 'project_module_') %>
34
      </div>
35
      <% even = !even %>
36
      <% perms_by_module[mod].each do |permission| %>
37
        <% humanized_perm_name = l_or_humanize(permission.name, :prefix => 'permission_') %>
38
        <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
39
          <% even = !even %>
40
          <%= humanized_perm_name %>
41
        </div>
42
      <% end %>
34 43
    <% end %>
35
    <% perms_by_module[mod].each do |permission| %>
36
        <% humanized_perm_name = l_or_humanize(permission.name, :prefix => 'permission_') %>
37
        <tr class="permission-<%= permission.name %>">
38
        <td class="name">
39
            <%= link_to_function('',
40
                                 "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
41
                                 :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
42
                                 :class => 'icon-only icon-checked') %>
43
            <%= humanized_perm_name %>
44
        </td>
45
        <% @roles.each do |role| %>
46
          <% if role.setable_permissions.include? permission %>
47
            <td title="<%= "#{humanized_perm_name} (#{role.name})" %>">
48
              <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
49
            </td>
50
          <% else %>
51
            <td></td>
52
          <% end %>
44
  </div>
45
  <!-- Body -->
46
  <div id="g_bd" class="ibf" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fl', 'g_fr')">
47
    <div style="display: inline-block;"></div>
48
    <% @roles.each do |role| %>
49
      <div style="display: inline-block;">
50
        <% even = true %>
51
        <% perms_by_module.keys.sort.each do |mod| %>
52
          <div class="g_c<%= " g_s" unless role == @roles.last %><%= (even)? " g_e":" g_o" %>"></div>
53
          <% even = !even %>
54
          <% perms_by_module[mod].each do |permission| %>
55
            <% humanized_perm_name = l_or_humanize(permission.name, :prefix => 'permission_') %>
56
            <% if role.setable_permissions.include? permission %>
57
              <div class="g_c<%= (even)? " g_e":" g_o" %>" title="<%= "#{humanized_perm_name} (#{role.name})" %>">
58
                <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
59
              </div>
60
            <% else %>
61
              <div class="g_c<%= (even)? " g_e":" g_o" %>">&nbsp;</div>
62
            <% end %>
63
            <% even = !even %>
64
          <% end %>
53 65
        <% end %>
54
        </tr>
66
      </div>
55 67
    <% end %>
56
<% end %>
57
</tbody>
58
</table>
68
  </div>
59 69
</div>
70

  
71
<script> g_adjust('g_bl', 'g_fr', 'g_fl', 'g_bd'); </script>
72

  
60 73
<p><%= check_all_links 'permissions_form' %></p>
61 74
<p><%= submit_tag l(:button_save) %></p>
62 75
<% end %>
app/views/trackers/fields.html.erb
2 2

  
3 3
<% if @trackers.any? %>
4 4
  <%= form_tag fields_trackers_path do %>
5
    <div class="autoscroll">
6
    <table class="list">
7
    <thead>
8
      <tr>
9
        <th></th>
5
    <%= stylesheet_link_tag 'divgrid' %>
6
    <%= javascript_include_tag 'divgrid' %>
7

  
8
    <div style="position: relative; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
9
      <!-- Cell 0 -->
10
      <div id="g_bl" style="position: absolute; top: 0px; left: 0px; z-index: 2;">
11
        <div class="g_c g_h">&nbsp;</div>
12
      </div>
13
      <!-- Line 0  -->
14
      <div id="g_fl" class="ibf" style="position: absolute; top: 0px; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
15
        <div style="display: inline-block;">
16
          <div class="g_c">&nbsp;</div>
17
        </div>
10 18
        <% @trackers.each do |tracker| %>
11
        <th>
12
          <%= link_to_function('', "toggleCheckboxesBySelector('input.tracker-#{tracker.id}')",
13
                               :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
14
                               :class => 'icon-only icon-checked') %>
15
          <%= tracker.name %>
16
        </th>
19
          <div style="display: inline-block;">
20
            <div class="g_c g_h">
21
              <%= tracker.name %>
22
            </div>
23
          </div>
17 24
        <% end %>
18
      </tr>
19
    </thead>
20
    <tbody>
21
      <tr class="group open">
22
        <td colspan="<%= @trackers.size + 1 %>">
23
          <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
25
      </div>
26
      <!-- Row 0 -->
27
      <div id="g_fr" style="position: absolute; top: 0px; left: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
28
        <div class="g_c">&nbsp;</div>
29
        <% even = false %>
30
        <div class="g_c g_v g_s<%= (even)? " g_e":" g_o" %>">
31
          <% even = !even %>
24 32
          <%= l(:field_core_fields) %>
25
        </td>
26
      </tr>
27
      <% Tracker::CORE_FIELDS.each do |field| %>
28
      <tr>
29
        <% field_name = l("field_#{field}".sub(/_id$/, '')) %>
30
        <td class="name">
31
          <%= link_to_function('', "toggleCheckboxesBySelector('input.core-field-#{field}')",
32
                               :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
33
                               :class => 'icon-only icon-checked') %>
34
          <%= field_name %>
35
        </td>
36
        <% @trackers.each do |tracker| %>
37
        <td title="<%= "#{tracker.name}: #{field_name}" %>">
38
          <%= check_box_tag "trackers[#{tracker.id}][core_fields][]", field, tracker.core_fields.include?(field),
39
                            :class => "tracker-#{tracker.id} core-field-#{field}", :id => nil %>
40
        </td>
33
        </div>
34
        <% Tracker::CORE_FIELDS.each do |field| %>
35
          <% field_name = l("field_#{field}".sub(/_id$/, '')) %>
36
          <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
37
            <% even = !even %>
38
            <%= field_name %>
39
          </div>
41 40
        <% end %>
42
      </tr>
43
      <% end %>
44
      <% if @custom_fields.any? %>
45
        <tr class="group open">
46
          <td colspan="<%= @trackers.size + 1 %>">
47
            <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
41
        <% if @custom_fields.any? %>
42
          <div class="g_c g_v g_s<%= (even)? " g_e":" g_o" %>">
43
            <% even = !even %>
48 44
            <%= l(:label_custom_field_plural) %>
49
          </td>
50
        </tr>
51
        <% @custom_fields.each do |field| %>
52
        <tr>
53
          <td class="name">
54
            <%= link_to_function('', "toggleCheckboxesBySelector('input.custom-field-#{field.id}')",
55
                                 :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
56
                                 :class => 'icon-only icon-checked') %>
57
            <%= field.name %>
58
          </td>
59
          <% @trackers.each do |tracker| %>
60
          <td title="<%= "#{tracker.name}: #{field.name}" %>">
61
            <%= check_box_tag "trackers[#{tracker.id}][custom_field_ids][]", field.id, tracker.custom_fields.include?(field),
62
                              :class => "tracker-#{tracker.id} custom-field-#{field.id}", :id => nil %>
63
          </td>
45
          </div>
46
          <% @custom_fields.each do |field| %>
47
            <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
48
              <% even = !even %>
49
              <%= field.name %>
50
            </div>
64 51
          <% end %>
65
        </tr>
66 52
        <% end %>
67
      <% end %>
68
    </tbody>
69
    </table>
53
      </div>
54
      <!-- Body -->
55
      <div id="g_bd" class="ibf" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fl', 'g_fr')">
56
        <div style="display: inline-block;"></div>
57
        <% @trackers.each do |tracker| %>
58
          <div style="display: inline-block;">
59
            <div class="g_c">&nbsp;</div>
60
            <% even = false %>
61
            <div class="g_c<%= " g_s" unless tracker == @trackers.last %><%= (even)? " g_e":" g_o" %>"></div>
62
            <% even = !even %>
63
            <% Tracker::CORE_FIELDS.each do |field| %>
64
              <% field_name = l("field_#{field}".sub(/_id$/, '')) %>
65
              <div class="g_c<%= (even)? " g_e":" g_o" %>" title="<%= "#{tracker.name}: #{field_name}" %>">
66
                <% even = !even %>
67
                <%= check_box_tag "trackers[#{tracker.id}][core_fields][]", field, tracker.core_fields.include?(field),
68
                                  :class => "tracker-#{tracker.id} core-field-#{field}", :id => nil %>
69
              </div>
70
            <% end %>
71
            <% if @custom_fields.any? %>
72
              <div class="g_c<%= " g_s" unless tracker == @trackers.last %><%= (even)? " g_e":" g_o" %>"></div>
73
              <% even = !even %>
74
              <% @custom_fields.each do |field| %>
75
                <div class="g_c<%= (even)? " g_e":" g_o" %>" title="<%= "#{tracker.name}: #{field.name}" %>">
76
                  <% even = !even %>
77
                  <%= check_box_tag "trackers[#{tracker.id}][custom_field_ids][]", field.id, tracker.custom_fields.include?(field),
78
                                    :class => "tracker-#{tracker.id} custom-field-#{field.id}", :id => nil %>
79
                </div>
80
              <% end %>
81
            <% end %>
82
          </div>
83
        <% end %>
84
      </div>
70 85
    </div>
71 86
    <p><%= submit_tag l(:button_save) %></p>
72 87
    <% @trackers.each do |tracker| %>
......
74 89
      <%= hidden_field_tag "trackers[#{tracker.id}][custom_field_ids][]", '' %>
75 90
    <% end %>
76 91
  <% end %>
92

  
93
  <script> g_adjust('g_bl', 'g_fr', 'g_fl', 'g_bd'); </script>
94

  
77 95
<% else %>
78 96
  <p class="nodata"><%= l(:label_no_data) %></p>
79 97
<% end %>
app/views/workflows/_form.html.erb
1
<table class="list workflows transitions transitions-<%= name %>">
2
<thead>
3
  <tr>
4
    <th>
5
      <%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input')",
6
                           :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
7
                           :class => 'icon-only icon-checked') %>
8
      <%=l(:label_current_status)%>
9
    </th>
10
    <th colspan="<%= @statuses.length %>"><%=l(:label_new_statuses_allowed)%></th>
11
  </tr>
12
  <tr>
13
    <td></td>
14
    <% for new_status in @statuses %>
15
    <td style="width:<%= 75 / @statuses.size %>%;">
16
      <%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input.new-status-#{new_status.id}')",
17
                           :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
18
                           :class => 'icon-only icon-checked') %>
19
      <%= new_status.name %>
20
    </td>
21
    <% end %>
22
  </tr>
23
</thead>
24
<tbody>
1
<!-- Cell 0 -->
2
<div id="g_bl_<%= name %>" style="position: absolute; top: 0px; left: 0px; z-index: 2;">
3
  <div class="g_c g_h">&nbsp;</div>
4
</div>
5
<!-- Line 0  -->
6
<div id="g_fl_<%= name %>" class="ibf" style="position: absolute; top: 0px; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
7
  <div style="display: inline-block;">
8
    <div class="g_c">&nbsp;</div>
9
  </div>
10
  <% for new_status in @statuses %>
11
    <div style="display: inline-block;">
12
      <div class="g_c g_h">
13
        <%= new_status.name %>
14
      </div>
15
    </div>
16
  <% end %>
17
</div>
18
<!-- Row 0 -->
19
<div id="g_fr_<%= name %>" style="position: absolute; top: 0px; left: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
20
  <div class="g_c">&nbsp;</div>
21
  <% even = false %>
25 22
  <% for old_status in [nil] + @statuses %>
26
  <% next if old_status.nil? && name != 'always' %>
27
  <tr>
28
    <td class="name">
29
      <%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input.old-status-#{old_status.try(:id) || 0}')",
30
                           :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
31
                           :class => 'icon-only icon-checked') %>
23
    <% next if old_status.nil? && name != 'always' %>
24
    <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
25
      <% even = !even %>
32 26
      <% if old_status %>
33 27
        <% old_status_name = old_status.name %>
34 28
        <%= old_status_name %>
35 29
      <% else %>
36 30
        <% old_status_name = l(:label_issue_new) %>
37 31
        <%= content_tag('em', old_status_name) %>
38 32
      <% end %>
39
    </td>
40
    <% for new_status in @statuses -%>
41
    <% checked = workflows.detect {|w| w.old_status == old_status && w.new_status == new_status} %>
42
    <td class="<%= checked ? 'enabled' : '' %>" title="<%= old_status_name %> &#187; <%= new_status.name %>">
43
      <%= transition_tag workflows, old_status, new_status, name %>
44
    </td>
45
    <% end -%>
46
  </tr>
33
    </div>
34
  <% end %>
35
</div>
36
<!-- Body -->
37
<div id="g_bd_<%= name %>" class="ibf" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fl_<%= name %>', 'g_fr_<%= name %>')">
38
  <div style="display: inline-block;"></div>
39
  <% for new_status in @statuses %>
40
    <div style="display: inline-block;">
41
      <div class="g_c">&nbsp;</div>
42
      <% even = false %>
43
      <% for old_status in [nil] + @statuses %>
44
        <% next if old_status.nil? && name != 'always' %>
45
        <% checked = workflows.detect {|w| w.old_status == old_status && w.new_status == new_status} %>
46
        <% if old_status %>
47
          <% old_status_name = old_status.name %>
48
          <%= old_status_name %>
49
        <% else %>
50
          <% old_status_name = l(:label_issue_new) %>
51
          <%= content_tag('em', old_status_name) %>
52
        <% end %>
53
        <div class="g_c<%= checked ? " g_m" : (even)? " g_e" : " g_o" %>" title="<%= old_status_name %> &#187; <%= new_status.name %>">
54
          <% even = !even %>
55
          <%= transition_tag workflows, old_status, new_status, name %>
56
        </div>
57
      <% end %>
58
    </div>
47 59
  <% end %>
48
</tbody>
49
</table>
60
</div>
app/views/workflows/edit.html.erb
27 27

  
28 28
  <%= hidden_field_tag 'used_statuses_only', '0', :id => nil %>
29 29
  <label><%= check_box_tag 'used_statuses_only', '1', @used_statuses_only %> <%= l(:label_display_used_statuses_only) %></label>
30

  
31 30
</p>
32 31
<% end %>
33 32

  
34 33
<% if @trackers && @roles && @statuses.any? %>
34
  <%= stylesheet_link_tag 'divgrid' %>
35
  <%= javascript_include_tag 'divgrid' %>
36

  
35 37
  <%= form_tag({}, :id => 'workflow_form' ) do %>
36 38
    <%= @trackers.map {|tracker| hidden_field_tag 'tracker_id[]', tracker.id, :id => nil}.join.html_safe %>
37 39
    <%= @roles.map {|role| hidden_field_tag 'role_id[]', role.id, :id => nil}.join.html_safe %>
38 40
    <%= hidden_field_tag 'used_statuses_only', params[:used_statuses_only], :id => nil %>
39 41
    <div class="autoscroll">
40
      <%= render :partial => 'form', :locals => {:name => 'always', :workflows => @workflows['always']} %>
42
      <div id="workflow_always" style="position: relative; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
43
        <%= render :partial => 'form', :locals => {:name => 'always', :workflows => @workflows['always']} %>
44
      </div>
41 45

  
42
      <fieldset class="collapsible" style="padding: 0; margin-top: 0.5em;">
43
        <legend onclick="toggleFieldset(this);"><%= l(:label_additional_workflow_transitions_for_author) %></legend>
44
        <div id="author_workflows" style="margin: 0.5em 0 0.5em 0;">
45
          <%= render :partial => 'form', :locals => {:name => 'author', :workflows => @workflows['author']} %>
46
        </div>
46
      <fieldset class="collapsible collapsed" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
47
        <legend onclick="toggleFieldset(this);toggleDivToFieldset('workflow_author',this.parentNode.className);">
48
          <%= l(:label_additional_workflow_transitions_for_author) %>
49
        </legend>
47 50
      </fieldset>
51
      <div id="workflow_author" style="visibility: hidden; position: fixed; top: 0px; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
52
        <%= render :partial => 'form', :locals => {:name => 'author', :workflows => @workflows['author']} %>
53
      </div>
48 54
      <%= javascript_tag "hideFieldset($('#author_workflows'))" unless @workflows['author'].present? %>
49 55

  
50
      <fieldset class="collapsible" style="padding: 0;">
51
        <legend onclick="toggleFieldset(this);"><%= l(:label_additional_workflow_transitions_for_assignee) %></legend>
52
        <div id="assignee_workflows" style="margin: 0.5em 0 0.5em 0;">
53
      <%= render :partial => 'form', :locals => {:name => 'assignee', :workflows => @workflows['assignee']} %>
54
        </div>
56
      <fieldset class="collapsible collapsed" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
57
        <legend onclick="toggleFieldset(this);toggleDivToFieldset('workflow_assignee',this.parentNode.className);">
58
          <%= l(:label_additional_workflow_transitions_for_assignee) %>
59
        </legend>
55 60
      </fieldset>
61
      <div id="workflow_assignee" style="visibility: hidden; position: fixed; top: 0px; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
62
        <%= render :partial => 'form', :locals => {:name => 'assignee', :workflows => @workflows['assignee']} %>
63
      </div>
56 64
      <%= javascript_tag "hideFieldset($('#assignee_workflows'))" unless @workflows['assignee'].present? %>
65

  
66
      <script> g_adjust('g_bl_always', 'g_fr_always', 'g_fl_always', 'g_bd_always'); </script>
67
      <script> g_adjust('g_bl_author', 'g_fr_author', 'g_fl_author', 'g_bd_author'); </script>
68
      <script> g_adjust('g_bl_assignee', 'g_fr_assignee', 'g_fl_assignee', 'g_bd_assignee'); </script>
57 69
    </div>
58 70
    <%= submit_tag l(:button_save) %>
59 71
  <% end %>
app/views/workflows/index.html.erb
1 1
<%= title [l(:label_workflow), workflows_edit_path], l(:field_summary) %>
2 2

  
3 3
<% if @roles.empty? || @trackers.empty? %>
4
<p class="nodata"><%= l(:label_no_data) %></p>
4
  <p class="nodata"><%= l(:label_no_data) %></p>
5 5
<% else %>
6
<div class="autoscroll">
7
<table class="list">
8
<thead>
9
    <tr>
10
    <th></th>
11
    <% @roles.each do |role| %>
12
    <th>
13
        <%= content_tag(role.builtin? ? 'em' : 'span', role.name) %>
14
    </th>
15
    <% end %>
16
    </tr>
17
</thead>
18
<tbody>
19
<% @trackers.each do |tracker| -%>
20
<tr>
21
  <td class="name"><%= tracker.name %></td>
22
  <% @roles.each do |role| -%>
23
  <% count = @workflow_counts[[tracker.id, role.id]] || 0 %>
24
    <td>
25
      <%= link_to((count > 0 ? count : content_tag(:span, nil, :class => 'icon-only icon-not-ok')),
26
                  {:action => 'edit', :role_id => role, :tracker_id => tracker},
27
                  :title => l(:button_edit)) %>
28
    </td>
29
  <% end -%>
30
</tr>
31
<% end -%>
32
</tbody>
33
</table>
34
</div>
6
  <%= stylesheet_link_tag 'divgrid' %>
7
  <%= javascript_include_tag 'divgrid' %>
8

  
9
  <div style="position: relative; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
10
    <!-- Cell 0 -->
11
    <div id="g_bl" style="position: absolute; top: 0px; left: 0px; z-index: 2;">
12
      <div class="g_c g_h">&nbsp;</div>
13
    </div>
14
    <!-- Line 0  -->
15
    <div id="g_fl" class="ibf" style="position: absolute; top: 0px; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
16
      <div style="display: inline-block;">
17
        <div class="g_c">&nbsp;</div>
18
      </div>
19
      <% @roles.each do |role| %>
20
        <div style="display: inline-block;">
21
          <div class="g_c g_h">
22
            <%= role.name %>
23
          </div>
24
        </div>
25
      <% end %>
26
    </div>
27
    <!-- Row 0 -->
28
    <div id="g_fr" style="position: absolute; top: 0px; left: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
29
      <div class="g_c">&nbsp;</div>
30
      <% even = false %>
31
      <% @trackers.each do |tracker| %>
32
        <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
33
          <% even = !even %>
34
          <%= tracker.name %>
35
        </div>
36
      <% end %>
37
    </div>
38
    <!-- Body -->
39
    <div id="g_bd" class="ibf" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fl', 'g_fr')">
40
      <div style="display: inline-block;"></div>
41
      <% @roles.each do |role| %>
42
        <div style="display: inline-block;">
43
          <div class="g_c">&nbsp;</div>
44
          <% even = false %>
45
          <% @trackers.each do |tracker| %>
46
            <% count = @workflow_counts[[tracker.id, role.id]] || 0 %>
47
            <div class="g_c<%= (even)? " g_e":" g_o" %>" title="<%= "#{tracker} - #{role}" %>">
48
              <% even = !even %>
49
              <%= link_to((count > 0 ? count : content_tag(:span, nil, :class => 'icon-only icon-not-ok')),
50
                          {:action => 'edit', :role_id => role, :tracker_id => tracker}) %>
51
            </div>
52
          <% end %>
53
        </div>
54
      <% end %>
55
    </div>
56
  </div>
57

  
58
  <script> g_adjust('g_bl', 'g_fr', 'g_fl', 'g_bd'); </script>
59

  
35 60
<% end %>
app/views/workflows/permissions.html.erb
31 31
<% end %>
32 32

  
33 33
<% if @trackers && @roles && @statuses.any? %>
34
  <%= stylesheet_link_tag 'divgrid' %>
35
  <%= javascript_include_tag 'divgrid' %>
36

  
34 37
  <%= form_tag({}, :id => 'workflow_form' ) do %>
35 38
    <%= @trackers.map {|tracker| hidden_field_tag 'tracker_id[]', tracker.id, :id => nil}.join.html_safe %>
36 39
    <%= @roles.map {|role| hidden_field_tag 'role_id[]', role.id, :id => nil}.join.html_safe %>
37 40
    <%= hidden_field_tag 'used_statuses_only', params[:used_statuses_only], :id => nil %>
41
    <%= hidden_field_tag 'used_role_statuses_only', params[:used_role_statuses_only], :id => nil %>
42

  
38 43
    <div class="autoscroll">
39
    <table class="list workflows fields_permissions">
40
    <thead>
41
      <tr>
42
        <th>
43
        </th>
44
        <th colspan="<%= @statuses.length %>"><%=l(:label_issue_status)%></th>
45
      </tr>
46
      <tr>
47
        <td></td>
48
        <% for status in @statuses %>
49
        <td style="width:<%= 75 / @statuses.size %>%;">
50
          <%= status.name %>
51
        </td>
52
        <% end %>
53
      </tr>
54
    </thead>
55
    <tbody>
56
      <tr class="group open">
57
        <td colspan="<%= @statuses.size + 1 %>">
58
          <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
44
      <fieldset class="collapsible" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
45
        <legend style="padding-left: 0; background: none;">
59 46
          <%= l(:field_core_fields) %>
60
        </td>
61
      </tr>
62
      <% @fields.each do |field, name| %>
63
      <tr>
64
        <td class="name">
65
          <%= name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
66
        </td>
67
        <% for status in @statuses -%>
68
        <td class="<%= @permissions[status.id][field].try(:join, ' ') %>" title="<%= name %> (<%= status.name %>)">
69
          <%= field_permission_tag(@permissions, status, field, @roles) %>
70
          <% unless status == @statuses.last %><a href="#" class="repeat-value">&#187;</a><% end %>
71
        </td>
72
        <% end -%>
73
      </tr>
74
      <% end %>
47
        </legend>
48
      </fieldset>
49
      <div id='default_fields' style="position: relative; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
50
        <!-- Cell 0 -->
51
        <div id="g_bla" style="position: absolute; top: 0px; left: 0px; z-index: 2;">
52
          <div class="g_c g_h">&nbsp;</div>
53
        </div>
54
        <!-- Line 0  -->
55
        <div id="g_fla" class="ibf" style="position: absolute; top: 0px; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
56
          <div style="display: inline-block;">
57
            <div class="g_c">&nbsp;</div>
58
          </div>
59
          <% for status in @statuses %>
60
            <div style="display: inline-block;">
61
              <div class="g_c g_h">
62
                <%= status.name %>
63
              </div>
64
            </div>
65
          <% end %>
66
        </div>
67
        <!-- Row 0 -->
68
        <div id="g_fra" style="position: absolute; top: 0px; left: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
69
          <div class="g_c">&nbsp;</div>
70
          <% even = false %>
71
          <% @fields.each do |field, name| %>
72
            <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
73
              <% even = !even %>
74
              <%= name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
75
            </div>
76
          <% end %>
77
        </div>
78
        <!-- Body -->
79
        <div id="g_bda" class="ibf" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fla', 'g_fra')">
80
          <div style="display: inline-block;"></div>
81
          <% for status in @statuses %>
82
            <div style="display: inline-block;">
83
              <div class="g_c">&nbsp;</div>
84
              <% even = false %>
85
              <% @fields.each do |field, name| %>
86
                <div class="g_c<%= (even)? " g_e" : " g_o" %> <%= @permissions[status.id][field].try(:join, ' ') %>" title="<%= name %> (<%= status.name %>)">
87
                  <div style="margin-top: -5px;" >
88
                    <% even = !even %>
89
                    <%= field_permission_tag(@permissions, status, field, @roles) %>
90
                  </div>
91
                </div>
92
              <% end %>
93
            </div>
94
          <% end %>
95
        </div>
96
      </div>
97
  
75 98
      <% if @custom_fields.any? %>
76
        <tr class="group open">
77
          <td colspan="<%= @statuses.size + 1 %>">
78
            <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
99
        <fieldset class="collapsible" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
100
          <legend onclick="toggleFieldset(this);toggleDivToFieldset('personal_fields',this.parentNode.className);">
79 101
            <%= l(:label_custom_field_plural) %>
80
          </td>
81
        </tr>
82
        <% @custom_fields.each do |field| %>
83
        <tr>
84
          <td class="name">
85
            <%= field.name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
86
          </td>
87
          <% for status in @statuses -%>
88
          <td class="<%= @permissions[status.id][field.id.to_s].try(:join, ' ') %>" title="<%= field.name %> (<%= status.name %>)">
89
            <%= field_permission_tag(@permissions, status, field, @roles) %>
90
            <% unless status == @statuses.last %><a href="#" class="repeat-value">&#187;</a><% end %>
91
          </td>
92
          <% end -%>
93
        </tr>
94
        <% end %>
95
      <% end %>
96
    </tbody>
97
    </table>
102
          </legend>
103
        </fieldset>
104
        <div id='personal_fields' style="position: relative; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
105
          <!-- Cell 0 -->
106
          <div id="g_blb" style="position: absolute; top: 0px; left: 0px; z-index: 2;">
107
            <div class="g_c g_h">&nbsp;</div>
108
          </div>
109
          <!-- Line 0  -->
110
          <div id="g_flb" class="ibf" style="position: absolute; top: 0px; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
111
            <div style="display: inline-block;">
112
              <div class="g_c">&nbsp;</div>
113
            </div>
114
            <% for status in @statuses %>
115
              <div style="display: inline-block;">
116
                <div class="g_c g_h">
117
                  <%= status.name %>
118
                </div>
119
              </div>
120
            <% end %>
121
          </div>
122
          <!-- Row 0 -->
123
          <div id="g_frb" style="position: absolute; top: 0px; left: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
124
            <div class="g_c">&nbsp;</div>
125
            <% even = false %>
126
            <% @custom_fields.each do |field| %>
127
              <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
128
                <% even = !even %>
129
                <%= field.name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
130
              </div>
131
            <% end %>
132
          </div>
133
          <!-- Body -->
134
          <div id="g_bdb" class="ibf" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_flb', 'g_frb')">
135
            <div style="display: inline-block;"></div>
136
            <% for status in @statuses %>
137
              <div style="display: inline-block;">
138
                <div class="g_c">&nbsp;</div>
139
                <% even = false %>
140
                <% @custom_fields.each do |field| %>
141
                  <div class="g_c<%= (even)? " g_e" : " g_o" %> <%= @permissions[status.id][field.id.to_s] %>"  title="<%= field.name %> (<%= status.name %>)">
142
                    <div style="margin-top: -5px;" >
143
                      <% even = !even %>
144
                      <%= field_permission_tag(@permissions, status, field, @roles) %>
145
                    </div>
146
                  </div>
147
                <% end %>
148
              </div>
149
            <% end %>
150
          </div>
151
        </div>
152
      <% end -%>
153
      <script> g_adjust('g_bla', 'g_fra', 'g_fla', 'g_bda'); </script>
154
      <script> g_adjust('g_blb', 'g_frb', 'g_flb', 'g_bdb'); </script>
98 155
    </div>
99 156
    <%= submit_tag l(:button_save) %>
100 157
  <% end %>
public/javascripts/divgrid.js
1
/* Simple Grid Scripts tables with fixed First Row and Line */
2

  
3
// scrolls first line and row with body
4
// div is this
5
// row is id of row Ex: g_fr
6
// line is id of line Ex: g_fl
7
function g_scroll(div, line, row) {
8
  document.getElementById(line).style.left = - div.scrollLeft + 'px';
9
  document.getElementById(row).style.top = - div.scrollTop + 'px';
10
}
11

  
12
// adjusts width of rows
13
// bli is the block div
14
// fri is the first row div
15
// fli is the first line div
16
// bdi is the body div
17
function g_adjust(bli, fri, fli, bdi) {
18
  var frw = document.getElementById(fri).offsetWidth;
19
  var frw2 = document.getElementById(bli).offsetWidth;
20
  if ( frw2 > frw ) {
21
    frw = frw2 + "px"
22
  } else {
23
    frw = frw + "px";
24
  }
25

  
26
  document.getElementById(fri).style.width = frw;
27
  document.getElementById(bli).style.width = frw;
28

  
29
  var fl = document.getElementById(fli);
30
  fl.children[0].style.width = frw;
31

  
32
  var bd = document.getElementById(bdi);
33
  bd.children[0].style.width = frw;
34

  
35
  for (var i = 1; i < fl.children.length; i++) {
36
    s1 = fl.children[i].offsetWidth;
37
    s2 = bd.children[i].offsetWidth;
38
    if (s1 > s2) {
39
      bd.children[i].style.width = s1 + "px"
40
    } else {
41
      fl.children[i].style.width = s2 + "px"
42
    }
43
  }
44
}
45

  
46
// Toggle visibility of table
47
function toggleDivToFieldset(divId, fsClass) {
48
  if (~fsClass.indexOf("collapsed")) {
49
    document.getElementById(divId).style.visibility='hidden';
50
    document.getElementById(divId).style.position='fixed';
51
  } else {
52
    document.getElementById(divId).style.visibility='';
53
    document.getElementById(divId).style.position='relative';
54
    document.getElementById(divId).children[1].style.left='0px';
55
  }
56
}
public/stylesheets/divgrid.css
1
/* Simple Grid Styles for tables with fixed First Row and Line */
2

  
3
/* Cell */
4
.g_c { height: 1.5em;
5
       padding: 6px;
6
       font-size: 12px;
7
       border-width: 0px 1px 1px 0px;
8
       border-style: solid;
9
       border-color: #CCC;
10
       text-align: center; }
11

  
12
/* First Line */
13
.g_h { background-color: #EEE;
14
       text-align: center; }
15

  
16
/* First Row */
17
.g_v { text-align: left; }
18

  
19
/* Image in Cell */
20
.g_i { height: 16px;
21
       width: 16px;
22
       margin: 0 auto; }
23

  
24
/* Separation Lines */
25
.g_s { font-weight: bold;
26
       border-right: 0px; }
27

  
28
/* Marked Cell */
29
.g_m { background-color: #BFB; }
30

  
31
/* Even Cell */
32
.g_e { background-color: #F6F7F8; }
33

  
34
/* Odd Cell */
35
.g_o { background-color: #FFFFFF; }
36

  
37
/* Inline Block Fix */
38
.ibf { font-size: 0; }
(9-9/18)