summaryrefslogtreecommitdiffstats
path: root/app/views/projects/_list.html.erb
blob: 1bc8d46878b21b542909d5880a2e1bcf3cd3eb16 (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
72
73
74
75
76
<% @admin_list = User.current.admin? && controller_name == 'admin' && action_name == 'projects' %>
<%= render_query_totals(@query) %>
<%= form_tag({}, data: {cm_url: projects_context_menu_path}) do -%>
<%= hidden_field_tag 'back_url', url_for(params: request.query_parameters), id: nil %>
<div class="autoscroll">
<table class="list projects odd-even <%= @query.css_classes %>">
<thead>
  <tr>
    <% if @admin_list %>
      <th class="checkbox hide-when-print">
        <input type="checkbox" name="check_all" id="check_all" value="" class="toggle-selection" title="Check all/Uncheck all">
      </th>
    <% end %>
    <% @query.inline_columns.each do |column| %>
      <%= column_header(@query, column) %>
    <% end %>
    <% if @admin_list %>
      <th></th>
    <% end %>
  </tr>
</thead>
<tbody>
<% grouped_project_list(entries, @query) do |entry, level, group_name, group_count, group_totals| -%>
  <% if group_name %>
    <% reset_cycle %>
    <tr class="group open">
      <td colspan="<%= @query.inline_columns.size %>">
        <span class="expander icon icon-expanded" 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>
      <% if @admin_list %>
        <td></td>
      <% end %>
    </tr>
  <% end %>
  <tr id="project-<%= entry.id %>" class="<%= cycle('odd', 'even') %> hascontextmenu <%= entry.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
    <% if @admin_list && !entry.scheduled_for_deletion? %>
      <td class="checkbox hide-when-print"><%= check_box_tag("ids[]", entry.id, false, :id => nil) %></td>
    <% end %>
    <% @query.inline_columns.each do |column| %>
    <%= content_tag('td', column_content(column, entry), :class => column.css_classes) %>
    <% end %>
    <% if @admin_list && !entry.scheduled_for_deletion? %>
      <td class="buttons"><%= link_to_context_menu %></td>
    <% end %>
  </tr>
<% end -%>
</tbody>
</table>
</div>
<% end -%>
<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span>

<div id="csv-export-options" style="display:none;">
  <h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
  <%= form_tag(projects_path(:format => 'csv'), :method => :get, :id => 'csv-export-form') do %>
  <%= query_as_hidden_field_tags(@query) %>
  <p>
    <label><%= radio_button_tag 'c[]', '', true %> <%= l(:description_selected_columns) %></label><br />
    <label><%= radio_button_tag 'c[]', 'all_inline' %> <%= l(:description_all_columns) %></label>
  </p>
  <%= export_csv_encoding_select_tag %>
  <%= export_csv_separator_select_tag %>
  <p class="buttons">
    <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);", :data => { :disable_with => false } %>
    <%= link_to_function l(:button_cancel), "hideModal(this);" %>
  </p>
  <% end %>
</div>
<%= context_menu if @admin_list %>