mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
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
|
|
@ -37,6 +37,8 @@
|
|||
//= require osem-switch
|
||||
//= require osem-bootstrap
|
||||
//= require osem-commercials
|
||||
//= require unobtrusive_flash
|
||||
//= require unobtrusive_flash_bootstrap
|
||||
|
||||
$(document).ready(function() {
|
||||
$('a[disabled=disabled]').click(function(event){
|
||||
|
|
|
|||
|
|
@ -66,13 +66,15 @@ module Admin
|
|||
def create
|
||||
@conference = Conference.new(conference_params)
|
||||
|
||||
if @conference.valid?
|
||||
@conference.save
|
||||
if @conference.save
|
||||
flash[:notice] = 'Conference was successfully created.'
|
||||
|
||||
# user that creates the conference becomes organizer of that conference
|
||||
current_user.add_role :organizer, @conference
|
||||
redirect_to(admin_conference_path(id: @conference.short_title),
|
||||
notice: 'Conference was successfully created.')
|
||||
|
||||
redirect_to admin_conference_path(id: @conference.short_title)
|
||||
else
|
||||
flash[:error] = 'Could not create conference. ' + @conference.errors.full_messages.to_sentence
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
|
@ -173,31 +175,6 @@ module Admin
|
|||
end
|
||||
end
|
||||
|
||||
def roles
|
||||
@user = User.new
|
||||
@roles = Role::ACTIONABLES + Role::LABELS
|
||||
|
||||
params[:user] ? (@selection = params[:user][:roles].parameterize.underscore) : (@selection = 'organizer')
|
||||
@role_users = get_users(@selection)
|
||||
end
|
||||
|
||||
def add_user
|
||||
@user = User.find_by(email: params[:user][:email])
|
||||
@selection = params[:role]
|
||||
@user.add_role @selection, @conference
|
||||
|
||||
@role_users = get_users(@selection)
|
||||
render 'roles', formats: [:js]
|
||||
end
|
||||
|
||||
def remove_user
|
||||
@selection = params[:role]
|
||||
@user.revoke @selection, @conference
|
||||
|
||||
@role_users = get_users(@selection)
|
||||
render 'roles', formats: [:js]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def conference_params
|
||||
|
|
@ -213,14 +190,5 @@ module Admin
|
|||
:photos_attributes, :targets, :targets_attributes,
|
||||
:campaigns, :campaigns_attributes, :registration_limit)
|
||||
end
|
||||
|
||||
def get_users(role_name)
|
||||
@role_users = {}
|
||||
# Initialize @role variable, so that view can show the role description
|
||||
@role = Role.where(name: role_name, resource: @conference)
|
||||
@role.blank? ? @role_users[role_name] = @role : @role_users[role_name] = @role.first.users
|
||||
|
||||
@role_users
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
87
app/controllers/admin/roles_controller.rb
Normal file
87
app/controllers/admin/roles_controller.rb
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
module Admin
|
||||
class RolesController < Admin::BaseController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
before_action :set_selection
|
||||
# Show flash message with ajax calls
|
||||
after_action :prepare_unobtrusive_flash, only: :toggle_user
|
||||
|
||||
def index
|
||||
@roles = Role.where(resource: @conference)
|
||||
end
|
||||
|
||||
def show
|
||||
@users = @role.users
|
||||
end
|
||||
|
||||
def edit
|
||||
@users = @role.users
|
||||
end
|
||||
|
||||
def update
|
||||
role_name = @role.name
|
||||
|
||||
if @role.update_attributes(role_params)
|
||||
flash[:notice] = 'Successfully updated role ' + @role.name
|
||||
redirect_to admin_conference_role_path(@conference.short_title, @role.name)
|
||||
else
|
||||
@role.name = role_name
|
||||
flash[:error] = 'Could not update role! ' + @role.errors.full_messages.to_sentence
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def toggle_user
|
||||
user = User.find_by(email: user_params[:email])
|
||||
state = user_params[:state]
|
||||
|
||||
unless user
|
||||
flash[:error] = 'Could not find user. Please provide a valid email!'
|
||||
redirect_to(admin_conference_role_path(@conference.short_title, @role.name)) && return
|
||||
end
|
||||
|
||||
# The conference must have at least 1 organizer
|
||||
if @role.name == 'organizer' && state == 'false' && @role.users.count == 1
|
||||
flash[:error] = 'The conference must have at least 1 organizer!'
|
||||
redirect_to(admin_conference_role_path(@conference.short_title, @role.name)) && return
|
||||
end
|
||||
|
||||
# Remove user
|
||||
if state == 'false'
|
||||
if user.remove_role @role.name, @conference
|
||||
flash[:notice] = "Successfully removed role #{@role.name} from user #{user.email}"
|
||||
else
|
||||
flash[:error] = "Could not remove role #{@role.name} from user #{user.email}"
|
||||
end
|
||||
elsif user.has_role? @role.name, @conference
|
||||
flash[:error] = "User #{user.email} already has the role #{@role.name}"
|
||||
# Add user
|
||||
elsif user.add_role @role.name, @conference
|
||||
flash[:notice] = "Successfully added role #{@role.name} to user #{user.email}"
|
||||
else
|
||||
flash[:error] = "Coud not add role #{@role.name} to #{user.email}"
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html { redirect_to admin_conference_role_path(@conference.short_title, @role.name) }
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_selection
|
||||
# Set 'organizer' as default role, when there is no other selection
|
||||
@selection = params[:id] ? params[:id].parameterize.underscore : 'organizer'
|
||||
|
||||
@role = Role.find_by(name: @selection, resource: @conference)
|
||||
end
|
||||
|
||||
def role_params
|
||||
params.require(:role).permit(:name, :description, user_ids: [])
|
||||
end
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:email, :state)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -37,6 +37,10 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def format_role(role)
|
||||
role.parameterize.underscore
|
||||
end
|
||||
|
||||
def target_progress_color(progress)
|
||||
progress = progress.to_i
|
||||
result =
|
||||
|
|
|
|||
|
|
@ -19,15 +19,11 @@ class Ability
|
|||
# This is what sets up the different abilities
|
||||
if user.new_record?
|
||||
not_signed_in
|
||||
# Checks if the user does not have any role and is not an admin
|
||||
elsif user.roles.any? || user.is_admin
|
||||
signed_in_with_roles(user)
|
||||
else
|
||||
# This maps the actionables name of the role to its name in the DB.
|
||||
roles = Role::ACTIONABLES.map {|i| i.parameterize.underscore}
|
||||
# Checks if the user does not have any role and is not an admin
|
||||
if (user.roles.pluck(:name) & roles).empty? && !user.is_admin
|
||||
signed_in(user)
|
||||
else
|
||||
signed_in_with_roles(user)
|
||||
end
|
||||
signed_in(user)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -151,6 +147,19 @@ class Ability
|
|||
can :manage, Ticket, conference_id: conf_ids_for_organizer
|
||||
can :index, Comment, commentable_type: 'Event',
|
||||
commentable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_organizer).pluck(:id)).pluck(:id)
|
||||
|
||||
# Abilities for Role (Conference resource)
|
||||
can :index, Role
|
||||
can :manage, Role do |role|
|
||||
role.resource_type == 'Conference' && (conf_ids_for_organizer.include? role.resource_id)
|
||||
end
|
||||
|
||||
# Can add or remove users from role, when user has that same role for the conference
|
||||
# Eg. If you are member of the CfP team, you can add more CfP team members (add users to the role 'CfP')
|
||||
can :toggle_user, Role do |role|
|
||||
role.resource_type == 'Conference' &&
|
||||
(Conference.with_role(role.name.parameterize.underscore.to_sym, user).pluck(:id).include? role.resource_id)
|
||||
end
|
||||
end
|
||||
|
||||
def signed_in_with_cfp_role(user)
|
||||
|
|
@ -172,6 +181,20 @@ class Ability
|
|||
commercialable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_cfp).pluck(:id)).pluck(:id)
|
||||
can :index, Comment, commentable_type: 'Event',
|
||||
commentable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_cfp).pluck(:id)).pluck(:id)
|
||||
|
||||
# Abilities for Role (Conference resource)
|
||||
can :index, Role
|
||||
|
||||
can :manage, Role do |role|
|
||||
role.resource_type == 'Conference' && (conf_ids_for_cfp.include? role.resource_id)
|
||||
end
|
||||
|
||||
# Can add or remove users from role, when user has that same role for the conference
|
||||
# Eg. If you are member of the CfP team, you can add more CfP team members (add users to the role 'CfP')
|
||||
can :toggle_user, Role do |role|
|
||||
role.resource_type == 'Conference' &&
|
||||
(Conference.with_role(role.name.parameterize.underscore.to_sym, user).pluck(:id).include? role.resource_id)
|
||||
end
|
||||
end
|
||||
|
||||
def signed_in_with_info_desk_role(user)
|
||||
|
|
@ -185,6 +208,19 @@ class Ability
|
|||
can :manage, Question do |question|
|
||||
!(question.conferences.pluck(:id) & conf_ids_for_info_desk).empty?
|
||||
end
|
||||
# Abilities for Role (Conference resource)
|
||||
can :index, Role
|
||||
|
||||
can :manage, Role do |role|
|
||||
role.resource_type == 'Conference' && (conf_ids_for_info_desk.include? role.resource_id)
|
||||
end
|
||||
|
||||
# Can add or remove users from role, when user has that same role for the conference
|
||||
# Eg. If you are member of the CfP team, you can add more CfP team members (add users to the role 'CfP')
|
||||
can :toggle_user, Role do |role|
|
||||
role.resource_type == 'Conference' &&
|
||||
(Conference.with_role(role.name.parameterize.underscore.to_sym, user).pluck(:id).include? role.resource_id)
|
||||
end
|
||||
end
|
||||
|
||||
def signed_in_with_volunteers_coordinator_role(user)
|
||||
|
|
@ -195,5 +231,18 @@ class Ability
|
|||
|
||||
can :manage, Vposition, conference_id: conf_ids_for_volunteers_coordinator
|
||||
can :manage, Vday, conference_id: conf_ids_for_volunteers_coordinator
|
||||
# Abilities for Role (Conference resource)
|
||||
can :index, Role
|
||||
|
||||
can :manage, Role do |role|
|
||||
role.resource_type == 'Conference' && (conf_ids_for_volunteers_coordinator.include? role.resource_id)
|
||||
end
|
||||
|
||||
# Can add or remove users from role, when user has that same role for the conference
|
||||
# Eg. If you are member of the CfP team, you can add more CfP team members (add users to the role 'CfP')
|
||||
can :toggle_user, Role do |role|
|
||||
role.resource_type == 'Conference' &&
|
||||
(Conference.with_role(role.name.parameterize.underscore.to_sym, user).pluck(:id).include? role.resource_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
class Conference < ActiveRecord::Base
|
||||
require 'uri'
|
||||
serialize :events_per_week, Hash
|
||||
resourcify # Needed to call 'Conference.with_role' in /models/ability.rb
|
||||
# Needed to call 'Conference.with_role' in /models/ability.rb
|
||||
resourcify
|
||||
|
||||
default_scope { order('start_date DESC') }
|
||||
|
||||
|
|
@ -545,6 +546,18 @@ class Conference < ActiveRecord::Base
|
|||
after_create do
|
||||
self.create_contact
|
||||
self.create_program
|
||||
create_roles
|
||||
end
|
||||
|
||||
##
|
||||
# Creates the roles of the conference
|
||||
# after the conference has been successfully created
|
||||
# Will create 4 new records for roles
|
||||
def create_roles
|
||||
Role.where(name: 'organizer', resource: self).first_or_create(description: 'For the organizers of the conference (who shall have full access)')
|
||||
Role.where(name: 'cfp', resource: self).first_or_create(description: 'For the members of the CfP team')
|
||||
Role.where(name: 'info_desk', resource: self).first_or_create(description: 'For the members of the Info Desk team')
|
||||
Role.where(name: 'volunteers_coordinator', resource: self).first_or_create(description: 'For the people in charge of volunteers')
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
class Role < ActiveRecord::Base
|
||||
has_and_belongs_to_many :users
|
||||
belongs_to :resource, polymorphic: true
|
||||
has_and_belongs_to_many :users
|
||||
|
||||
scopify
|
||||
|
||||
LABELS = ['Attendee', 'Volunteer', 'Speaker', 'Sponsor', 'Press', 'Keynote Speaker']
|
||||
ACTIONABLES = ['Organizer', 'CfP', 'Info Desk', 'Volunteers Coordinator']
|
||||
validates :name, presence: true
|
||||
|
||||
validates :name, uniqueness: { scope: :resource }
|
||||
end
|
||||
|
|
|
|||
|
|
@ -128,9 +128,9 @@ class User < ActiveRecord::Base
|
|||
# * +Hash+ * -> e.g. 'organizer' => "(conf1, conf2)"
|
||||
def get_roles
|
||||
result = {}
|
||||
Role::ACTIONABLES.each do |role|
|
||||
resources = self.roles.where(name: role.parameterize.underscore).map{ |myrole| Conference.find(myrole.resource_id).short_title }.join ', '
|
||||
result[role.parameterize.underscore] = "(#{ resources })" unless resources.blank?
|
||||
Role.all.find_each do |role|
|
||||
resources = self.roles.map{ |myrole| Conference.find(myrole.resource_id).short_title }.join ', '
|
||||
result[role.name] = "(#{ resources })" unless resources.blank?
|
||||
end
|
||||
result
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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 %>");
|
||||
15
app/views/admin/roles/_form.html.haml
Normal file
15
app/views/admin/roles/_form.html.haml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h2
|
||||
Role
|
||||
= @role.name.titleize
|
||||
.text-muted
|
||||
= @role.description
|
||||
|
||||
= semantic_form_for @role, url: admin_conference_role_path(@conference.short_title, @role.name) do |f|
|
||||
.row
|
||||
.col-md-5
|
||||
= f.input :description
|
||||
|
||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||
20
app/views/admin/roles/_users.html.haml
Normal file
20
app/views/admin/roles/_users.html.haml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
.page-header
|
||||
%h3 Users (#{users.length})
|
||||
- if users.present?
|
||||
%table.table.table-striped.table-bordered.table-hover.datatable#users
|
||||
%thead
|
||||
%th.col-md-1
|
||||
%th ID
|
||||
%th Name
|
||||
%th Email
|
||||
%tbody
|
||||
- users.each do |user|
|
||||
%tr
|
||||
%td.text-right
|
||||
= hidden_field_tag "role[user_ids][]", nil
|
||||
= check_box_tag @conference.short_title, @role.id, (@role.user_ids.include? user.id), method: :post, url: "/admin/conference/#{@conference.short_title}/roles/#{@role.name}/toggle_user?user[email]=#{user.email}&user[state]=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
|
||||
%td= user.id
|
||||
%td= user.name
|
||||
%td= user.email
|
||||
- else
|
||||
%h5 No users found!
|
||||
31
app/views/admin/roles/index.html.haml
Normal file
31
app/views/admin/roles/index.html.haml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
.row
|
||||
.col-md-12.page-header
|
||||
%h2
|
||||
Roles
|
||||
|
||||
.text-muted
|
||||
The available roles for the conference
|
||||
|
||||
.col-md-12
|
||||
%table.table.table-bordered.table-striped.table-hover.datatable#roles
|
||||
%thead
|
||||
%th ID
|
||||
%th Name
|
||||
%th Description
|
||||
%th Users
|
||||
%th Actions
|
||||
%tbody
|
||||
- @roles.each do |role|
|
||||
%tr
|
||||
%td= role.id
|
||||
%td= role.name.titleize
|
||||
%td= role.description
|
||||
%td
|
||||
= role.users.pluck(:name).first(5).join ', '
|
||||
- if role.users.count > 5
|
||||
= link_to '...', admin_conference_role_path(@conference.short_title, role.name)
|
||||
%td
|
||||
.btn-group
|
||||
= link_to 'Users', admin_conference_role_path(@conference.short_title, role.name), class: 'btn btn-success'
|
||||
- if can? :edit, role
|
||||
= link_to 'Edit', edit_admin_conference_role_path(@conference.short_title, role.name), class: 'btn btn-primary'
|
||||
27
app/views/admin/roles/show.html.haml
Normal file
27
app/views/admin/roles/show.html.haml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
.unobtrusive-flash-container
|
||||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h2
|
||||
Role
|
||||
= @role.name.titleize
|
||||
- if can? :edit, @role
|
||||
= link_to 'Edit', edit_admin_conference_role_path(@conference.short_title, @role.name), class: 'btn btn-primary pull-right'
|
||||
.text-muted
|
||||
= @role.description
|
||||
|
||||
.row.col-md-3
|
||||
- if ( can? :toggle_user, @role ) && !@role.new_record?
|
||||
|
||||
= semantic_form_for :user, url: toggle_user_admin_conference_role_path(@conference.short_title, @role.name), method: :post do |u|
|
||||
|
||||
= u.label 'Add user by email: '
|
||||
.input-group
|
||||
= u.input :email, label: false, placeholder: "User's email"
|
||||
.input-group-btn
|
||||
= u.submit 'Add', id: 'user-add', class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
#users_area
|
||||
= render partial: 'users', locals: { users: @users }
|
||||
1
app/views/admin/roles/toggle_user.js.erb
Normal file
1
app/views/admin/roles/toggle_user.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
|||
$(".alert").remove();
|
||||
|
|
@ -59,29 +59,31 @@
|
|||
- if can? :update, @conference.lodgings.build
|
||||
%li{ class: active_nav_li(admin_conference_lodgings_path(@conference.short_title)) }
|
||||
= link_to 'Lodgings', admin_conference_lodgings_path(@conference.short_title)
|
||||
- if can? :show, @conference.program
|
||||
%li{:class=> "#{active_nav_li(admin_conference_program_path(@conference.short_title))}"}
|
||||
= link_to admin_conference_program_path(@conference.short_title) do
|
||||
%span.fa.fa-calendar
|
||||
Program
|
||||
%ul
|
||||
- if can? :update, Cfp.new(program_id: @conference.program.id)
|
||||
%li{:class=> active_nav_li(admin_conference_program_cfp_path(@conference.short_title))}
|
||||
= link_to 'Call for Papers', admin_conference_program_cfp_path(@conference.short_title)
|
||||
- if can? :update, @conference.program.events.build
|
||||
%li{:class=> active_nav_li(admin_conference_program_events_path(@conference.short_title))}
|
||||
= link_to 'Events', admin_conference_program_events_path(@conference.short_title)
|
||||
- if can? :update, @conference.program.tracks.build
|
||||
%li{:class=> active_nav_li(admin_conference_program_tracks_path(@conference.short_title))}
|
||||
= link_to 'Tracks', admin_conference_program_tracks_path(@conference.short_title)
|
||||
- if can? :update, @conference.program.event_types.build
|
||||
%li{:class=> active_nav_li(admin_conference_program_event_types_path(@conference.short_title))}
|
||||
= link_to 'Event Types', admin_conference_program_event_types_path(@conference.short_title)
|
||||
- if can? :update, @conference.program.difficulty_levels.build, conference_id: @conference.id
|
||||
%li{:class=> active_nav_li(admin_conference_program_difficulty_levels_path(@conference.short_title))}
|
||||
= link_to 'Difficulty Levels', admin_conference_program_difficulty_levels_path(@conference.short_title)
|
||||
- if can? :update, @conference.program.events.build
|
||||
%li{class: active_nav_li(admin_conference_schedule_path(@conference.short_title))}
|
||||
= link_to 'Schedule', admin_conference_schedule_path(@conference.short_title), target: '_blank'
|
||||
- if @conference.program
|
||||
%ul
|
||||
- if can? :update, Cfp.new(program_id: @conference.program.id)
|
||||
%li{:class=> active_nav_li(admin_conference_program_cfp_path(@conference.short_title))}
|
||||
= link_to 'Call for Papers', admin_conference_program_cfp_path(@conference.short_title)
|
||||
- if can? :update, @conference.program.events.build
|
||||
%li{:class=> active_nav_li(admin_conference_program_events_path(@conference.short_title))}
|
||||
= link_to 'Events', admin_conference_program_events_path(@conference.short_title)
|
||||
- if can? :update, @conference.program.tracks.build
|
||||
%li{:class=> active_nav_li(admin_conference_program_tracks_path(@conference.short_title))}
|
||||
= link_to 'Tracks', admin_conference_program_tracks_path(@conference.short_title)
|
||||
- if can? :update, @conference.program.event_types.build
|
||||
%li{:class=> active_nav_li(admin_conference_program_event_types_path(@conference.short_title))}
|
||||
= link_to 'Event Types', admin_conference_program_event_types_path(@conference.short_title)
|
||||
- if can? :update, @conference.program.difficulty_levels.build, conference_id: @conference.id
|
||||
%li{:class=> active_nav_li(admin_conference_program_difficulty_levels_path(@conference.short_title))}
|
||||
= link_to 'Difficulty Levels', admin_conference_program_difficulty_levels_path(@conference.short_title)
|
||||
- if can? :update, @conference.program.events.build
|
||||
%li{class: active_nav_li(admin_conference_schedule_path(@conference.short_title))}
|
||||
= link_to 'Schedule', admin_conference_schedule_path(@conference.short_title), target: '_blank'
|
||||
|
||||
- if can? :update, Registration.new(conference_id: @conference.id)
|
||||
%li{:class=> active_nav_li(admin_conference_registrations_path(@conference.short_title))}
|
||||
|
|
@ -129,8 +131,8 @@
|
|||
= link_to(admin_conference_emails_path(@conference.short_title)) do
|
||||
%span.fa.fa-envelope
|
||||
E-Mails
|
||||
- if can? :manage, @conference
|
||||
%li{:class=> active_nav_li(roles_admin_conference_path(@conference.short_title))}
|
||||
= link_to(roles_admin_conference_path(@conference.short_title)) do
|
||||
- if can? :index, Role.new(resource: @conference)
|
||||
%li{:class=> active_nav_li(admin_conference_roles_path(@conference.short_title))}
|
||||
= link_to(admin_conference_roles_path(@conference.short_title)) do
|
||||
%span.fa.fa-group
|
||||
Roles
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
%span.fa.fa-cog
|
||||
Manage
|
||||
= conference.short_title
|
||||
- if (current_user.is_admin) || (current_user.has_role? :organizer, :any)
|
||||
- if can? :create, Conference
|
||||
%li
|
||||
= link_to(new_admin_conference_path) do
|
||||
%span.fa.fa-plus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue