trunk-r19977-v2.patch

Mizuki ISHIKAWA, 2020-08-21 07:58

Download (38.1 KB)

View differences:

app/views/roles/permissions.html.erb
27 27
<% @roles.each do |role| %>
28 28
    <%= hidden_field_tag "permissions[#{role.id}][]", '', :id => nil %>
29 29
<% end %>
30
<div class="autoscroll">
31
<table class="list permissions">
32
<thead>
33
    <tr>
34
    <th><%=l(:label_permissions)%></th>
30

  
31
<div class="grid-div-table permissions">
32
  <!-- Cell 0 -->
33
  <div id="g_bl" class='g-first-cell'>
34
    <div class="g-cell g-first-line-cell">&nbsp;</div>
35
  </div>
36
  <!-- Line 0  -->
37
  <div id="g_fl" class="g-inline-block-fix g-first-line-block">
38
    <div class="g-column">
39
      <div class="g-cell">&nbsp;</div>
40
    </div>
35 41
    <% @roles.each do |role| %>
36
    <th>
37
        <%= link_to_function('',
38
                             "toggleCheckboxesBySelector('input.role-#{role.id}')",
39
                             :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
40
                             :class => 'icon-only icon-checked') %>
41
        <%= content_tag(role.builtin? ? 'em' : 'span', role.name) %>
42
    </th>
42
      <div class="g-column">
43
        <div class="name g-cell g-first-line-cell">
44
          <%= link_to_function('',
45
                               "toggleCheckboxesBySelector('input.role-#{role.id}')",
46
                               :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
47
                               :class => 'icon-only icon-checked') %>
48
          <%= content_tag(role.builtin? ? 'em' : 'span', role.name) %>
49
        </div>
50
      </div>
43 51
    <% end %>
44
    </tr>
45
</thead>
46
<tbody>
47
<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
48
<% perms_by_module.keys.sort.each do |mod| %>
49
    <% unless mod.blank? %>
50
        <tr class="group open">
51
          <td>
52
            <span class="expander icon icon-expended" onclick="toggleRowGroup(this);">&nbsp;</span>
53
            <%= l_or_humanize(mod, :prefix => 'project_module_') %>
54
          </td>
55
          <% @roles.each do |role| %>
56
          <td class="role"><%= role.name %></td>
57
          <% end %>
58
        </tr>
52
  </div>
53
  <!-- Row 0 -->
54
  <div id="g_fr" class="g-first-row-block">
55
    <% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
56
    <% even = true %>
57
    <% perms_by_module.keys.sort.each do |mod| %>
58
      <div class="g-cell g-first-row-cell g-separation-line">
59
        <%= l_or_humanize(mod, :prefix => 'project_module_') %>
60
      </div>
61
      <% even = !even %>
62
      <% perms_by_module[mod].each do |permission| %>
63
        <div class="g-cell g-first-row-cell<%= (even)? " even":" odd" %> permission-<%= permission.name %>">
64
          <% even = !even %>
65
          <%= link_to_function('',
66
                               "toggleCheckboxesBySelector('input.permission-#{permission.name}')",
67
                               :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
68
                               :class => 'icon-only icon-checked') %>
69
          <%= l_or_humanize(permission.name, :prefix => 'permission_') %>
70
        </div>
71
      <% end %>
59 72
    <% end %>
60
    <% perms_by_module[mod].each do |permission| %>
61
        <% humanized_perm_name = l_or_humanize(permission.name, :prefix => 'permission_') %>
62
        <tr class="permission-<%= permission.name %>">
63
        <td class="name">
64
            <%= link_to_function('',
65
                                 "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
66
                                 :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
67
                                 :class => 'icon-only icon-checked') %>
68
            <%= humanized_perm_name %>
69
        </td>
70
        <% @roles.each do |role| %>
71
          <% if role.setable_permissions.include? permission %>
72
            <td title="<%= "#{humanized_perm_name} (#{role.name})" %>">
73
              <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
74
            </td>
75
          <% else %>
76
            <td></td>
73
  </div>
74
  <!-- Body -->
75
  <div id="g_bd" class="g-inline-block-fix g-body-block" onscroll="g_scroll(this, 'g_fl', 'g_fr')">
76
    <div class="g-column"></div>
77
    <% @roles.each do |role| %>
78
      <div class="g-column">
79
        <% even = true %>
80
        <% perms_by_module.keys.sort.each do |mod| %>
81
          <div class="g-cell g-separation-line <%= 'last-column' if role == @roles.last %>"></div>
82
          <% even = !even %>
83
          <% perms_by_module[mod].each do |permission| %>
84
            <div class="g-cell<%= (even)? " even":" odd" %>" title="<%= "#{l_or_humanize(permission.name, :prefix => 'permission_')} - #{role.name}" %>">
85
              <% even = !even %>
86
              <% if role.setable_permissions.include? permission %>
87
                <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id} permission-#{permission.name}" %>
88
              <% else %>
89
                &nbsp;
90
              <% end %>
91
            </div>
77 92
          <% end %>
78 93
        <% end %>
79
        </tr>
94
      </div>
80 95
    <% end %>
81
<% end %>
82
</tbody>
83
</table>
96
  </div>
84 97
</div>
98

  
85 99
<p><%= check_all_links 'permissions_form' %></p>
86 100
<p><%= submit_tag l(:button_save) %></p>
87 101
<% end %>
102

  
103
<% content_for :header_tags do %>
104
  <%= stylesheet_link_tag 'divgrid' %>
105
  <%= javascript_include_tag 'divgrid' %>
106
<% end %>
107

  
108
<%= javascript_tag do %>
109
  g_adjust('g_bl', 'g_fr', 'g_fl', 'g_bd');
110
<% 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 tracker-summary">
7
    <thead>
8
      <tr>
9
        <th></th>
5
    <div class="tracker-summary grid-div-table">
6
      <!-- Cell 0 -->
7
      <div id="g_bl" class="g-first-cell">
8
        <div class="g-cell g-first-line-cell">&nbsp;</div>
9
      </div>
10
      <!-- Line 0  -->
11
      <div id="g_fl" class="g-inline-block-fix g-first-line-block">
12
        <div class="g-column">
13
          <div class="g-cell">&nbsp;</div>
14
        </div>
10 15
        <% @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>
16
          <div class="g-column">
17
            <div class="g-cell g-first-line-cell">
18
              <%= link_to_function('', "toggleCheckboxesBySelector('input.tracker-#{tracker.id}')",
19
                                   :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
20
                                   :class => 'icon-only icon-checked') %>
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 icon icon-expended" onclick="toggleRowGroup(this);">&nbsp;</span>
25
      </div>
26
      <!-- Row 0 -->
27
      <div id="g_fr" class="g-first-row-block">
28
        <div class="g-cell">&nbsp;</div>
29
        <% even = false %>
30
        <div class="g-cell g-first-row-cell g-separation-line">
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
          <div class="g-cell g-first-row-cell<%= (even)? " even":" odd" %>">
36
            <% even = !even %>
37
            <%= link_to_function('', "toggleCheckboxesBySelector('input.core-field-#{field}')",
38
                                :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
39
                                 :class => 'icon-only icon-checked') %>
40
            <%= l("field_#{field}".sub(/_id$/, '')) %>
41
          </div>
41 42
        <% 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 icon icon-expended" onclick="toggleRowGroup(this);">&nbsp;</span>
43
        <% if @custom_fields.any? %>
44
          <div class="g-cell g-first-row-cell g-separation-line">
45
            <% even = !even %>
48 46
            <%= 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}" %>">
47
          </div>
48
          <% @custom_fields.each do |field| %>
49
            <div class="g-cell g-first-row-cell<%= (even)? " even":" odd" %>">
50
              <% even = !even %>
51
              <%= link_to_function('', "toggleCheckboxesBySelector('input.custom-field-#{field.id}')",
52
                                   :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
53
                                   :class => 'icon-only icon-checked') %>
54
              <%= field.name %>
55
            </div>
56
          <% end %>
57
        <% end %>
58
      </div>
59
      <!-- Body -->
60
      <div id="g_bd" class="g-inline-block-fix g-body-block" onscroll="g_scroll(this, 'g_fl', 'g_fr')">
61
        <div class="g-column"></div>
62
        <% @trackers.each do |tracker| %>
63
        <div class="g-column">
64
          <div class="g-cell">&nbsp;</div>
65
          <% even = false %>
66
          <div class="g-cell g-separation-line<%= " last-column" if tracker == @trackers.last %>"></div>
67
          <% even = !even %>
68
          <% Tracker::CORE_FIELDS.each do |field| %>
69
          <div class="g-cell<%= (even)? " even":" odd" %>" title="<%= "#{l("field_#{field}".sub(/_id$/, ''))} - #{tracker}" %>">
70
            <% even = !even %>
71
            <%= check_box_tag "trackers[#{tracker.id}][core_fields][]", field, tracker.core_fields.include?(field),
72
                              :class => "tracker-#{tracker.id} core-field-#{field}", :id => nil %>
73
          </div>
74
          <% end %>
75
          <% if @custom_fields.any? %>
76
          <div class="g-cell g-separation-line<%= " last-column" if tracker == @trackers.last %>"></div>
77
          <% even = !even %>
78
          <% @custom_fields.each do |field| %>
79
          <div class="g-cell<%= (even)? " even":" odd" %>" title="<%= "#{field.name} - #{tracker}" %>">
80
            <% even = !even %>
61 81
            <%= check_box_tag "trackers[#{tracker.id}][custom_field_ids][]", field.id, tracker.custom_fields.include?(field),
62 82
                              :class => "tracker-#{tracker.id} custom-field-#{field.id}", :id => nil %>
63
          </td>
83
          </div>
84
          <% end %>
64 85
          <% end %>
65
        </tr>
86
        </div>
66 87
        <% end %>
67
      <% end %>
68
    </tbody>
69
    </table>
88
      </div>
70 89
    </div>
71 90
    <p><%= submit_tag l(:button_save) %></p>
72 91
    <% @trackers.each do |tracker| %>
......
74 93
      <%= hidden_field_tag "trackers[#{tracker.id}][custom_field_ids][]", '' %>
75 94
    <% end %>
76 95
  <% end %>
96

  
77 97
<% else %>
78 98
  <p class="nodata"><%= l(:label_no_data) %></p>
79 99
<% end %>
100

  
101
<% content_for :header_tags do %>
102
  <%= stylesheet_link_tag 'divgrid' %>
103
  <%= javascript_include_tag 'divgrid' %>
104
<% end %>
105

  
106
<%= javascript_tag do %>
107
  g_adjust('g_bl', 'g_fr', 'g_fl', 'g_bd');
108
<% 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[type=checkbox]:not(:disabled)')",
6
                           :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
7
                           :class => 'icon-only icon-checked') %>
1
<% transition_counts = workflows.each_with_object(Hash.new(0)) {|w,memo| memo[[w.old_status, w.new_status]] += 1} %>
2
<div class="workflows transitions transitions-<%= name %>">
3
  <!-- Cell 0 -->
4
  <div id="g_bl_<%= name %>" class="g-first-cell">
5
    <div class="g-cell g-first-line-cell">
6
      <%= link_to_function('',
7
        "toggleCheckboxesBySelector('##{name}_workflows input[type=checkbox]:not(:disabled)')",
8
        :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
9
        :class => 'icon-only icon-checked') %>
8 10
      <%=l(:label_current_status)%>
9
    </th>
10
    <th colspan="<%= @statuses.length %>"><%=l(:label_new_statuses_allowed)%></th>
11
  </tr>
12
  <tr>
13
    <td></td>
11
    </div>
12
  </div>
13
  <!-- Line 0  -->
14
  <div id="g_fl_<%= name %>" class="g-inline-block-fix g-first-line-block">
15
    <div class="g-column">
16
      <div class="g-cell">&nbsp;</div>
17
    </div>
14 18
    <% for new_status in @statuses %>
15
    <td style="width:<%= 75 / @statuses.size %>%;">
16
      <%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input[type=checkbox]:not(:disabled).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>
19
      <div class="g-column">
20
        <div class="g-cell g-first-line-cell">
21
          <%= link_to_function('',
22
            "toggleCheckboxesBySelector('##{name}_workflows input[type=checkbox]:not(:disabled).new-status-#{new_status.id}')",
23
            :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
24
            :class => 'icon-only icon-checked') %>
25
          <%= new_status.name %>
26
        </div>
27
      </div>
21 28
    <% end %>
22
  </tr>
23
</thead>
24
<% transition_counts = workflows.each_with_object(Hash.new(0)) {|w,memo| memo[[w.old_status, w.new_status]] += 1} %>
25
<tbody>
26
  <% for old_status in [nil] + @statuses %>
27
  <% next if old_status.nil? && name != 'always' %>
28
  <tr>
29
    <td class="name">
30
      <%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input[type=checkbox]:not(:disabled).old-status-#{old_status.try(:id) || 0}')",
31
                           :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
32
                           :class => 'icon-only icon-checked') %>
33
      <% if old_status %>
34
        <% old_status_name = old_status.name %>
35
        <%= old_status_name %>
36
      <% else %>
37
        <% old_status_name = l(:label_issue_new) %>
38
        <%= content_tag('em', old_status_name) %>
39
      <% end %>
40
    </td>
41
    <% for new_status in @statuses -%>
42
    <% checked = (old_status == new_status) || (transition_counts[[old_status, new_status]] > 0) %>
43
    <td class="<%= checked ? 'enabled' : '' %>" title="<%= old_status_name %> &#187; <%= new_status.name %>">
44
      <%= transition_tag transition_counts[[old_status, new_status]], old_status, new_status, name %>
45
    </td>
46
    <% end -%>
47
  </tr>
48
  <% end %>
49
</tbody>
50
</table>
29
  </div>
30
  <!-- Row 0 -->
31
  <div id="g_fr_<%= name %>" class='g-first-row-block'>
32
    <div class="g-cell">&nbsp;</div>
33
    <% even = false %>
34
    <% for old_status in [nil] + @statuses %>
35
      <% next if old_status.nil? && name != 'always' %>
36
      <div class="g-cell g-first-row-cell<%= (even)? " even":" odd" %>">
37
        <% even = !even %>
38
        <%= link_to_function('',
39
          "toggleCheckboxesBySelector('##{name}_workflows input[type=checkbox]:not(:disabled).old-status-#{old_status.try(:id) || 0}')",
40
          :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
41
          :class => 'icon-only icon-checked') %>
42
        <%= old_status ? old_status.name : content_tag('em', l(:label_issue_new)) %>
43
      </div>
44
    <% end %>
45
  </div>
46
  <!-- Body -->
47
  <div id="g_bd_<%= name %>" class="g-inline-block-fix g-body-block" onscroll="g_scroll(this, 'g_fl_<%= name %>', 'g_fr_<%= name %>')">
48
    <div class="g-column"></div>
49
    <% for new_status in @statuses %>
50
      <div class="g-column">
51
        <div class="g-cell">&nbsp;</div>
52
        <% even = false %>
53
        <% for old_status in [nil] + @statuses %>
54
          <% next if old_status.nil? && name != 'always' %>
55
          <% checked = (old_status == new_status) || workflows.detect {|w| w.old_status == old_status && w.new_status == new_status} %>
56
          <div class="g-cell<%= checked ? " enabled" : (even)? " even" : " odd" %>" title="<%= old_status ? old_status.name : content_tag('em', l(:label_issue_new)) %> &rarr; <%= new_status.name %>">
57
            <% even = !even %>
58
            <%= transition_tag transition_counts[[old_status, new_status]], old_status, new_status, name %>
59
          </div>
60
        <% end %>
61
      </div>
62
    <% end %>
63
  </div>
64
</div>
app/views/workflows/edit.html.erb
37 37
    <%= @roles.map {|role| hidden_field_tag 'role_id[]', role.id, :id => nil}.join.html_safe %>
38 38
    <%= hidden_field_tag 'used_statuses_only', params[:used_statuses_only], :id => nil %>
39 39
    <div class="autoscroll">
40
      <%= render :partial => 'form', :locals => {:name => 'always', :workflows => @workflows['always']} %>
40
      <div id="always_workflows" class="grid-div-table">
41
        <%= render :partial => 'form', :locals => {:name => 'always', :workflows => @workflows['always']} %>
42
      </div>
41 43

  
42
      <fieldset class="collapsible" style="padding: 0; margin-top: 0.5em;">
43
        <legend onclick="toggleFieldset(this);" class="icon icon-collapsed"><%= l(:label_additional_workflow_transitions_for_author) %></legend>
44
        <div id="author_workflows" style="margin: 0.5em 0 0.5em 0;">
44
      <fieldset class="collapsible collapsed">
45
        <legend class="expander icon icon-collapsed" onclick="toggleFieldset(this);">
46
          <%= l(:label_additional_workflow_transitions_for_author) %>
47
        </legend>
48
        <div id="author_workflows" class="grid-div-table">
45 49
          <%= render :partial => 'form', :locals => {:name => 'author', :workflows => @workflows['author']} %>
46 50
        </div>
47 51
      </fieldset>
48
      <%= javascript_tag "hideFieldset($('#author_workflows'))" unless @workflows['author'].present? %>
49 52

  
50
      <fieldset class="collapsible" style="padding: 0;">
51
        <legend onclick="toggleFieldset(this);" class="icon icon-collapsed"><%= 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']} %>
53
      <fieldset class="collapsible collapsed">
54
        <legend class="expander icon icon-collapsed" onclick="toggleFieldset(this);">
55
          <%= l(:label_additional_workflow_transitions_for_assignee) %>
56
        </legend>
57
        <div id="assignee_workflows" class="grid-div-table">
58
          <%= render :partial => 'form', :locals => {:name => 'assignee', :workflows => @workflows['assignee']} %>
54 59
        </div>
55 60
      </fieldset>
56
      <%= javascript_tag "hideFieldset($('#assignee_workflows'))" unless @workflows['assignee'].present? %>
57 61
    </div>
58 62
    <%= submit_tag l(:button_save) %>
59 63
  <% end %>
64
<% end %>
65

  
66
<% content_for :header_tags do %>
67
  <%= stylesheet_link_tag 'divgrid' %>
68
  <%= javascript_include_tag 'divgrid' %>
69
<% end %>
70

  
71
<%= javascript_tag do %>
72
  g_adjust('g_bl_always', 'g_fr_always', 'g_fl_always', 'g_bd_always');
73
  g_adjust('g_bl_author', 'g_fr_author', 'g_fl_author', 'g_bd_author');
74
  g_adjust('g_bl_assignee', 'g_fr_assignee', 'g_fl_assignee', 'g_bd_assignee');
60 75
<% 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

  
7
  <div class="grid-div-table">
8
    <!-- Cell 0 -->
9
    <div id="g_bl" class="g-first-cell">
10
      <div class="g-cell g-first-line-cell">&nbsp;</div>
11
    </div>
12
    <!-- Line 0  -->
13
    <div id="g_fl" class="g-inline-block-fix g-first-line-block">
14
      <div class="g-column">
15
        <div class="g-cell">&nbsp;</div>
16
      </div>
17
      <% @roles.each do |role| %>
18
        <div class="g-column">
19
          <div class="g-cell g-first-line-cell">
20
            <%= role.name %>
21
          </div>
22
        </div>
23
      <% end %>
24
    </div>
25
    <!-- Row 0 -->
26
    <div id="g_fr" class="g-first-row-block">
27
      <div class="g-cell">&nbsp;</div>
28
      <% even = false %>
29
      <% @trackers.each do |tracker| %>
30
        <div class="name g-cell g-first-row-cell<%= (even)? " even":" odd" %>">
31
          <% even = !even %>
32
          <%= tracker.name %>
33
        </div>
34
      <% end %>
35
    </div>
36
    <!-- Body -->
37
    <div id="g_bd" class="g-inline-block-fix g-body-block" onscroll="g_scroll(this, 'g_fl', 'g_fr')">
38
      <div class="g-column"></div>
39
      <% @roles.each do |role| %>
40
        <div class="g-column">
41
          <div class="g-cell">&nbsp;</div>
42
          <% even = false %>
43
          <% @trackers.each do |tracker| %>
44
            <% count = @workflow_counts[[tracker.id, role.id]] || 0 %>
45
            <div class="g-cell<%= (even)? " even":" odd" %>" title="<%= "#{tracker} - #{role}" %>">
46
              <% even = !even %>
47
              <%= link_to((count > 0 ? count : content_tag(:span, nil, :class => 'icon-only icon-not-ok')),
48
                          {:action => 'edit', :role_id => role, :tracker_id => tracker},
49
                          :title => l(:button_edit)) %>
50
            </div>
51
          <% end %>
52
        </div>
53
      <% end %>
54
    </div>
55
  </div>
56

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

  
35 59
<% end %>
60

  
61
<% content_for :header_tags do %>
62
  <%= stylesheet_link_tag 'divgrid' %>
63
  <%= javascript_include_tag 'divgrid' %>
64
<% end %>
app/views/workflows/permissions.html.erb
34 34
    <%= @trackers.map {|tracker| hidden_field_tag 'tracker_id[]', tracker.id, :id => nil}.join.html_safe %>
35 35
    <%= @roles.map {|role| hidden_field_tag 'role_id[]', role.id, :id => nil}.join.html_safe %>
36 36
    <%= hidden_field_tag 'used_statuses_only', params[:used_statuses_only], :id => nil %>
37
    <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 icon icon-expended" onclick="toggleRowGroup(this);">&nbsp;</span>
37
    <div class="autoscroll workflows fields_permissions">
38
      <fieldset class="collapsible">
39
        <legend class="expander icon icon-expended" onclick="toggleFieldset(this);">
58 40
          <%= l(:field_core_fields) %>
59
        </td>
60
      </tr>
61
      <% @fields.each do |field, name| %>
62
      <tr>
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, ' ') %>" title="<%= name %> (<%= status.name %>)">
68
          <%= field_permission_tag(@permissions, status, field, @roles) %>
69
          <% unless status == @statuses.last %><a href="#" class="repeat-value" title="<%= l(:button_copy) %>">&#187;</a><% end %>
70
        </td>
71
        <% end -%>
72
      </tr>
73
      <% end %>
41
        </legend>
42
        <div id='default_fields' class="grid-div-table">
43
          <!-- Cell 0 -->
44
          <div id="g_bla" class="g-first-cell">
45
            <div class="g-cell g-first-line-cell">&nbsp;</div>
46
          </div>
47
          <!-- Line 0  -->
48
          <div id="g_fla" class="g-inline-block-fix g-first-line-block">
49
            <div class="g-column">
50
              <div class="g-cell">&nbsp;</div>
51
            </div>
52
            <% for status in @statuses %>
53
              <div class="g-column">
54
                <div class="g-cell g-first-line-cell">
55
                  <%= status.name %>
56
                </div>
57
              </div>
58
            <% end %>
59
          </div>
60
          <!-- Row 0 -->
61
          <div id="g_fra" class="g-first-row-block">
62
            <div class="g-cell">&nbsp;</div>
63
            <% even = false %>
64
            <% @fields.each do |field, name| %>
65
              <div class="name g-cell g-first-row-cell<%= (even)? " even":" odd" %>">
66
                <% even = !even %>
67
                <%= name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
68
              </div>
69
            <% end %>
70
          </div>
71
          <!-- Body -->
72
          <div id="g_bda" class="g-inline-block-fix g-body-block" onscroll="g_scroll(this, 'g_fla', 'g_fra')">
73
            <div class="g-column"></div>
74
            <% for status in @statuses %>
75
              <div class="g-column">
76
                <div class="g-cell">&nbsp;</div>
77
                <% even = false %>
78
                <% @fields.each do |field, name| %>
79
                  <div class="g-cell<%= (even)? " even" : " odd" %> <%= @permissions[status.id][field].try(:join, ' ') %>" title="<%= name %> (<%= status.name %>)">
80
                    <div style="margin-top: -5px;" >
81
                      <% even = !even %>
82
                      <%= field_permission_tag(@permissions, status, field, @roles) %>
83
                      <% unless status == @statuses.last %><a href="#" class="repeat-value">&#187;</a><% end %>
84
                    </div>
85
                  </div>
86
                <% end %>
87
              </div>
88
            <% end %>
89
          </div>
90
        </div>
91
      </fieldset>
92

  
74 93
      <% if @custom_fields.any? %>
75
        <tr class="group open">
76
          <td colspan="<%= @statuses.size + 1 %>">
77
            <span class="expander icon icon-expended" onclick="toggleRowGroup(this);">&nbsp;</span>
94
        <fieldset class="collapsible">
95
          <legend class="expander icon icon-expended" onclick="toggleFieldset(this);">
78 96
            <%= l(:label_custom_field_plural) %>
79
          </td>
80
        </tr>
81
        <% @custom_fields.each do |field| %>
82
        <tr>
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].try(:join, ' ') %>" title="<%= field.name %> (<%= status.name %>)">
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>
97
          </legend>
98
          <div id='personal_fields' class="grid-div-table">
99
            <!-- Cell 0 -->
100
            <div id="g_blb" class="g-first-cell">
101
              <div class="g-cell g-first-line-cell">&nbsp;</div>
102
            </div>
103
            <!-- Line 0  -->
104
            <div id="g_flb" class="g-inline-block-fix g-first-line-block">
105
              <div class="g-column">
106
                <div class="g-cell">&nbsp;</div>
107
              </div>
108
              <% for status in @statuses %>
109
                <div class="g-column">
110
                  <div class="g-cell g-first-line-cell">
111
                    <%= status.name %>
112
                  </div>
113
                </div>
114
              <% end %>
115
            </div>
116
            <!-- Row 0 -->
117
            <div id="g_frb" class="g-first-row-block">
118
              <div class="g-cell">&nbsp;</div>
119
              <% even = false %>
120
              <% @custom_fields.each do |field| %>
121
                <div class="name g-cell g-first-row-cell<%= (even)? " even":" odd" %>">
122
                  <% even = !even %>
123
                  <%= field.name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
124
                </div>
125
              <% end %>
126
            </div>
127
            <!-- Body -->
128
            <div id="g_bdb" class="g-inline-block-fix g-body-block" onscroll="g_scroll(this, 'g_flb', 'g_frb')">
129
              <div class="g-column"></div>
130
              <% for status in @statuses %>
131
                <div class="g-column">
132
                  <div class="g-cell">&nbsp;</div>
133
                  <% even = false %>
134
                  <% @custom_fields.each do |field| %>
135
                    <div class="g-cell<%= (even)? " even" : " odd" %> <%= @permissions[status.id][field.id.to_s].try(:join, ' ') %>" title="<%= field.name %> (<%= status.name %>)">
136
                      <div style="margin-top: -5px;" >
137
                        <% even = !even %>
138
                        <%= field_permission_tag(@permissions, status, field, @roles) %>
139
                        <% unless status == @statuses.last %><a href="#" class="repeat-value">&#187;</a><% end %>
140
                      </div>
141
                    </div>
142
                  <% end %>
143
                </div>
144
              <% end %>
145
            </div>
146
          </div>
147
        </fieldset>
148
      <% end -%>
97 149
    </div>
98 150
    <%= submit_tag l(:button_save) %>
99 151
  <% end %>
100 152
<% end %>
101 153

  
154
<% content_for :header_tags do %>
155
  <%= stylesheet_link_tag 'divgrid' %>
156
  <%= javascript_include_tag 'divgrid' %>
157
<% end %>
158

  
102 159
<%= javascript_tag do %>
160
g_adjust('g_bla', 'g_fra', 'g_fla', 'g_bda');
161
if ($('#personal_fields').length) {
162
  g_adjust('g_blb', 'g_frb', 'g_flb', 'g_bdb');
163
}
164

  
103 165
$("a.repeat-value").click(function(e){
104 166
  e.preventDefault();
105
  var td = $(this).closest('td');
106
  var selected = td.find("select").find(":selected").val();
107
  td.nextAll('td').find("select").val(selected);
167
  var div = $(this).closest('div.g-cell');
168
  var selected = div.find("select").find(":selected").val();
169
  var index = div.index() + 1;
170
  div.parent().nextAll('div').find(":nth-child(" + index + ") select").val(selected);
108 171
});
109
<% end %>
172
<% end %>
public/javascripts/application.js
76 76
  var fieldset = $(el).parents('fieldset').first();
77 77
  fieldset.toggleClass('collapsed');
78 78
  fieldset.children('legend').toggleClass('icon-expended icon-collapsed');
79
  fieldset.children('div').toggle();
80
}
81

  
82
function hideFieldset(el) {
83
  var fieldset = $(el).parents('fieldset').first();
84
  fieldset.toggleClass('collapsed');
85
  fieldset.children('div').hide();
79
  fieldset.children('div:not(.grid-div-table)').toggle();
86 80
}
87 81

  
88 82
// columns selection
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
  if (!document.getElementById(bli)) {
19
    return false;
20
  }
21
  var frw = document.getElementById(fri).offsetWidth;
22
  var frw2 = document.getElementById(bli).offsetWidth;
23
  if ( frw2 > frw ) {
24
    frw = frw2 + "px"
25
  } else {
26
    frw = frw + "px";
27
  }
28

  
29
  document.getElementById(fri).style.width = frw;
30
  document.getElementById(bli).style.width = frw;
31

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

  
35
  var bd = document.getElementById(bdi);
36
  bd.children[0].style.width = frw;
37

  
38
  for (var i = 1; i < fl.children.length; i++) {
39
    s1 = fl.children[i].offsetWidth;
40
    s2 = bd.children[i].offsetWidth;
41
    if (s1 > s2) {
42
      bd.children[i].style.width = s1 + "px"
43
    } else {
44
      fl.children[i].style.width = s2 + "px"
45
    }
46
  }
47
}
public/stylesheets/application.css
337 337
tr.user.locked a, tr.user.registered a { color: #aaa; }
338 338

  
339 339
table.permissions td.role {color:#999;font-size:90%;font-weight:normal !important;text-align:center;vertical-align:bottom;}
340
table.permissions tr.group>td:nth-of-type(1),
341
table.tracker-summary tr.group>td:nth-of-type(1) {font-weight: bold;}
342 340

  
343 341
tr.wiki-page-version td.updated_on, tr.wiki-page-version td.author {text-align:center;}
344 342

  
......
715 713
#user_login, #user_firstname, #user_lastname, #user_mail, #my_account_form select, #user_form select, #user_identity_url { width: 90%; }
716 714

  
717 715
#workflow_copy_form select { width: 200px; }
718
table.transitions td.enabled {background: #bfb;}
716
.transitions .enabled {background: #bfb;}
719 717
#workflow_form table select {font-size:90%; max-width:100px;}
720
table.fields_permissions td.readonly {background:#ddd;}
721
table.fields_permissions td.required {background:#d88;}
718
#workflow_form .collapsible, #workflow_form .collapsible { margin-top: 15px; }
719
div.fields_permissions div.readonly {background:#ddd;}
720
div.fields_permissions div.required {background:#d88;}
722 721

  
723 722
select.expandable {vertical-align:top;}
724 723

  
public/stylesheets/divgrid.css
1
/* Simple Grid Styles for tables with fixed First Row and Line */
2

  
3
/* Wrap div */
4
.grid-div-table {
5
  position: relative;
6
  overflow: hidden;
7
  white-space: nowrap;
8
  border-width: 1px;
9
  border-style: solid;
10
  border-color: #CCC;
11
}
12

  
13
/* Switch the display depending on the folding of the Fieldset */
14
.collapsible.collapsed .grid-div-table { visibility: hidden; position: fixed;}
15
.collapsible:not(.collapsed) .grid-div-table { visibility: initial; position: relative; left: 0px;}
16

  
17
/* Cell */
18
.g-cell {
19
  height: 1.5em;
20
  padding: 6px;
21
  font-size: 12px;
22
  border-width: 0px 1px 1px 0px;
23
  border-style: solid;
24
  border-color: #CCC;
25
  text-align: center;
26
}
27

  
28
/* First Cell */
29
.g-first-cell { position: absolute; top: 0px; left: 0px; z-index: 2; }
30

  
31
/* First Line */
32
.g-first-line-block { position: absolute; top: 0px; left: 0px; right: 12px; overflow: hidden; z-index: 1; }
33
.g-first-line-cell { background-color: #EEE;
34
       text-align: center; }
35

  
36
/* First Row */
37
.g-first-row-block { position: absolute; top: 0px; left: 0px; bottom: 12px; overflow: hidden; z-index: 1; }
38
.g-first-row-cell { text-align: left; }
39

  
40
/* Body */
41
.g-body-block { width: 100%; max-height: 80vh; overflow: scroll; }
42

  
43
/* Image in Cell */
44
.g-image-in-cell {
45
  height: 16px;
46
  width: 16px;
47
  margin: 0 auto;
48
}
49

  
50
/* Separation Lines */
51
.g-separation-line { font-weight: bold; border-right: 0px; background-color: #EEE; }
52
.g-separation-line:hover { background-color: #EEE; }
53
.g-separation-line.last-column {
54
  border-width: 0px 1px 1px 0px;
55
  border-style: solid;
56
  border-color: #CCC;
57
 }
58

  
59
/* Inline Block Fix */
60
.g-inline-block-fix { font-size: 0; }
61

  
62
/* Column */
63
.g-column {
64
  display: inline-block;
65
  vertical-align: top;
66
}