Project

General

Profile

Patch #20287 » rm20287_2.6-stable.r14424.patch

Mischa The Evil, 2015-07-19 08:34

View differences:

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

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

  
53 69
<p><%= check_all_links 'permissions_form' %></p>
54 70
<p><%= submit_tag l(:button_save) %></p>
55 71
<% end %>
app/views/trackers/fields.html.erb (working copy)
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; 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>
10 18
        <% @trackers.each do |tracker| %>
11
        <th>
12
          <%= tracker.name %>
13
          <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.tracker-#{tracker.id}')",
14
                                                              :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
15
        </th>
19
          <div style="display: inline-block; margin-right: -4px;">
20
            <div class="g_c g_h">
21
              <%= tracker.name %>
22
            </div>
23
          </div>
16 24
        <% end %>
17
      </tr>
18
    </thead>
19
    <tbody>
20
      <tr class="group open">
21
        <td colspan="<%= @trackers.size + 1 %>">
22
          <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
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
        <div class="g_c g_v g_s<%= (even)? " g_e":" g_o" %>">
31
          <% even = !even %>
23 32
          <%= l(:field_core_fields) %>
24
        </td>
25
      </tr>
26
      <% Tracker::CORE_FIELDS.each do |field| %>
27
      <tr class="<%= cycle("odd", "even") %>">
28
        <td class="name">
29
          <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.core-field-#{field}')",
30
                                                              :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
31
          <%= l("field_#{field}".sub(/_id$/, '')) %>
32
        </td>
33
        <% @trackers.each do |tracker| %>
34
        <td>
35
          <%= check_box_tag "trackers[#{tracker.id}][core_fields][]", field, tracker.core_fields.include?(field),
36
                            :class => "tracker-#{tracker.id} core-field-#{field}", :id => nil %>
37
        </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>
38 39
        <% end %>
39
      </tr>
40
      <% end %>
41
      <% if @custom_fields.any? %>
42
        <tr class="group open">
43
          <td colspan="<%= @trackers.size + 1 %>">
44
            <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 %>
45 43
            <%= l(:label_custom_field_plural) %>
46
          </td>
47
        </tr>
48
        <% @custom_fields.each do |field| %>
49
        <tr class="<%= cycle("odd", "even") %>">
50
          <td class="name">
51
            <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.custom-field-#{field.id}')",
52
                                                                :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
53
            <%= field.name %>
54
          </td>
55
          <% @trackers.each do |tracker| %>
56
          <td>
57
            <%= check_box_tag "trackers[#{tracker.id}][custom_field_ids][]", field.id, tracker.custom_fields.include?(field),
58
                              :class => "tracker-#{tracker.id} custom-field-#{field.id}", :id => nil %>
59
          </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>
60 50
          <% end %>
61
        </tr>
62 51
        <% end %>
63
      <% end %>
64
    </tbody>
65
    </table>
52
      </div>
53
      <!-- Body -->
54
      <div id="g_fr" style="position: absolute; left: 0px; top: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
55
        <div class="g_c">&nbsp;</div>
56
        <% even = false %>
57
        <div class="g_c g_v g_s<%= (even)? " g_e":" g_o" %>">
58
          <% even = !even %>
59
          <%= l(:field_core_fields) %>
60
        </div>
61
        <% Tracker::CORE_FIELDS.each do |field| %>
62
          <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
63
            <% even = !even %>
64
            <%= l("field_#{field}".sub(/_id$/, '')) %>
65
          </div>
66
        <% end %>
67
        <% if @custom_fields.any? %>
68
          <div class="g_c g_v g_s<%= (even)? " g_e":" g_o" %>">
69
            <% even = !even %>
70
            <%= l(:label_custom_field_plural) %>
71
          </div>
72
          <% @custom_fields.each do |field| %>
73
            <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
74
              <% even = !even %>
75
              <%= field.name %>
76
            </div>
77
          <% end %>
78
        <% end %>
79
      </div>
80
      <!-- Body -->
81
      <div id="g_bd" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fl', 'g_fr')">
82
        <div style="display: inline-block; margin-right: -4px;"></div>
83
        <% @trackers.each do |tracker| %>
84
          <div style="display: inline-block; margin-right: -4px;">
85
            <div class="g_c">&nbsp;</div>
86
            <% even = false %>
87
            <div class="g_c<%= " g_s" unless tracker == @trackers.last %><%= (even)? " g_e":" g_o" %>"></div>
88
            <% even = !even %>
89
            <% Tracker::CORE_FIELDS.each do |field| %>
90
              <div class="g_c<%= (even)? " g_e":" g_o" %>" title="<%= "#{l("field_#{field}".sub(/_id$/, ''))} - #{tracker}" %>">
91
                <% even = !even %>
92
                <%= check_box_tag "trackers[#{tracker.id}][core_fields][]", field, tracker.core_fields.include?(field),
93
                                  :class => "tracker-#{tracker.id} core-field-#{field}", :id => nil %>
94
              </div>
95
            <% end %>
96
            <% if @custom_fields.any? %>
97
              <div class="g_c<%= " g_s" unless tracker == @trackers.last %><%= (even)? " g_e":" g_o" %>"></div>
98
              <% even = !even %>
99
              <% @custom_fields.each do |field| %>
100
                <div class="g_c<%= (even)? " g_e":" g_o" %>" title="<%= "#{field.name} - #{tracker}" %>">
101
                  <% even = !even %>
102
                  <%= check_box_tag "trackers[#{tracker.id}][custom_field_ids][]", field.id, tracker.custom_fields.include?(field),
103
                                    :class => "tracker-#{tracker.id} custom-field-#{field.id}", :id => nil %>
104
                </div>
105
              <% end %>
106
            <% end %>
107
          </div>
108
        <% end %>
109
      </div>
66 110
    </div>
67 111
    <p><%= submit_tag l(:button_save) %></p>
68 112
    <% @trackers.each do |tracker| %>
......
70 114
      <%= hidden_field_tag "trackers[#{tracker.id}][custom_field_ids][]", '' %>
71 115
    <% end %>
72 116
  <% end %>
117

  
118
  <script> g_adjust('g_bl', 'g_fr', 'g_fl', 'g_bd'); </script>
119

  
73 120
<% else %>
74 121
  <p class="nodata"><%= l(:label_no_data) %></p>
75 122
<% end %>
app/views/workflows/edit.html.erb (working copy)
32 32
<% end %>
33 33

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

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

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

  
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>
60
      <fieldset class="collapsible collapsed" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
61
        <legend onclick="toggleFieldset(this);toggleDivToFieldset('workflow_author',this.parentNode.className);">
62
          <%= l(:label_additional_workflow_transitions_for_author) %>
63
        </legend>
47 64
      </fieldset>
65
      <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;">
66
        <%= render :partial => 'form', :locals => {:name => 'author', :workflows => @workflows['author']} %>
67
      </div>
48 68
      <%= javascript_tag "hideFieldset($('#author_workflows'))" unless @workflows['author'].present? %>
49 69

  
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>
70
      <fieldset class="collapsible collapsed" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
71
        <legend onclick="toggleFieldset(this);toggleDivToFieldset('workflow_assignee',this.parentNode.className);">
72
          <%= l(:label_additional_workflow_transitions_for_assignee) %>
73
        </legend>
55 74
      </fieldset>
75
      <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;">
76
        <%= render :partial => 'form', :locals => {:name => 'assignee', :workflows => @workflows['assignee']} %>
77
      </div>
56 78
      <%= javascript_tag "hideFieldset($('#assignee_workflows'))" unless @workflows['assignee'].present? %>
79

  
80
      <script> g_adjust('g_bl_always', 'g_fr_always', 'g_fl_always', 'g_bd_always'); </script>
81
      <script> g_adjust('g_bl_author', 'g_fr_author', 'g_fl_author', 'g_bd_author'); </script>
82
      <script> g_adjust('g_bl_assignee', 'g_fr_assignee', 'g_fl_assignee', 'g_bd_assignee'); </script>
57 83
    </div>
58 84
    <%= submit_tag l(:button_save) %>
59 85
  <% end %>
app/views/workflows/index.html.erb (working copy)
1 1
<%= title [l(:label_workflow), workflows_edit_path], l(:field_summary) %>
2 2

  
3 3
<% if @workflow_counts.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
    <% @workflow_counts.first.last.each do |role, count| %>
12
    <th>
13
        <%= content_tag(role.builtin? ? 'em' : 'span', h(role.name)) %>
14
    </th>
6
  <%= stylesheet_link_tag 'divgrid' %>
7
  <%= javascript_include_tag 'divgrid' %>
15 8

  
16
    <% end %>
17
    </tr>
18
</thead>
19
<tbody>
20
<% @workflow_counts.each do |tracker, roles| -%>
21
<tr class="<%= cycle('odd', 'even') %>">
22
  <td class="name"><%= h tracker %></td>
23
  <% roles.each do |role, count| -%>
24
    <td>
25
      <%= link_to((count > 0 ? count : image_tag('false.png')), {:action => 'edit', :role_id => role, :tracker_id => tracker}, :title => l(:button_edit)) %>
26
    </td>
27
  <% end -%>
28
</tr>
29
<% end -%>
30
</tbody>
31
</table>
32
</div>
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; z-index: 2;">
12
      <div class="g_c g_h">&nbsp;</div>
13
    </div>
14
    <!-- Line 0  -->
15
    <div id="g_fl" style="position: absolute; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
16
      <div style="display: inline-block; margin-right: -4px;">
17
        <div class="g_c g_h">&nbsp;</div>
18
      </div>
19
      <% @workflow_counts.first.last.each do |role, count| %>
20
        <div style="display: inline-block; margin-right: -4px;">
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; left: 0px; top: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
29
      <div class="g_c">&nbsp;</div>
30
      <% even = false %>
31
      <% @workflow_counts.each do |tracker, roles| %>
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" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fl', 'g_fr')">
40
      <div style="display: inline-block; margin-right: -4px;"></div>
41
      <% @workflow_counts.first.last.each_with_index do |role, index| %>
42
        <div style="display: inline-block; margin-right: -4px;">
43
          <div class="g_c">&nbsp;</div>
44
          <% even = false %>
45
          <% @workflow_counts.each do |tracker, roles|
46
             count = roles[index][1] %>
47
            <div class="g_c<%= (even)? " g_e":" g_o" %>" title="<%= "#{tracker} - #{role[0]}" %>">
48
              <% even = !even %>
49
              <%= link_to((count > 0 ? count : image_tag('false.png')), {:action => 'edit', :role_id => role[0], :tracker_id => tracker}) %>
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>
33 58
<% end %>
app/views/workflows/permissions.html.erb (working copy)
31 31
<% end %>
32 32

  
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}.join.html_safe %>
36 52
    <%= @roles.map {|role| hidden_field_tag 'role_id[]', role.id}.join.html_safe %>
37 53
    <%= hidden_field_tag 'used_statuses_only', params[:used_statuses_only] %>
38 54
    <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
          <%=h 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>
55
      <fieldset class="collapsible" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
56
        <legend style="padding-left: 0; background: none;">
59 57
          <%= 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
          <%=h 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 %>
58
        </legend>
59
      </fieldset>
60
      <div id='default_fields' style="position: relative; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
61
        <!-- Cell 0 -->
62
        <div id="g_bla" style="position: absolute; z-index: 2;">
63
          <div class="g_c g_h">&nbsp;</div>
64
        </div>
65
        <!-- Line 0  -->
66
        <div id="g_fla" style="position: absolute; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
67
          <div style="display: inline-block; margin-right: -4px;">
68
            <div class="g_c g_h">&nbsp;</div>
69
          </div>
70
          <% for status in @statuses %>
71
            <div style="display: inline-block; margin-right: -4px;">
72
              <div class="g_c g_h">
73
                <%=h status.name %>
74
              </div>
75
            </div>
76
          <% end %>
77
        </div>
78
        <!-- Row 0 -->
79
        <div id="g_fra" style="position: absolute; left: 0px; top: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
80
          <div class="g_c">&nbsp;</div>
81
          <% even = false %>
82
          <% @fields.each do |field, name| %>
83
            <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
84
              <% even = !even %>
85
              <%=h name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
86
            </div>
87
          <% end %>
88
        </div>
89
        <!-- Body -->
90
        <div id="g_bda" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_fla', 'g_fra')">
91
          <div style="display: inline-block; margin-right: -4px;"></div>
92
          <% for status in @statuses %>
93
            <div style="display: inline-block; margin-right: -4px;">
94
              <div class="g_c">&nbsp;</div>
95
              <% even = false %>
96
              <% @fields.each do |field, name| %>
97
                <div class="g_c<%= (even)? " g_e" : " g_o" %> <%= @permissions[status.id][field] %>" title="<%= "#{name} - #{status.name}" %>">
98
                  <div style="margin-top: -5px;" >
99
                    <% even = !even %>
100
                    <%= field_permission_tag(@permissions, status, field, @roles) %>
101
                  </div>
102
                </div>
103
              <% end %>
104
            </div>
105
          <% end %>
106
        </div>
107
      </div>
108
  
75 109
      <% if @custom_fields.any? %>
76
        <tr class="group open">
77
          <td colspan="<%= @statuses.size + 1 %>">
78
            <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
110
        <fieldset class="collapsible" style="padding: 0; margin-top: 2em; margin-bottom: 1em;">
111
          <legend onclick="toggleFieldset(this);toggleDivToFieldset('personal_fields',this.parentNode.className);">
79 112
            <%= 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
            <%=h 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] %>">
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>
113
          </legend>
114
        </fieldset>
115
        <div id='personal_fields' style="position: relative; overflow: hidden; white-space: nowrap; border-width: 1px; border-style: solid; border-color: #CCC;">
116
          <!-- Cell 0 -->
117
          <div id="g_blb" style="position: absolute; z-index: 2;">
118
            <div class="g_c g_h">&nbsp;</div>
119
          </div>
120
          <!-- Line 0  -->
121
          <div id="g_flb" style="position: absolute; left: 0px; right: 13px; overflow: hidden; z-index: 1;">
122
            <div style="display: inline-block; margin-right: -4px;">
123
              <div class="g_c g_h">&nbsp;</div>
124
            </div>
125
            <% for status in @statuses %>
126
              <div style="display: inline-block; margin-right: -4px;">
127
                <div class="g_c g_h">
128
                  <%=h status.name %>
129
                </div>
130
              </div>
131
            <% end %>
132
          </div>
133
          <!-- Row 0 -->
134
          <div id="g_frb" style="position: absolute; left: 0px; top: 0px; bottom: 13px; overflow: hidden; z-index: 1;">
135
            <div class="g_c">&nbsp;</div>
136
            <% even = false %>
137
            <% @custom_fields.each do |field| %>
138
              <div class="g_c g_v<%= (even)? " g_e":" g_o" %>">
139
                <% even = !even %>
140
                <%=h field.name %> <%= content_tag('span', '*', :class => 'required') if field_required?(field) %>
141
              </div>
142
            <% end %>
143
          </div>
144
          <!-- Body -->
145
          <div id="g_bdb" style="width: 100%; max-height: 80vh; overflow: scroll;" onscroll="g_scroll(this, 'g_flb', 'g_frb')">
146
            <div style="display: inline-block; margin-right: -4px;"></div>
147
            <% for status in @statuses %>
148
              <div style="display: inline-block; margin-right: -4px;">
149
                <div class="g_c">&nbsp;</div>
150
                <% even = false %>
151
                <% @custom_fields.each do |field| %>
152
                  <div class="g_c<%= (even)? " g_e" : " g_o" %> <%= @permissions[status.id][field.id.to_s] %>" title="<%= "#{field.name} - #{status.name}" %>">
153
                    <div style="margin-top: -5px;" >
154
                      <% even = !even %>
155
                      <%= field_permission_tag(@permissions, status, field, @roles) %>
156
                    </div>
157
                  </div>
158
                <% end %>
159
              </div>
160
            <% end %>
161
          </div>
162
        </div>
163
      <% end -%>
164
      <script> g_adjust('g_bla', 'g_fra', 'g_fla', 'g_bda'); </script>
165
      <script> g_adjust('g_blb', 'g_frb', 'g_flb', 'g_bdb'); </script>
98 166
    </div>
99 167
    <%= submit_tag l(:button_save) %>
100 168
  <% end %>
public/javascripts/divgrid.js (working copy)
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
}
public/stylesheets/divgrid.css (working copy)
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
       overflow: hidden; }
11

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

  
17
/* First Row */
18
.g_v { text-align: left; }
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; }
(5-5/18)