mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Add :accept booth to ability
This commit is contained in:
parent
e73218b5ca
commit
52cde784fa
6 changed files with 68 additions and 60 deletions
|
|
@ -330,6 +330,8 @@ Metrics/LineLength:
|
||||||
# Configuration parameters: CountComments.
|
# Configuration parameters: CountComments.
|
||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
Max: 56
|
Max: 56
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/admin_ability.rb'
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
# Configuration parameters: CountComments.
|
# Configuration parameters: CountComments.
|
||||||
|
|
@ -443,6 +445,7 @@ Style/HashSyntax:
|
||||||
# Configuration parameters: MaxLineLength.
|
# Configuration parameters: MaxLineLength.
|
||||||
Style/IfUnlessModifier:
|
Style/IfUnlessModifier:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
- 'app/controllers/admin/booths_controller.rb'
|
||||||
- 'app/controllers/admin/events_controller.rb'
|
- 'app/controllers/admin/events_controller.rb'
|
||||||
- 'app/controllers/api/v1/events_controller.rb'
|
- 'app/controllers/api/v1/events_controller.rb'
|
||||||
- 'app/controllers/conference_registrations_controller.rb'
|
- 'app/controllers/conference_registrations_controller.rb'
|
||||||
|
|
|
||||||
|
|
@ -47,21 +47,18 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def accept
|
def accept
|
||||||
|
@booth.accept!
|
||||||
|
|
||||||
if can? :accept, @booth
|
if @booth.save
|
||||||
@booth.accept!
|
if @conference.email_settings.send_on_booths_acceptance
|
||||||
|
Mailbot.conference_booths_acceptance_mail(@booth).deliver
|
||||||
if @booth.save
|
|
||||||
if @conference.email_settings.send_on_booths_acceptance
|
|
||||||
Mailbot.conference_booths_acceptance_mail(@booth).deliver
|
|
||||||
end
|
|
||||||
redirect_to admin_conference_booths_path(conference_id: @conference.short_title),
|
|
||||||
notice: 'Booth successfully accepted!'
|
|
||||||
else
|
|
||||||
redirect_to admin_conference_booths_path(conference_id: @conference.short_title)
|
|
||||||
flash[:error] = "Booth could not be accepted. #{@booth.errors.full_messages.to_sentence}."
|
|
||||||
end
|
end
|
||||||
end
|
redirect_to admin_conference_booths_path(conference_id: @conference.short_title),
|
||||||
|
notice: 'Booth successfully accepted!'
|
||||||
|
else
|
||||||
|
redirect_to admin_conference_booths_path(conference_id: @conference.short_title)
|
||||||
|
flash[:error] = "Booth could not be accepted. #{@booth.errors.full_messages.to_sentence}."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_accept
|
def to_accept
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,11 @@ class AdminAbility
|
||||||
cannot :destroy, Track do |track|
|
cannot :destroy, Track do |track|
|
||||||
track.self_organized?
|
track.self_organized?
|
||||||
end
|
end
|
||||||
|
# Can't accept a booth when booth_limit is reached
|
||||||
|
cannot :accept, Booth do |booth|
|
||||||
|
conference = booth.conference
|
||||||
|
conference.maximum_accepted_booths?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Abilities for signed in users with roles
|
# Abilities for signed in users with roles
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
|
|
||||||
- if booth.transition_possible? :accept
|
- if booth.transition_possible? :accept
|
||||||
- if can? :accept, @booth
|
- if can? :accept, booth
|
||||||
|
- if @conference.booth_limit > 0
|
||||||
|
- confirm_message = ' You are able to accept '+ pluralize(@conference.booth_limit - (@conference.booths.accepted.count + @conference.booths.confirmed.count), 'more booth') + " (booth limit set to #{@conference.booth_limit}). Are you sure you want to accept this one?"
|
||||||
- if @conference.email_settings.send_on_booths_acceptance
|
- if @conference.email_settings.send_on_booths_acceptance
|
||||||
- link = 'Accept with email'
|
- link = 'Accept with email'
|
||||||
|
- confirm_message = "By accepting this booth, an email will be sent informing the submitter for the acceptance. You may change the state to \'To accept\' until you are completely sure." + confirm_message
|
||||||
- else
|
- else
|
||||||
- link = 'Accept booth'
|
- link = 'Accept booth'
|
||||||
%li= link_to link,
|
%li= link_to link,
|
||||||
accept_admin_conference_booth_path(@conference.short_title, booth),
|
accept_admin_conference_booth_path(@conference.short_title, booth),
|
||||||
method: :patch ,id: "accept_booth_#{booth.id}",
|
method: :patch ,id: "accept_booth_#{booth.id}",
|
||||||
data: (@conference.booth_limit > 0 ? { confirm: 'You are able to accept '+ pluralize(@conference.booth_limit - @conference.booths.accepted.count, 'more booth') + " (booth limit set to #{@conference.booth_limit}). Are you sure you want to accept this one?" } : nil )
|
data: (confirm_message ? { confirm: confirm_message } : nil)
|
||||||
|
|
||||||
- if booth.transition_possible? :reject
|
- if booth.transition_possible? :reject
|
||||||
- if @conference.email_settings.send_on_booths_rejection
|
- if @conference.email_settings.send_on_booths_rejection
|
||||||
|
|
@ -16,7 +20,8 @@
|
||||||
- link = 'Reject'
|
- link = 'Reject'
|
||||||
%li= link_to link,
|
%li= link_to link,
|
||||||
reject_admin_conference_booth_path(@conference.short_title, booth),
|
reject_admin_conference_booth_path(@conference.short_title, booth),
|
||||||
method: :patch, id: "reject_booth_#{booth.id}"
|
method: :patch, id: "reject_booth_#{booth.id}",
|
||||||
|
data: (@conference.email_settings.send_on_booths_rejection ? { confirm: 'By rejecting this booth, an email will be sent informing the submitter about the rejection. You may change the state to \'To reject\' until you are completely sure.'} : nil)
|
||||||
|
|
||||||
- if booth.transition_possible? :to_reject
|
- if booth.transition_possible? :to_reject
|
||||||
%li= link_to 'To reject booth',
|
%li= link_to 'To reject booth',
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
%p.text-muted
|
%p.text-muted
|
||||||
All the booth requests
|
All the booth requests
|
||||||
|
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
%h4
|
%h4
|
||||||
|
|
@ -33,46 +32,45 @@
|
||||||
(
|
(
|
||||||
= link_to "#{@conference.booth_limit} booths", edit_admin_conference_path(@conference.short_title)
|
= link_to "#{@conference.booth_limit} booths", edit_admin_conference_path(@conference.short_title)
|
||||||
)
|
)
|
||||||
.margin-booth-table
|
%table.table.table-striped.table-bordered.table-hover.datatable
|
||||||
%table.table.table-striped.table-bordered.table-hover.datatable
|
%thead
|
||||||
%thead
|
%th
|
||||||
%th
|
%b ID
|
||||||
%b ID
|
%th
|
||||||
%th
|
%b Logo
|
||||||
%b Logo
|
%th
|
||||||
%th
|
%b Title
|
||||||
%b Title
|
%th
|
||||||
%th
|
%b Submitter
|
||||||
%b Submitter
|
%th
|
||||||
%th
|
%b Responsibles
|
||||||
%b Responsibles
|
%th
|
||||||
%th
|
%b State
|
||||||
%b State
|
%th
|
||||||
%th
|
%b Actions
|
||||||
%b Actions
|
- @booths.each do |booth|
|
||||||
- @booths.each do |booth|
|
%tr
|
||||||
%tr
|
%td
|
||||||
|
= booth.id
|
||||||
|
%td
|
||||||
|
- if booth.logo_link
|
||||||
|
= image_tag(booth.picture.thumb.url, width: '20%')
|
||||||
|
%td
|
||||||
|
= link_to booth.title, admin_conference_booth_path(@conference.short_title, booth)
|
||||||
|
%td
|
||||||
|
= link_to booth.submitter.name, admin_user_path(booth.submitter) if booth.submitter
|
||||||
|
%td
|
||||||
|
.responsibles
|
||||||
|
- booth.responsibles.each_with_index do |responsible, i|
|
||||||
|
= link_to responsible.name, admin_user_path(responsible)
|
||||||
|
= ", " unless i == booth.responsibles.length - 1
|
||||||
|
%td
|
||||||
|
.btn-group
|
||||||
|
%button{ type: 'button', class: 'btn btn-link dropdown-toggle', 'data-toggle' => 'dropdown' }
|
||||||
|
= booth.state.humanize
|
||||||
|
%span.caret
|
||||||
|
%ul.dropdown-menu{ role: 'menu' }
|
||||||
|
= render 'change_state_dropdown', booth: booth
|
||||||
%td
|
%td
|
||||||
= booth.id
|
= link_to 'Edit', edit_admin_conference_booth_path(@conference.short_title, booth.id),
|
||||||
%td
|
class: 'btn btn-primary'
|
||||||
- if booth.logo_link
|
|
||||||
= image_tag(booth.picture.thumb.url, width: '20%')
|
|
||||||
%td
|
|
||||||
= link_to booth.title, admin_conference_booth_path(@conference.short_title, booth)
|
|
||||||
%td
|
|
||||||
= link_to booth.submitter.name, admin_user_path(booth.submitter) if booth.submitter
|
|
||||||
%td
|
|
||||||
.responsibles
|
|
||||||
- booth.responsibles.each_with_index do |responsible, i|
|
|
||||||
= link_to responsible.name, admin_user_path(responsible)
|
|
||||||
= ", " unless i == booth.responsibles.length - 1
|
|
||||||
%td
|
|
||||||
.btn-group
|
|
||||||
%button{ type: 'button', class: 'btn btn-link dropdown-toggle', 'data-toggle' => 'dropdown' }
|
|
||||||
= booth.state.humanize
|
|
||||||
%span.caret
|
|
||||||
%ul.dropdown-menu{ role: 'menu' }
|
|
||||||
= render 'change_state_dropdown', booth: booth
|
|
||||||
%td
|
|
||||||
= link_to 'Edit', edit_admin_conference_booth_path(@conference.short_title, booth.id),
|
|
||||||
class: 'btn btn-primary'
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
%a.btn.btn-link.control_label.load_template{ 'data-subject-input-id' => 'email_settings_booths_acceptance_subject',
|
%a.btn.btn-link.control_label.load_template{ 'data-subject-input-id' => 'email_settings_booths_acceptance_subject',
|
||||||
'data-subject-text' => 'Your booth has been accepted!',
|
'data-subject-text' => 'Your booth has been accepted!',
|
||||||
'data-body-input-id' => 'email_settings_booths_acceptance_body',
|
'data-body-input-id' => 'email_settings_booths_acceptance_body',
|
||||||
'data-body-text' => "Dear {name},\n\nWe are really pleased to inform you that your booth request {booth_title} has been accepted for the conference {conference}.\nPlease click the confirm button to let us know you can make it as soon as possible!\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team"} Load Template
|
'data-body-text' => "Dear {name},\n\nWe are pleased to inform you that your booth request {booth_title} has been accepted for the conference {conference}.\nPlease click the confirm button to let us know you can make it as soon as possible!\n\nFeel free to contact us with any questions or concerns.\n\nWe are looking forward to seeing you there.\n\nBest wishes\n\n{conference} Team"} Load Template
|
||||||
%a.btn.btn-link.control_label.template_help_link{ 'data-name' => 'booth_acceptance_help' } Show help
|
%a.btn.btn-link.control_label.template_help_link{ 'data-name' => 'booth_acceptance_help' } Show help
|
||||||
= render partial: 'help', locals: {id: 'booth_acceptance_help', show_event_variables: false}
|
= render partial: 'help', locals: {id: 'booth_acceptance_help', show_event_variables: false}
|
||||||
= f.input :send_on_booths_rejection
|
= f.input :send_on_booths_rejection
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue