Implement a way for admins to send notifications

This commit is contained in:
Petko Bordjukov 2014-10-12 15:32:23 +03:00
parent cf815695b7
commit cb9a04cbe7
3 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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