2014-03-17 16:36:32 +01:00
|
|
|
|
.row
|
|
|
|
|
|
.col-md-12
|
|
|
|
|
|
%h2
|
|
|
|
|
|
Users
|
|
|
|
|
|
- if @users
|
|
|
|
|
|
= "(#{@users.length})"
|
2014-06-23 19:07:50 +03:00
|
|
|
|
|
|
|
|
|
|
= link_to "New User", new_admin_user_path, :class => "btn btn-success pull-right"
|
2014-03-17 16:36:32 +01:00
|
|
|
|
.well
|
|
|
|
|
|
%table.table.table-striped.table-bordered.table-hover#users
|
|
|
|
|
|
%thead
|
|
|
|
|
|
%th
|
|
|
|
|
|
%b ID
|
|
|
|
|
|
%th
|
|
|
|
|
|
%b State
|
|
|
|
|
|
%th
|
|
|
|
|
|
%b Email
|
|
|
|
|
|
%th
|
2014-06-23 19:07:50 +03:00
|
|
|
|
%b Name
|
2014-03-17 16:36:32 +01:00
|
|
|
|
%th
|
2014-06-23 19:07:50 +03:00
|
|
|
|
%b # of Conference Registrations
|
2014-03-17 16:36:32 +01:00
|
|
|
|
%th
|
|
|
|
|
|
%b Roles
|
|
|
|
|
|
%th
|
|
|
|
|
|
%th
|
2014-03-27 20:14:52 +05:30
|
|
|
|
%th
|
2014-03-17 16:36:32 +01:00
|
|
|
|
- @users.each do |user|
|
|
|
|
|
|
%tr
|
|
|
|
|
|
%td
|
|
|
|
|
|
= user.id
|
|
|
|
|
|
%td
|
|
|
|
|
|
- if user.confirmed?
|
|
|
|
|
|
confirmed
|
|
|
|
|
|
- else
|
|
|
|
|
|
unconfirmed
|
|
|
|
|
|
%td
|
|
|
|
|
|
= user.email
|
|
|
|
|
|
%td
|
2014-06-23 19:07:50 +03:00
|
|
|
|
= user.name
|
2014-03-17 16:36:32 +01:00
|
|
|
|
%td
|
2014-06-23 19:07:50 +03:00
|
|
|
|
= user.registrations.count
|
2014-03-17 16:36:32 +01:00
|
|
|
|
%td
|
2014-05-15 17:47:34 +05:30
|
|
|
|
.modal.fade{:id => "user-role-selection-#{user.id}", "role" => "dialog", "aria-hidden" => "true"}
|
|
|
|
|
|
.modal-dialog
|
|
|
|
|
|
.modal-content
|
|
|
|
|
|
.modal-header
|
|
|
|
|
|
%button{"type"=>"button", :class=>"close", "data-dismiss"=>"modal", "aria-hidden"=>"true"}
|
|
|
|
|
|
×
|
|
|
|
|
|
%h3{:id => "role-selector-header-#{user.id}"}
|
|
|
|
|
|
Modifying Roles
|
|
|
|
|
|
.modal-body
|
|
|
|
|
|
- if current_user == user
|
|
|
|
|
|
You cannot modify your own role!
|
|
|
|
|
|
%br
|
|
|
|
|
|
%button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"}
|
|
|
|
|
|
Cancel
|
|
|
|
|
|
- else
|
2014-06-23 19:07:50 +03:00
|
|
|
|
= "Give #{user.name} (#{user.email}) the following roles:"
|
2014-05-15 17:47:34 +05:30
|
|
|
|
= semantic_form_for(user, :url => admin_user_path(user), :method => :put) do |f|
|
|
|
|
|
|
= f.input :roles, :label => false
|
|
|
|
|
|
%button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"}
|
|
|
|
|
|
Cancel
|
|
|
|
|
|
= f.action :submit, :as => :button, :button_html => {:value => "Save", :class => "btn btn-primary"}
|
2014-06-23 19:07:50 +03:00
|
|
|
|
=link_to "#{user.roles.map { |role| role.name }.join ', '}", "#", "data-toggle" => "modal", "data-target" => "#user-role-selection-#{user.id}",id: "user-modify-role-#{user.id}"
|
|
|
|
|
|
%td
|
|
|
|
|
|
= link_to "Edit", edit_admin_user_path(user)
|
2014-03-17 16:36:32 +01:00
|
|
|
|
%td
|
2014-06-23 19:07:50 +03:00
|
|
|
|
= link_to "View", admin_user_path(user)
|
2014-03-27 20:14:52 +05:30
|
|
|
|
%td
|
2014-03-28 00:00:21 +05:30
|
|
|
|
- if current_user.id == user.id or user.role_ids.include? 3
|
2014-06-23 19:07:50 +03:00
|
|
|
|
=link_to 'Delete',admin_user_path(user), :method => :delete , :data => {:confirm => 'Are you sure ?'}, :disabled => true,:class => "btn btn-primary disabled btn-danger",:role => "button"
|
|
|
|
|
|
- else
|
2014-03-28 00:00:21 +05:30
|
|
|
|
=link_to 'Delete',admin_user_path(user), :method=> :delete , :data=> {:confirm => 'Are you sure ?'},:class => "btn btn-primary btn-danger"
|
2014-03-27 20:14:52 +05:30
|
|
|
|
|
2013-01-07 09:04:09 +01:00
|
|
|
|
|
2013-05-07 14:46:33 +02:00
|
|
|
|
:javascript
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
$('#users').dataTable( {
|
2013-06-14 13:17:40 +02:00
|
|
|
|
"bPaginate": false,
|
|
|
|
|
|
"bLengthChange": false
|
2013-05-07 14:46:33 +02:00
|
|
|
|
} );
|
|
|
|
|
|
} );
|