fields.html.erb 3.03 KB
Newer Older
jplang's avatar
jplang committed
1
<%= title [l(:label_tracker_plural), trackers_path], l(:field_summary) %>
2 3

<% if @trackers.any? %>
jplang's avatar
jplang committed
4
  <%= form_tag fields_trackers_path do %>
5 6 7 8 9 10 11
    <div class="autoscroll">
    <table class="list">
    <thead>
      <tr>
        <th></th>
        <% @trackers.each do |tracker| %>
        <th>
12 13 14
          <%= link_to_function('', "toggleCheckboxesBySelector('input.tracker-#{tracker.id}')",
                               :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
                               :class => 'icon-only icon-checked') %>
15 16 17 18 19 20 21 22 23 24 25 26 27
          <%= tracker.name %>
        </th>
        <% end %>
      </tr>
    </thead>
    <tbody>
      <tr class="group open">
        <td colspan="<%= @trackers.size + 1 %>">
          <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
          <%= l(:field_core_fields) %>
        </td>
      </tr>
      <% Tracker::CORE_FIELDS.each do |field| %>
28
      <tr class="<%= cycle("odd", "even") %>">
29
        <td class="name">
30 31 32
          <%= link_to_function('', "toggleCheckboxesBySelector('input.core-field-#{field}')",
                               :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
                               :class => 'icon-only icon-checked') %>
33 34 35
          <%= l("field_#{field}".sub(/_id$/, '')) %>
        </td>
        <% @trackers.each do |tracker| %>
36
        <td>
37
          <%= check_box_tag "trackers[#{tracker.id}][core_fields][]", field, tracker.core_fields.include?(field),
jplang's avatar
jplang committed
38
                            :class => "tracker-#{tracker.id} core-field-#{field}", :id => nil %>
39 40 41 42 43 44 45 46 47 48 49 50
        </td>
        <% end %>
      </tr>
      <% end %>
      <% if @custom_fields.any? %>
        <tr class="group open">
          <td colspan="<%= @trackers.size + 1 %>">
            <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
            <%= l(:label_custom_field_plural) %>
          </td>
        </tr>
        <% @custom_fields.each do |field| %>
51
        <tr class="<%= cycle("odd", "even") %>">
52
          <td class="name">
53 54 55
            <%= link_to_function('', "toggleCheckboxesBySelector('input.custom-field-#{field.id}')",
                                 :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
                                 :class => 'icon-only icon-checked') %>
56 57 58
            <%= field.name %>
          </td>
          <% @trackers.each do |tracker| %>
59
          <td>
60
            <%= check_box_tag "trackers[#{tracker.id}][custom_field_ids][]", field.id, tracker.custom_fields.include?(field),
jplang's avatar
jplang committed
61
                              :class => "tracker-#{tracker.id} custom-field-#{field.id}", :id => nil %>
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
          </td>
          <% end %>
        </tr>
        <% end %>
      <% end %>
    </tbody>
    </table>
    </div>
    <p><%= submit_tag l(:button_save) %></p>
    <% @trackers.each do |tracker| %>
      <%= hidden_field_tag "trackers[#{tracker.id}][core_fields][]", '' %>
      <%= hidden_field_tag "trackers[#{tracker.id}][custom_field_ids][]", '' %>
    <% end %>
  <% end %>
<% else %>
  <p class="nodata"><%= l(:label_no_data) %></p>
<% end %>