issue-20287-redmine-3.3.0.diff

Frederico Camara, 2017-03-23 14:02

Download (33.9 KB)

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
        <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
38
          <% even = !even %>
39
          <%= l_or_humanize(permission.name, :prefix => 'permission_') %>
40
        </div>
41
      <% end %>
34 42
    <% end %>
35
    <% perms_by_module[mod].each do |permission| %>
36
        <tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
37
        <td class="name">
38
            <%= link_to_function('',
39
                                 "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
40
                                 :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
41
                                 :class => 'icon-only icon-checked') %>
42
            <%= l_or_humanize(permission.name, :prefix => 'permission_') %>
43
        </td>
44
        <% @roles.each do |role| %>
45
        <td>
46
        <% if role.setable_permissions.include? permission %>
47
          <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
48
        <% end %>
49
        </td>
43
  </div>
44
  <!-- Body -->
45
  <div id="g_bd" class="ibf" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fl', 'g_fr')">
46
    <div style="display: inline-block;"></div>
47
    <% @roles.each do |role| %>
48
      <div style="display: inline-block;">
49
        <% even = true %>
50
        <% perms_by_module.keys.sort.each do |mod| %>
51
          <div class="g_c<%= " g_s" unless role == @roles.last %><%= (even)? " g_e":" g_o" %>"></div>
52
          <% even = !even %>
53
          <% perms_by_module[mod].each do |permission| %>
54
            <div class="g_c<%= (even)? " g_e":" g_o" %>" title="<%= "#{l_or_humanize(permission.name, :prefix => 'permission_')} - #{role.name}" %>">
55
              <% even = !even %>
56
              <% if role.setable_permissions.include? permission %>
57
                <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
58
              <% else %>
59
                &nbsp;
60
              <% end %>
61
            </div>
62
          <% end %>
50 63
        <% end %>
51
        </tr>
64
      </div>
52 65
    <% end %>
53
<% end %>
54
</tbody>
55
</table>
66
  </div>
56 67
</div>
68

  
69
<script> g_adjust('g_bl', 'g_fr', 'g_fl', 'g_bd'); </script>
70

  
57 71
<p><%= check_all_links 'permissions_form' %></p>
58 72
<p><%= submit_tag l(:button_save) %></p>
59 73
<% 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 class="<%= cycle("odd", "even") %>">
29
        <td class="name">
30
          <%= link_to_function('', "toggleCheckboxesBySelector('input.core-field-#{field}')",
31
                               :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
32
                               :class => 'icon-only icon-checked') %>
33
          <%= l("field_#{field}".sub(/_id$/, '')) %>
34
        </td>
35
        <% @trackers.each do |tracker| %>
36
        <td>
37
          <%= check_box_tag "trackers[#{tracker.id}][core_fields][]", field, tracker.core_fields.include?(field),
38
                            :class => "tracker-#{tracker.id} core-field-#{field}", :id => nil %>
39
        </td>
33
        </div>
34
        <% Tracker::CORE_FIELDS.each do |field| %>
35
          <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
36
            <% even = !even %>
37
            <%= l("field_#{field}".sub(/_id$/, '')) %>
38
          </div>
40 39
        <% end %>
41
      </tr>
42
      <% end %>
43
      <% if @custom_fields.any? %>
44
        <tr class="group open">
45
          <td colspan="<%= @trackers.size + 1 %>">
46
            <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
40
        <% if @custom_fields.any? %>
41
          <div class="g_c g_v g_s<%= (even)? " g_e":" g_o" %>">
42
            <% even = !even %>
47 43
            <%= l(:label_custom_field_plural) %>
48
          </td>
49
        </tr>
50
        <% @custom_fields.each do |field| %>
51
        <tr class="<%= cycle("odd", "even") %>">
52
          <td class="name">
53
            <%= link_to_function('', "toggleCheckboxesBySelector('input.custom-field-#{field.id}')",
54
                                 :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
55
                                 :class => 'icon-only icon-checked') %>
56
            <%= field.name %>
57
          </td>
58
          <% @trackers.each do |tracker| %>
59
          <td>
60
            <%= check_box_tag "trackers[#{tracker.id}][custom_field_ids][]", field.id, tracker.custom_fields.include?(field),
61
                              :class => "tracker-#{tracker.id} custom-field-#{field.id}", :id => nil %>
62
          </td>
44
          </div>
45
          <% @custom_fields.each do |field| %>
46
            <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
47
              <% even = !even %>
48
              <%= field.name %>
49
            </div>
63 50
          <% end %>
64
        </tr>
65 51
        <% end %>
66
      <% end %>
67
    </tbody>
68
    </table>
52
      </div>
53
      <!-- Body -->
54
      <div id="g_bd" class="ibf" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fl', 'g_fr')">
55
        <div style="display: inline-block;"></div>
56
        <% @trackers.each do |tracker| %>
57
          <div style="display: inline-block;">
58
            <div class="g_c">&nbsp;</div>
59
            <% even = false %>
60
            <div class="g_c<%= " g_s" unless tracker == @trackers.last %><%= (even)? " g_e":" g_o" %>"></div>
61
            <% even = !even %>
62
            <% Tracker::CORE_FIELDS.each do |field| %>
63
              <div class="g_c<%= (even)? " g_e":" g_o" %>" title="<%= "#{l("field_#{field}".sub(/_id$/, ''))} - #{tracker}" %>">
64
                <% even = !even %>
65
                <%= check_box_tag "trackers[#{tracker.id}][core_fields][]", field, tracker.core_fields.include?(field),
66
                                  :class => "tracker-#{tracker.id} core-field-#{field}", :id => nil %>
67
              </div>
68
            <% end %>
69
            <% if @custom_fields.any? %>
70
              <div class="g_c<%= " g_s" unless tracker == @trackers.last %><%= (even)? " g_e":" g_o" %>"></div>
71
              <% even = !even %>
72
              <% @custom_fields.each do |field| %>
73
                <div class="g_c<%= (even)? " g_e":" g_o" %>" title="<%= "#{field.name} - #{tracker}" %>">
74
                  <% even = !even %>
75
                  <%= check_box_tag "trackers[#{tracker.id}][custom_field_ids][]", field.id, tracker.custom_fields.include?(field),
76
                                    :class => "tracker-#{tracker.id} custom-field-#{field.id}", :id => nil %>
77
                </div>
78
              <% end %>
79
            <% end %>
80
          </div>
81
        <% end %>
82
      </div>
69 83
    </div>
70 84
    <p><%= submit_tag l(:button_save) %></p>
71 85
    <% @trackers.each do |tracker| %>
......
73 87
      <%= hidden_field_tag "trackers[#{tracker.id}][custom_field_ids][]", '' %>
74 88
    <% end %>
75 89
  <% end %>
90

  
91
  <script> g_adjust('g_bl', 'g_fr', 'g_fl', 'g_bd'); </script>
92

  
76 93
<% else %>
77 94
  <p class="nodata"><%= l(:label_no_data) %></p>
78 95
<% 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 class="<%= cycle("odd", "even") %>">
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') %>
32

  
23
    <% next if old_status.nil? && name != 'always' %>
24
    <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
25
      <% even = !even %>
33 26
      <%= old_status ? old_status.name : content_tag('em', l(:label_issue_new)) %>
34
    </td>
35
    <% for new_status in @statuses -%>
36
    <% checked = workflows.detect {|w| w.old_status == old_status && w.new_status == new_status} %>
37
    <td class="<%= checked ? 'enabled' : '' %>">
38
      <%= transition_tag workflows, old_status, new_status, name %>
39
    </td>
40
    <% end -%>
41
  </tr>
27
    </div>
28
  <% end %>
29
</div>
30
<!-- Body -->
31
<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 %>')">
32
  <div style="display: inline-block;"></div>
33
  <% for new_status in @statuses %>
34
    <div style="display: inline-block;">
35
      <div class="g_c">&nbsp;</div>
36
      <% even = false %>
37
      <% for old_status in [nil] + @statuses %>
38
        <% next if old_status.nil? && name != 'always' %>
39
        <% checked = workflows.detect {|w| w.old_status == old_status && w.new_status == new_status} %>
40
        <div class="g_c<%= checked ? " g_m" : (even)? " g_e" : " g_o" %>" title="<%= old_status ? old_status.name : content_tag('em', l(:label_issue_new)) %> &rarr; <%= new_status.name %>">
41
          <% even = !even %>
42
          <%= transition_tag workflows, old_status, new_status, name %>
43
        </div>
44
      <% end %>
45
    </div>
42 46
  <% end %>
43
</tbody>
44
</table>
47
</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 class="<%= cycle('odd', 'even') %>">
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 class="<%= cycle("odd", "even") %>">
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, ' ') %>">
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 class="<%= cycle("odd", "even") %>">
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, ' ') %>">
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; }