You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html.erb 3.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <div class="contextual">
  2. <%= link_to l(:label_user_new), new_user_path, :class => 'icon icon-add' %>
  3. <%= actions_dropdown do %>
  4. <% if User.current.allowed_to?(:import_users, nil, :global => true) %>
  5. <%= link_to l(:button_import), new_users_import_path, :class => 'icon icon-import' %>
  6. <% end %>
  7. <% end %>
  8. </div>
  9. <h2><%=l(:label_user_plural)%></h2>
  10. <%= form_tag(users_path, { :method => :get, :id => 'users_form' }) do %>
  11. <fieldset><legend><%= l(:label_filter_plural) %></legend>
  12. <label for='status'><%= l(:field_status) %>:</label>
  13. <%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
  14. <% if @groups.present? %>
  15. <label for='group_id'><%= l(:label_group) %>:</label>
  16. <%= select_tag 'group_id', content_tag('option') + options_from_collection_for_select(@groups, :id, :name, params[:group_id].to_i), :onchange => "this.form.submit(); return false;" %>
  17. <% end %>
  18. <label for='name'><%= l(:label_user) %>:</label>
  19. <%= text_field_tag 'name', params[:name], :size => 30 %>
  20. <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
  21. <%= link_to l(:button_clear), users_path, :class => 'icon icon-reload' %>
  22. </fieldset>
  23. <%= hidden_field_tag 'encoding', l(:general_csv_encoding) unless l(:general_csv_encoding).casecmp('UTF-8') == 0 %>
  24. <% end %>
  25. &nbsp;
  26. <% if @users.any? %>
  27. <div class="autoscroll">
  28. <table class="list users">
  29. <thead><tr>
  30. <%= sort_header_tag('login', :caption => l(:field_login)) %>
  31. <%= sort_header_tag('firstname', :caption => l(:field_firstname)) %>
  32. <%= sort_header_tag('lastname', :caption => l(:field_lastname)) %>
  33. <th><%= l(:field_mail) %></th>
  34. <%= sort_header_tag('admin', :caption => l(:field_admin), :default_order => 'desc') %>
  35. <%= sort_header_tag('created_on', :caption => l(:field_created_on), :default_order => 'desc') %>
  36. <%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on), :default_order => 'desc') %>
  37. <th></th>
  38. </tr></thead>
  39. <tbody>
  40. <% for user in @users -%>
  41. <tr class="<%= user.css_classes %>">
  42. <td class="username"><%= avatar(user, :size => "14") %><%= link_to user.login, edit_user_path(user) %></td>
  43. <td class="firstname"><%= user.firstname %></td>
  44. <td class="lastname"><%= user.lastname %></td>
  45. <td class="email"><%= mail_to(user.mail) %></td>
  46. <td class="tick"><%= checked_image user.admin? %></td>
  47. <td class="created_on"><%= format_time(user.created_on) %></td>
  48. <td class="last_login_on"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
  49. <td class="buttons">
  50. <%= change_status_link(user) %>
  51. <%= delete_link user_path(user, :back_url => request.original_fullpath), :data => {} unless User.current == user %>
  52. </td>
  53. </tr>
  54. <% end -%>
  55. </tbody>
  56. </table>
  57. </div>
  58. <span class="pagination"><%= pagination_links_full @user_pages, @user_count %></span>
  59. <% other_formats_links do |f| %>
  60. <%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
  61. <% end %>
  62. <div id="csv-export-options" style="display: none;">
  63. <h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
  64. <%= export_csv_encoding_select_tag %>
  65. <p class="buttons">
  66. <%= submit_tag l(:button_export), :name => nil, :id => 'csv-export-button' %>
  67. <%= submit_tag l(:button_cancel), :name => nil, :onclick => 'hideModal(this);', :type => 'button' %>
  68. </p>
  69. </div>
  70. <%= javascript_tag do %>
  71. $(document).ready(function(){
  72. $('input#csv-export-button').click(function(){
  73. $('form input#encoding').val($('select#encoding option:selected').val());
  74. $('form#users_form').attr('action', "<%= users_path(:format => 'csv') %>").submit();
  75. $('form#users_form').attr('action', '<%= users_path %>');
  76. hideModal(this);
  77. });
  78. });
  79. <% end %>
  80. <% else %>
  81. <p class="nodata"><%= l(:label_no_data) %></p>
  82. <% end %>
  83. <% html_title(l(:label_user_plural)) -%>