Implement a way for admins to send notifications
This commit is contained in:
parent
cf815695b7
commit
cb9a04cbe7
|
@ -34,6 +34,15 @@ module Management
|
|||
@suggestion.save
|
||||
end
|
||||
|
||||
def send_acceptance_notifications
|
||||
@suggestions = Conference.current.events.approved.where acceptance_notification_sent_at: nil
|
||||
if @suggestions.all?(&:send_acceptance_notification!)
|
||||
head :no_content
|
||||
else
|
||||
head :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def state_params
|
||||
|
|
|
@ -16,3 +16,7 @@
|
|||
th.actions
|
||||
tbody
|
||||
= render partial: 'suggestion_group', collection: @suggestion_groups
|
||||
.panel-footer
|
||||
.pull-right
|
||||
= link_to 'Изпрати нотификации на одобрените', send_acceptance_notifications_management_events_path, remote: true, method: :post, data: {confirm: 'Сигурни ли сте'}, class: %w{btn btn-danger}
|
||||
.clearfix
|
||||
|
|
|
@ -32,6 +32,7 @@ Rails.application.routes.draw do
|
|||
get 'rejected'
|
||||
get 'undecided'
|
||||
get 'backup'
|
||||
post 'send_acceptance_notifications'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue