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
|
@suggestion.save
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def state_params
|
def state_params
|
||||||
|
|
|
@ -16,3 +16,7 @@
|
||||||
th.actions
|
th.actions
|
||||||
tbody
|
tbody
|
||||||
= render partial: 'suggestion_group', collection: @suggestion_groups
|
= 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 'rejected'
|
||||||
get 'undecided'
|
get 'undecided'
|
||||||
get 'backup'
|
get 'backup'
|
||||||
|
post 'send_acceptance_notifications'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue