summaryrefslogtreecommitdiffstats
path: root/app/views/workflows/_form.html.erb
blob: 9c5ef62fb48f41abe8443e74013bf833fbb396b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<table class="list workflows transitions transitions-<%= name %>">
<thead>
  <tr>
    <th>
      <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('table.transitions-#{name} input')",
                                                          :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
      <%=l(:label_current_status)%>
    </th>
    <th colspan="<%= @statuses.length %>"><%=l(:label_new_statuses_allowed)%></th>
  </tr>
  <tr>
    <td></td>
    <% for new_status in @statuses %>
    <td style="width:<%= 75 / @statuses.size %>%;">
      <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('table.transitions-#{name} input.new-status-#{new_status.id}')",
                                                      :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
      <%=h new_status.name %>
    </td>
    <% end %>
  </tr>
</thead>
<tbody>
  <% for old_status in @statuses %>
  <tr class="<%= cycle("odd", "even") %>">
    <td class="name">
      <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('table.transitions-#{name} input.old-status-#{old_status.id}')",
                                                          :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>

      <%=h old_status.name %>
    </td>
    <% for new_status in @statuses -%>
    <% checked = workflows.detect {|w| w.old_status_id == old_status.id && w.new_status_id == new_status.id} %>
    <td class="<%= checked ? 'enabled' : '' %>">
      <%= transition_tag workflows, old_status, new_status, name %>
    </td>
    <% end -%>
  </tr>
  <% end %>
</tbody>
</table>