26 lines
629 B
Ruby
26 lines
629 B
Ruby
class NotificationsController < ApplicationController
|
|
before_action :require_login
|
|
before_action :set_notification, only: [:deliver]
|
|
|
|
# GET /notifications
|
|
def index
|
|
@scheduled = Notification.where(status: 'scheduled').order(to_be_sent_on: :asc)
|
|
@sent = Notification.where(status: 'sent').order(sent_at: :desc)
|
|
end
|
|
|
|
# POST /notifications/1/deliver
|
|
def deliver
|
|
@notification.deliver!
|
|
|
|
redirect_to @notification.member
|
|
end
|
|
|
|
private
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
def set_notification
|
|
@notification = Notification.find(params[:id])
|
|
end
|
|
end
|
|
|
|
|