app/views/organizations/users.html.erb
<div class="tabs">
<ul>
<li><a href="#tabs-1"><%= I18n.t(:users) %> </a></li>
</ul>
<div id="tabs-1">
<% if can? :show_organization_users, User %>
<% if can? :manage, User, :organization_id => @organization.id %>
<%= link_to I18n.t('new_user'), new_organization_user_path(@organization), :class => 'btn pull-right' %>
<%= link_to "Exporter les utilisateurs (CSV)", organization_export_path(@organization), :class => 'btn pull-right button_margin_right', method: "post" %>
<a href="#myWBSModal" role="button" class="btn pull-right button_margin_right" title="Import users from excel" data-toggle="modal">
Importer les utilisateurs (CSV)
</a>
<div id="myWBSModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= form_tag organization_import_user_path(@organization), :multipart => true, :class => 'simple_form' do %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Import users from Excel</h3>
</div>
<div class="modal-body">
<label>
<%= I18n.t(:file_csv) %>
<br>
Format (Prénom, Nom, Email, Login)
</label>
<%= file_field_tag :file %>
<label><%= I18n.t(:separator) %>'<%= I18n.t(:general_csv_separator) %>') </label>
<%= text_field_tag :separator %>
<label><%= I18n.t(:encoding) %></label>
<%= select_tag :encoding, options_for_select(Project::encoding, :selected => I18n.t(:general_csv_encoding)) %>
<label><%= I18n.t(:languages) %></label>
<%= select_tag :language_id, options_for_select(Language.all.map{|i| [i.name, i.id]}) %>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<%= submit_tag I18n.t(:import), :class => 'btn btn-primary', :onclick => "$('.loading').show();" %>
</div>
<div class="loading span11 hide">
<h4><%= I18n.t(:please_wait_import) %><%= image_tag 'ajax-loader.gif' %> </h4>
</div>
<% end %>
</div>
<% end %>
<table id="table_list_2" class="table tablesorterPager table-striped table-bordered table-condensed">
<thead>
<tr>
<th><%= I18n.t(:first_name) %></th>
<th><%= I18n.t(:last_name) %></th>
<th><%= I18n.t(:login_name) %></th>
<th>Confirmé le</th>
<th><%= I18n.t(:groups) %></th>
<% if current_user.super_admin? %>
<th><%= I18n.t(:is_super_admin) %></th>
<% end %>
<th class="action" colspan="2"><%= I18n.t(:actions) %></th>
</tr>
</thead>
<tbody>
<% @organization.users.each do |user| %>
<tr>
<td><%= user.first_name %></td>
<td><%= user.last_name %></td>
<td><%= user.login_name %></td>
<td><%= user.confirmed_at.nil? ? 'Non confirmé' : user.confirmed_at.strftime("%d/%m/%Y") %></td>
<td><%= user.groups.where(organization_id: @organization.id).join('; ') %></td>
<% if current_user.super_admin? %>
<td class="center"><%= check_box_tag "is_super_admin", user.super_admin, user.super_admin, disabled: true %></td>
<% end %>
<td class="center">
<%= link_to "", edit_organization_user_path(@organization, user), class: "icon icon-pencil", :title => I18n.t('edit') %>
<% if can? :manage, User, :organization_id => @organization.id %>
<%= link_to '', organization_user_path(user, organization_id: @organization.id), confirm: I18n.t('are_you_sure'), method: :delete, :class => 'icon-trash', :title => I18n.t('delete') %>
<% end %>
</td>
</tr>
<% end %>
<%= render :partial => 'layouts/footer_table' %>
</tbody>
</table>
<% else %>
<div class="red_color">
<%= I18n.t(:notice_cannot_view_organization_users) %>
</div>
<% end %>
</div>
</div>