From abaf80e5c4832dd926552cb0e7de05f7341457e0 Mon Sep 17 00:00:00 2001 From: Hugo Peixoto Date: Thu, 6 Oct 2022 15:50:38 +0100 Subject: [PATCH] Add notification index page --- app/controllers/notifications_controller.rb | 8 +++- app/views/layouts/application.html.erb | 1 + app/views/notifications/index.html.erb | 53 +++++++++++++++++++++ config/locales/pt.yml | 22 +++++---- config/routes.rb | 2 +- 5 files changed, 76 insertions(+), 10 deletions(-) create mode 100644 app/views/notifications/index.html.erb diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index bfbe148..c3a16f8 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -1,6 +1,12 @@ class NotificationsController < ApplicationController before_action :require_login - before_action :set_notification + 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 diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 5bb562a..4636d6a 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -16,6 +16,7 @@