summaryrefslogtreecommitdiffstats
path: root/app/views/users/index.html.erb
blob: d609bfd7832d5823b1972d4df25de04f324fabd7 (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
<div class="contextual">
<%= link_to l(:label_user_new), new_user_path, :class => 'icon icon-add' %>
  <%= actions_dropdown do %>
    <% if User.current.allowed_to?(:import_users, nil, :global => true) %>
      <%= link_to l(:button_import), new_users_import_path, :class => 'icon icon-import' %>
    <% end %>
  <% end %>
</div>

<h2><%= @query.new_record? ? l(:label_user_plural) : @query.name %></h2>

<%= form_tag(users_path, method: :get, id: 'query_form') do %>
  <%= render partial: 'queries/query_form' %>
<% end %>

<% if @query.valid? %>
  <% if @users.empty? %>
    <p class="nodata"><%= l(:label_no_data) %></p>
  <% else %>
    <%= render_query_totals(@query) %>
    <%= render partial: 'list', :locals => { :users => @users }%>
    <span class="pagination"><%= pagination_links_full @user_pages, @user_count %></span>
  <% end %>
  <% other_formats_links do |f| %>
    <%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '350px'); return false;" %>
  <% end %>

  <div id="csv-export-options" style="display:none;">
    <h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
    <%= form_tag(users_path(format: 'csv'), method: :get, id: 'csv-export-form') do %>
    <%= query_as_hidden_field_tags(@query) %>
    <%= hidden_field_tag('query_name', @query.name) %>
    <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>
    <% if @query.available_block_columns.any? %>
      <fieldset id="csv-export-block-columns">
        <legend>
          <%= toggle_checkboxes_link('#csv-export-block-columns input[type=checkbox]') %>
        </legend>
        <% @query.available_block_columns.each do |column| %>
          <label><%= check_box_tag 'c[]', column.name, @query.has_column?(column), :id => nil %> <%= column.caption %></label>
        <% end %>
      </fieldset>
    <% end %>
    <%= 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>
<% end %>

<% content_for :sidebar do %>
  <%= render_sidebar_queries(UserQuery, nil) %>
  <%= call_hook(:view_users_sidebar_queries_bottom) %>
<% end %>
<% html_title(l(:label_user_plural)) -%>