check abilities
This commit is contained in:
parent
ffb290de0c
commit
07877f3256
8 changed files with 150 additions and 116 deletions
|
|
@ -18,11 +18,13 @@
|
|||
= ','
|
||||
= label_tag dom_id(q), "Answers: #{q.answers.map {|a| a.title}.join(', ')}"
|
||||
|
||||
%td= link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, q),
|
||||
class: 'btn btn-primary',
|
||||
disabled: q.global == true && !has_role?(current_user, 'Admin')
|
||||
- if can? :update, q
|
||||
%td= link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, q),
|
||||
class: 'btn btn-primary',
|
||||
disabled: q.global == true
|
||||
|
||||
%td= link_to 'Delete', admin_conference_question_path(@conference.short_title, q),
|
||||
method: :delete, remote: true, class: 'btn btn-danger',
|
||||
confirm: "Delete question '#{q.title}'?",
|
||||
disabled: q.global == true && !has_role?(current_user, "Admin")
|
||||
- if can? :destroy, q
|
||||
%td= link_to 'Delete', admin_conference_question_path(@conference.short_title, q),
|
||||
method: :delete, remote: true, class" 'btn btn-danger',
|
||||
confirm: "Delete question '#{q.title}'?",
|
||||
disabled: q.global == true
|
||||
|
|
|
|||
|
|
@ -7,9 +7,11 @@
|
|||
= "(#{@registrations.length})"
|
||||
= " - Attended (#{@attended})"
|
||||
.btn-group.pull-right
|
||||
= link_to "New", new_admin_conference_registration_path(@conference.short_title), :class => "btn btn-default"
|
||||
= link_to "Export PDF", admin_conference_registrations_path(@conference.short_title, :format => :pdf), :class => "btn btn-default"
|
||||
= link_to "Export XLS", {:format => :xlsx}, :class => "btn btn-default"
|
||||
- if can? :create, Registration
|
||||
= link_to "New", new_admin_conference_registration_path(@conference.short_title), :class => "btn btn-default"
|
||||
- if can? :read, Registration
|
||||
= link_to "Export PDF", admin_conference_registrations_path(@conference.short_title, :format => :pdf), :class => "btn btn-default"
|
||||
= link_to "Export XLS", {:format => :xlsx}, :class => "btn btn-default"
|
||||
%table.table.table-bordered.table-striped.table-hover#registrations
|
||||
%thead
|
||||
%th
|
||||
|
|
@ -21,7 +23,7 @@
|
|||
%th
|
||||
%th
|
||||
%th
|
||||
- counter = 0
|
||||
- counter = 0
|
||||
- @registrations.each do |registration|
|
||||
%tr
|
||||
%td
|
||||
|
|
@ -33,7 +35,7 @@
|
|||
- if registration.supporter_level && registration.supporter_level.title != 'Free'
|
||||
%p{:style => "color:red"}
|
||||
= registration.supporter_level.title
|
||||
|
||||
|
||||
-elsif field == 'attended'
|
||||
= link_to "#{registration.send(field.to_sym)}", admin_conference_registrations_change_field_path(@conference.short_title, :id => registration.id, :view_field => "#{field}"), :method => :patch, ":#{field}" => registration.send(field.to_sym), :class => "btn btn-success"
|
||||
|
||||
|
|
@ -64,11 +66,11 @@
|
|||
"bLengthChange": false
|
||||
} );
|
||||
} );
|
||||
|
||||
|
||||
function toggle(rowid) {
|
||||
if( document.getElementById(rowid).style.display=='none' ){
|
||||
document.getElementById(rowid).style.display = '';
|
||||
}else{
|
||||
document.getElementById(rowid).style.display = 'none';
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
- if @users
|
||||
= "(#{@users.length})"
|
||||
|
||||
= link_to "New User", new_admin_user_path, :class => "btn btn-success pull-right"
|
||||
= link_to "New User", new_admin_user_path, class: 'btn btn-success pull-right'
|
||||
.well
|
||||
%table.table.table-striped.table-bordered.table-hover#users
|
||||
%thead
|
||||
|
|
@ -61,16 +61,22 @@
|
|||
%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"}
|
||||
=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)
|
||||
%td
|
||||
= link_to "View", admin_user_path(user)
|
||||
%td
|
||||
- if current_user.id == user.id or user.role_ids.include? 3
|
||||
=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"
|
||||
- if can? :update, Role
|
||||
=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}"
|
||||
- else
|
||||
=link_to 'Delete',admin_user_path(user), :method=> :delete , :data=> {:confirm => 'Are you sure ?'},:class => "btn btn-primary btn-danger"
|
||||
= user.roles.map { |role| role.name }.join ', '
|
||||
- if can? :update, user
|
||||
%td
|
||||
= link_to "Edit", edit_admin_user_path(user)
|
||||
- if can? :show, user
|
||||
%td
|
||||
= link_to "View", admin_user_path(user)
|
||||
- if can? :destroy, user
|
||||
%td
|
||||
- if current_user.id == user.id or user.role_ids.include? 3
|
||||
=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
|
||||
=link_to 'Delete',admin_user_path(user), :method=> :delete , :data=> {:confirm => 'Are you sure ?'},:class => "btn btn-primary btn-danger"
|
||||
|
||||
|
||||
:javascript
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue