summaryrefslogtreecommitdiffstats
path: root/app/views/timelog/_list.html.erb
blob: 019ddbb53fe4bfa6ee16c5f06a0bd4f9094e09c2 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<%= form_tag({}, :data => {:cm_url => time_entries_context_menu_path}) do -%>
<%= hidden_field_tag 'back_url', url_for(:params => request.query_parameters), :id => nil %>
<div class="autoscroll">
<table class="list odd-even time-entries">
<thead>
  <tr>
    <th class="checkbox hide-when-print">
      <%= check_box_tag 'check_all', '', false, :class => 'toggle-selection',
        :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
    </th>
    <% @query.inline_columns.each do |column| %>
      <%= column_header(@query, column) %>
    <% end %>
    <th></th>
  </tr>
</thead>
<tbody>
<% grouped_query_results(entries, @query) do |entry, group_name, group_count, group_totals| -%>
  <% if group_name %>
    <% reset_cycle %>
    <tr class="group open">
      <td colspan="<%= @query.inline_columns.size + 2 %>">
        <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
        <span class="name"><%= group_name %></span>
        <% if group_count %>
        <span class="count"><%= group_count %></span>
        <% end %>
        <span class="totals"><%= group_totals %></span>
        <%= link_to_function("#{l(:button_collapse_all)}/#{l(:button_expand_all)}",
                             "toggleAllRowGroups(this)", :class => 'toggle-all') %>
      </td>
    </tr>
  <% end %>
  <tr id="time-entry-<%= entry.id %>" class="time-entry <%= cycle("odd", "even") %> hascontextmenu">
    <td class="checkbox hide-when-print"><%= check_box_tag("ids[]", entry.id, false, :id => nil) %></td>
    <% @query.inline_columns.each do |column| %>
    <%= content_tag('td', column_content(column, entry), :class => column.css_classes) %>
    <% end %>
    <td class="buttons">
    <% if entry.editable_by?(User.current) -%>
        <%= link_to l(:button_edit), edit_time_entry_path(entry),
                    :title => l(:button_edit),
                    :class => 'icon-only icon-edit' %>
        <%= link_to l(:button_delete), time_entry_path(entry),
                    :data => {:confirm => l(:text_are_you_sure)},
                    :method => :delete,
                    :title => l(:button_delete),
                    :class => 'icon-only icon-del' %>
    <% end -%>
        <%= link_to_context_menu %>
    </td>
  </tr>
  <% @query.block_columns.each do |column|
       if (text = column_content(column, issue)) && text.present? -%>
  <tr class="<%= current_cycle %>">
    <td colspan="<%= @query.inline_columns.size + 1 %>" class="<%= column.css_classes %>">
    <% if query.block_columns.count > 1 %>
      <span><%= column.caption %></span>
    <% end %>
    <%= text %>
    </td>
  </tr>
  <% end -%>
  <% end -%>
<% end -%>
</tbody>
</table>
</div>
<% end -%>

<%= context_menu %>