Roles into their own controller. Rework interface. Add flash messages to ajax calls. Add description to roles. Possible to edit roles in use.
This commit is contained in:
parent
eda5c2bc07
commit
ccd7ecbb90
59 changed files with 618 additions and 356 deletions
|
|
@ -1,29 +0,0 @@
|
|||
#myroles.roles
|
||||
- unless @role.blank?
|
||||
%p.text-muted
|
||||
= @role.first.description
|
||||
|
||||
%hr
|
||||
.row
|
||||
.col-md-6
|
||||
= semantic_form_for(:user, url: add_user_admin_conference_path(@conference.short_title, role: @selection), remote: true) do |f|
|
||||
%h4
|
||||
= f.input :email, label: "Add role '#{@selection.humanize.titleize}' to user: ", placeholder: "User's email", input_html: { required: 'required' }
|
||||
= f.action :submit, as: :button, label: 'Add User', button_html: {value: 'Add', class: 'btn btn-primary'}
|
||||
.row
|
||||
.col-md-12
|
||||
%h3 Users with role #{@selection.humanize.titleize}
|
||||
%table.table.table-striped.table-bordered.table-hover
|
||||
%thead
|
||||
%th ID
|
||||
%th Name
|
||||
%th Email
|
||||
%tbody
|
||||
- @role_users[@selection].each do |user|
|
||||
%tr
|
||||
%td
|
||||
= link_to remove_user_admin_conference_path(@conference.short_title, user_id: user.id, role: @selection), method: :delete, remote: true, title: 'Remove user' do
|
||||
%i{class: 'fa fa-times'}
|
||||
= user.id
|
||||
%td= user.name
|
||||
%td= user.email
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
.row
|
||||
.col-md-6
|
||||
= semantic_form_for(:user, url: roles_admin_conference_path(@conference.short_title), remote: true) do |f|
|
||||
%h4
|
||||
= f.input :roles, collection: @roles, label: 'Show users for role: '
|
||||
|
||||
= render partial: 'roles'
|
||||
|
||||
:javascript
|
||||
|
||||
$("#user_roles_input").change(function () {
|
||||
|
||||
var url = document.forms[0].action;
|
||||
var selected_role = $(this).find('option:selected').attr('value');
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "POST",
|
||||
data: {user: { roles: selected_role } },
|
||||
dataType: "script"
|
||||
});
|
||||
});
|
||||
|
|
@ -1 +0,0 @@
|
|||
$('#myroles').html("<%= escape_javascript(render partial: 'roles').html_safe %>");
|
||||
Loading…
Add table
Add a link
Reference in a new issue