issue-20287-redmine-3.2.0.diff

Frederico Camara, 2015-12-28 17:55

Download (34.5 KB)

View differences:

redmine/app/views/roles/permissions.html.erb 2015-12-28 11:33:56.763000746 -0200
2 2
<%= form_tag(permissions_roles_path, :id => 'permissions_form') do %>
3 3
<%= hidden_field_tag 'permissions[0]', '', :id => nil %>
4
<div class="autoscroll">
5
<table class="list permissions">
6
<thead>
7
    <tr>
8
    <th><%=l(:label_permissions)%></th>
4

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

  
66
<script> g_adjust('g_bl', 'g_fr', 'g_fl', 'g_bd'); </script>
67

  
52 68
<p><%= check_all_links 'permissions_form' %></p>
53 69
<p><%= submit_tag l(:button_save) %></p>
54 70
<% end %>
redmine/app/views/trackers/fields.html.erb 2015-12-21 19:54:52.435001824 -0200
2 2
<% if @trackers.any? %>
3 3
  <%= form_tag fields_trackers_path do %>
4
    <div class="autoscroll">
5
    <table class="list">
6
    <thead>
7
      <tr>
8
        <th></th>
4
    <%= stylesheet_link_tag 'divgrid' %>
5
    <%= javascript_include_tag 'divgrid' %>
6

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

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

  
73 93
<% else %>
74 94
  <p class="nodata"><%= l(:label_no_data) %></p>
75 95
<% end %>
redmine/app/views/workflows/permissions.html.erb 2015-12-21 20:22:51.411000459 -0200
31 35
<% end %>
32 36
<% if @trackers && @roles && @statuses.any? %>
37
  <%= stylesheet_link_tag 'divgrid' %>
38
  <%= javascript_include_tag 'divgrid' %>
39

  
40
  <script type="text/javascript">
41
    function toggleDivToFieldset(divId, fsClass) {
42
      console.log(divId + " " + fsClass);
43
      if (fsClass.contains("collapsed")) {
44
        document.getElementById(divId).style.visibility='hidden';
45
        document.getElementById(divId).style.position='fixed';
46
      } else {
47
        document.getElementById(divId).style.visibility='';
48
        document.getElementById(divId).style.position='relative';
49
      }
50
    }
51
  </script>
52

  
33 53
  <%= form_tag({}, :id => 'workflow_form' ) do %>
34 54
    <%= @trackers.map {|tracker| hidden_field_tag 'tracker_id[]', tracker.id, :id => nil}.join.html_safe %>
35 55
    <%= @roles.map {|role| hidden_field_tag 'role_id[]', role.id, :id => nil}.join.html_safe %>
36 56
    <%= hidden_field_tag 'used_statuses_only', params[:used_statuses_only], :id => nil %>
57
    <%= hidden_field_tag 'used_role_statuses_only', params[:used_role_statuses_only], :id => nil %>
58

  
37 59
    <div class="autoscroll">
38
    <table class="list workflows fields_permissions">
39
    <thead>
40
      <tr>
41
        <th>
42
        </th>
43
        <th colspan="<%= @statuses.length %>"><%=l(:label_issue_status)%></th>
44
      </tr>
45
      <tr>
46
        <td></td>
47
        <% for status in @statuses %>
48
        <td style="width:<%= 75 / @statuses.size %>%;">
49
          <%= status.name %>
50
        </td>
51
        <% end %>
52
      </tr>
53
    </thead>
54
    <tbody>
55
      <tr class="group open">
56
        <td colspan="<%= @statuses.size + 1 %>">
57
          <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
60
      <fieldset class="collapsible" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
61
        <legend style="padding-left: 0; background: none;">
58 62
          <%= l(:field_core_fields) %>
59
        </td>
60
      </tr>
61
      <% @fields.each do |field, name| %>
62
      <tr class="<%= cycle("odd", "even") %>">
63
        <td class="name">
64
          <%= name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
65
        </td>
66
        <% for status in @statuses -%>
67
        <td class="<%= @permissions[status.id][field].try(:join, ' ') %>">
68
          <%= field_permission_tag(@permissions, status, field, @roles) %>
69
          <% unless status == @statuses.last %><a href="#" class="repeat-value">&#187;</a><% end %>
70
        </td>
71
        <% end -%>
72
      </tr>
73
      <% end %>
63
        </legend>
64
      </fieldset>
65
      <div id='default_fields' style="position: relative; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
66
        <!-- Cell 0 -->
67
        <div id="g_bla" style="position: absolute; z-index: 2;">
68
          <div class="g_c g_h">&nbsp;</div>
69
        </div>
70
        <!-- Line 0  -->
71
        <div id="g_fla" style="position: absolute; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
72
          <div style="display: inline-block; margin-right: -4px;">
73
            <div class="g_c g_h">&nbsp;</div>
74
          </div>
75
          <% for status in @statuses %>
76
            <div style="display: inline-block; margin-right: -4px;">
77
              <div class="g_c g_h">
78
                <%= status.name %>
79
              </div>
80
            </div>
81
          <% end %>
82
        </div>
83
        <!-- Row 0 -->
84
        <div id="g_fra" style="position: absolute; left: 0px; top: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
85
          <div class="g_c">&nbsp;</div>
86
          <% even = false %>
87
          <% @fields.each do |field, name| %>
88
            <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
89
              <% even = !even %>
90
              <%= name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
91
            </div>
92
          <% end %>
93
        </div>
94
        <!-- Body -->
95
        <div id="g_bda" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fla', 'g_fra')">
96
          <div style="display: inline-block; margin-right: -4px;"></div>
97
          <% for status in @statuses %>
98
            <div style="display: inline-block; margin-right: -4px;">
99
              <div class="g_c">&nbsp;</div>
100
              <% even = false %>
101
              <% @fields.each do |field, name| %>
102
                <div class="g_c<%= (even)? " g_e" : " g_o" %> <%= @permissions[status.id][field] %>" title="<%= "#{name} - #{status.name}" %>">
103
                  <div style="margin-top: -5px;" >
104
                    <% even = !even %>
105
                    <%= field_permission_tag(@permissions, status, field, @roles) %>
106
                  </div>
107
                </div>
108
              <% end %>
109
            </div>
110
          <% end %>
111
        </div>
112
      </div>
113
  
74 114
      <% if @custom_fields.any? %>
75
        <tr class="group open">
76
          <td colspan="<%= @statuses.size + 1 %>">
77
            <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
115
        <fieldset class="collapsible" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
116
          <legend onclick="toggleFieldset(this);toggleDivToFieldset('personal_fields',this.parentNode.className);">
78 117
            <%= l(:label_custom_field_plural) %>
79
          </td>
80
        </tr>
81
        <% @custom_fields.each do |field| %>
82
        <tr class="<%= cycle("odd", "even") %>">
83
          <td class="name">
84
            <%= field.name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
85
          </td>
86
          <% for status in @statuses -%>
87
          <td class="<%= @permissions[status.id][field.id.to_s] %>">
88
            <%= field_permission_tag(@permissions, status, field, @roles) %>
89
            <% unless status == @statuses.last %><a href="#" class="repeat-value">&#187;</a><% end %>
90
          </td>
91
          <% end -%>
92
        </tr>
93
        <% end %>
94
      <% end %>
95
    </tbody>
96
    </table>
118
          </legend>
119
        </fieldset>
120
        <div id='personal_fields' style="position: relative; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
121
          <!-- Cell 0 -->
122
          <div id="g_blb" style="position: absolute; z-index: 2;">
123
            <div class="g_c g_h">&nbsp;</div>
124
          </div>
125
          <!-- Line 0  -->
126
          <div id="g_flb" style="position: absolute; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
127
            <div style="display: inline-block; margin-right: -4px;">
128
              <div class="g_c g_h">&nbsp;</div>
129
            </div>
130
            <% for status in @statuses %>
131
              <div style="display: inline-block; margin-right: -4px;">
132
                <div class="g_c g_h">
133
                  <%= status.name %>
134
                </div>
135
              </div>
136
            <% end %>
137
          </div>
138
          <!-- Row 0 -->
139
          <div id="g_frb" style="position: absolute; left: 0px; top: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
140
            <div class="g_c">&nbsp;</div>
141
            <% even = false %>
142
            <% @custom_fields.each do |field| %>
143
              <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
144
                <% even = !even %>
145
                <%= field.name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
146
              </div>
147
            <% end %>
148
          </div>
149
          <!-- Body -->
150
          <div id="g_bdb" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_flb', 'g_frb')">
151
            <div style="display: inline-block; margin-right: -4px;"></div>
152
            <% for status in @statuses %>
153
              <div style="display: inline-block; margin-right: -4px;">
154
                <div class="g_c">&nbsp;</div>
155
                <% even = false %>
156
                <% @custom_fields.each do |field| %>
157
                  <div class="g_c<%= (even)? " g_e" : " g_o" %> <%= @permissions[status.id][field.id.to_s] %>" title="<%= "#{field.name} - #{status.name}" %>">
158
                    <div style="margin-top: -5px;" >
159
                      <% even = !even %>
160
                      <%= field_permission_tag(@permissions, status, field, @roles) %>
161
                    </div>
162
                  </div>
163
                <% end %>
164
              </div>
165
            <% end %>
166
          </div>
167
        </div>
168
      <% end -%>
169
      <script> g_adjust('g_bla', 'g_fra', 'g_fla', 'g_bda'); </script>
170
      <script> g_adjust('g_blb', 'g_frb', 'g_flb', 'g_bdb'); </script>
97 171
    </div>
98 172
    <%= submit_tag l(:button_save) %>
99 173
  <% end %>
redmine/app/views/workflows/index.html.erb 2015-12-22 11:34:51.760000343 -0200
1 1
<%= title [l(:label_workflow), workflows_edit_path], l(:field_summary) %>
2 2
<% if @roles.empty? || @trackers.empty? %>
3
<p class="nodata"><%= l(:label_no_data) %></p>
3
  <p class="nodata"><%= l(:label_no_data) %></p>
4 4
<% else %>
5
<div class="autoscroll">
6
<table class="list">
7
<thead>
8
    <tr>
9
    <th></th>
10
    <% @roles.each do |role| %>
11
    <th>
12
        <%= content_tag(role.builtin? ? 'em' : 'span', role.name) %>
13
    </th>
14
    <% end %>
15
    </tr>
16
</thead>
17
<tbody>
18
<% @trackers.each do |tracker| -%>
19
<tr class="<%= cycle('odd', 'even') %>">
20
  <td class="name"><%= tracker.name %></td>
21
  <% @roles.each do |role| -%>
22
  <% count = @workflow_counts[[tracker.id, role.id]] || 0 %>
23
    <td>
24
      <%= link_to((count > 0 ? count : image_tag('false.png')), {:action => 'edit', :role_id => role, :tracker_id => tracker}, :title => l(:button_edit)) %>
25
    </td>
26
  <% end -%>
27
</tr>
28
<% end -%>
29
</tbody>
30
</table>
31
</div>
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; z-index: 2;">
11
      <div class="g_c g_h">&nbsp;</div>
12
    </div>
13
    <!-- Line 0  -->
14
    <div id="g_fl" style="position: absolute; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
15
      <div style="display: inline-block; margin-right: -4px;">
16
        <div class="g_c g_h">&nbsp;</div>
17
      </div>
18
      <% @roles.each do |role| %>
19
        <div style="display: inline-block; margin-right: -4px;">
20
          <div class="g_c g_h">
21
            <%= role.name %>
22
          </div>
23
        </div>
24
      <% end %>
25
    </div>
26
    <!-- Row 0 -->
27
    <div id="g_fr" style="position: absolute; left: 0px; top: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
28
      <div class="g_c">&nbsp;</div>
29
      <% even = false %>
30
      <% @trackers.each do |tracker| %>
31
        <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
32
          <% even = !even %>
33
          <%= tracker.name %>
34
        </div>
35
      <% end %>
36
    </div>
37
    <!-- Body -->
38
    <div id="g_bd" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fl', 'g_fr')">
39
      <div style="display: inline-block; margin-right: -4px;"></div>
40
      <% @roles.each do |role| %>
41
        <div style="display: inline-block; margin-right: -4px;">
42
          <div class="g_c">&nbsp;</div>
43
          <% even = false %>
44
          <% @trackers.each do |tracker| %>
45
            <% count = @workflow_counts[[tracker.id, role.id]] || 0 %>
46
            <div class="g_c<%= (even)? " g_e":" g_o" %>" title="<%= "#{tracker} - #{role}" %>">
47
              <% even = !even %>
48
              <%= link_to((count > 0 ? count : image_tag('false.png')), {:action => 'edit', :role_id => role, :tracker_id => tracker}) %>
49
            </div>
50
          <% end %>
51
        </div>
52
      <% end %>
53
    </div>
54
  </div>
55

  
56
  <script> g_adjust('g_bl', 'g_fr', 'g_fl', 'g_bd'); </script>
57

  
32 58
<% end %>
redmine/app/views/workflows/edit.html.erb 2015-12-22 14:11:45.844000593 -0200
32 32
<% end %>
33 33
<% if @trackers && @roles && @statuses.any? %>
34
  <%= stylesheet_link_tag 'divgrid' %>
35
  <%= javascript_include_tag 'divgrid' %>
36

  
37
  <script type="text/javascript">
38
    function toggleDivToFieldset(divId, fsClass) {
39
      console.log(divId + " " + fsClass);
40
      if (fsClass.contains("collapsed")) {
41
        document.getElementById(divId).style.visibility='hidden';
42
        document.getElementById(divId).style.position='fixed';
43
      } else {
44
        document.getElementById(divId).style.visibility='';
45
        document.getElementById(divId).style.position='relative';
46
      }
47
    }
48
  </script>
49

  
34 50
  <%= form_tag({}, :id => 'workflow_form' ) do %>
35 51
    <%= @trackers.map {|tracker| hidden_field_tag 'tracker_id[]', tracker.id, :id => nil}.join.html_safe %>
36 52
    <%= @roles.map {|role| hidden_field_tag 'role_id[]', role.id, :id => nil}.join.html_safe %>
37 53
    <%= hidden_field_tag 'used_statuses_only', params[:used_statuses_only], :id => nil %>
38 54
    <div class="autoscroll">
39
      <%= render :partial => 'form', :locals => {:name => 'always', :workflows => @workflows['always']} %>
40

  
41
      <fieldset class="collapsible" style="padding: 0; margin-top: 0.5em;">
42
        <legend onclick="toggleFieldset(this);"><%= l(:label_additional_workflow_transitions_for_author) %></legend>
43
        <div id="author_workflows" style="margin: 0.5em 0 0.5em 0;">
44
          <%= render :partial => 'form', :locals => {:name => 'author', :workflows => @workflows['author']} %>
45
        </div>
55
      <div id="workflow_always" style="position: relative; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
56
        <%= render :partial => 'form', :locals => {:name => 'always', :workflows => @workflows['always']} %>
57
      </div>
58

  
59
      <fieldset class="collapsible collapsed" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
60
        <legend onclick="toggleFieldset(this);toggleDivToFieldset('workflow_author',this.parentNode.className);">
61
          <%= l(:label_additional_workflow_transitions_for_author) %>
62
        </legend>
46 63
      </fieldset>
64
      <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;">
65
        <%= render :partial => 'form', :locals => {:name => 'author', :workflows => @workflows['author']} %>
66
      </div>
47 67
      <%= javascript_tag "hideFieldset($('#author_workflows'))" unless @workflows['author'].present? %>
48
      <fieldset class="collapsible" style="padding: 0;">
49
        <legend onclick="toggleFieldset(this);"><%= l(:label_additional_workflow_transitions_for_assignee) %></legend>
50
        <div id="assignee_workflows" style="margin: 0.5em 0 0.5em 0;">
51
      <%= render :partial => 'form', :locals => {:name => 'assignee', :workflows => @workflows['assignee']} %>
52
        </div>
68
      <fieldset class="collapsible collapsed" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
69
        <legend onclick="toggleFieldset(this);toggleDivToFieldset('workflow_assignee',this.parentNode.className);">
70
          <%= l(:label_additional_workflow_transitions_for_assignee) %>
71
        </legend>
53 72
      </fieldset>
73
      <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;">
74
        <%= render :partial => 'form', :locals => {:name => 'assignee', :workflows => @workflows['assignee']} %>
75
      </div>
54 76
      <%= javascript_tag "hideFieldset($('#assignee_workflows'))" unless @workflows['assignee'].present? %>
77

  
78
      <script> g_adjust('g_bl_always', 'g_fr_always', 'g_fl_always', 'g_bd_always'); </script>
79
      <script> g_adjust('g_bl_author', 'g_fr_author', 'g_fl_author', 'g_bd_author'); </script>
80
      <script> g_adjust('g_bl_assignee', 'g_fr_assignee', 'g_fl_assignee', 'g_bd_assignee'); </script>
55 81
    </div>
56 82
    <%= submit_tag l(:button_save) %>
57 83
  <% end %>
redmine/app/views/workflows/_form.html.erb 2015-12-22 12:23:38.730005011 -0200
1
<table class="list workflows transitions transitions-<%= name %>">
2
<thead>
3
  <tr>
4
    <th>
5
      <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('table.transitions-#{name} input')",
6
                                                          :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
7
      <%=l(:label_current_status)%>
8
    </th>
9
    <th colspan="<%= @statuses.length %>"><%=l(:label_new_statuses_allowed)%></th>
10
  </tr>
11
  <tr>
12
    <td></td>
13
    <% for new_status in @statuses %>
14
    <td style="width:<%= 75 / @statuses.size %>%;">
15
      <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('table.transitions-#{name} input.new-status-#{new_status.id}')",
16
                                                      :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
17
      <%= new_status.name %>
18
    </td>
19
    <% end %>
20
  </tr>
21
</thead>
22
<tbody>
1
<!-- Cell 0 -->
2
<div id="g_bl_<%= name %>" style="position: absolute; z-index: 2;">
3
  <div class="g_c g_h">&nbsp;</div>
4
</div>
5
<!-- Line 0  -->
6
<div id="g_fl_<%= name %>" style="position: absolute; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
7
  <div style="display: inline-block; margin-right: -4px;">
8
    <div class="g_c g_h">&nbsp;</div>
9
  </div>
10
  <% for new_status in @statuses %>
11
    <div style="display: inline-block; margin-right: -4px;">
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; left: 0px; top: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
20
  <div class="g_c">&nbsp;</div>
21
  <% even = false %>
23 22
  <% for old_status in [nil] + @statuses %>
24
  <% next if old_status.nil? && name != 'always' %>
25
  <tr class="<%= cycle("odd", "even") %>">
26
    <td class="name">
27
      <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('table.transitions-#{name} input.old-status-#{old_status.try(:id) || 0}')",
28
                                                          :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
29

  
23
    <% next if old_status.nil? && name != 'always' %>
24
    <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
25
      <% even = !even %>
30 26
      <%= old_status ? old_status.name : content_tag('em', l(:label_issue_new)) %>
31
    </td>
32
    <% for new_status in @statuses -%>
33
    <% checked = workflows.detect {|w| w.old_status == old_status && w.new_status == new_status} %>
34
    <td class="<%= checked ? 'enabled' : '' %>">
35
      <%= transition_tag workflows, old_status, new_status, name %>
36
    </td>
37
    <% end -%>
38
  </tr>
27
    </div>
28
  <% end %>
29
</div>
30
<!-- Body -->
31
<div id="g_bd_<%= name %>" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fl_<%= name %>', 'g_fr_<%= name %>')">
32
  <div style="display: inline-block; margin-right: -4px;"></div>
33
  <% for new_status in @statuses %>
34
    <div style="display: inline-block; margin-right: -4px;">
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>
39 46
  <% end %>
40
</tbody>
41
</table>
47
</div>
redmine/public/javascripts/divgrid.js 2015-12-21 18:20:18.561999646 -0200
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 + "px";
19
  document.getElementById(bli).style.width = frw
20
  var fl = document.getElementById(fli).children;
21
  fl[0].style.width = frw
22
  var bd = document.getElementById(bdi).children;
23
  bd[0].style.width = frw
24

  
25
  for (var i = 1; i < fl.length; ++i) {
26
    s1 = fl[i].offsetWidth;
27
    s2 = bd[i].offsetWidth;
28
    if (s1 > s2) {
29
      bd[i].style.width = s1 + "px"
30
    } else {
31
      fl[i].style.width = s2 + "px"
32
    }
33
  }
34
}
redmine/public/stylesheets/divgrid.css 2015-12-21 18:20:11.362000169 -0200
1
/* Simple Grid Styles for tables with fixed First Row and Line */
2

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

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

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

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

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

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

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

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