Class: Notifly::NotificationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Notifly::NotificationsController
- Defined in:
- app/controllers/notifly/notifications_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
5 6 7 8 9 10 11 |
# File 'app/controllers/notifly/notifications_controller.rb', line 5 def index @notifications = scoped_notifications @notifications.update_all(seen: true) if params[:mark_as_seen] == 'true' @counter = count_unseen @scope_param = scope_param end |
#read ⇒ Object
13 14 15 16 17 18 |
# File 'app/controllers/notifly/notifications_controller.rb', line 13 def read if params[:first_notification_id].present? and params[:last_notification_id].present? @notifications = notifications_between @notifications.update_all(read: true) end end |
#seen ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/controllers/notifly/notifications_controller.rb', line 25 def seen if params[:first_notification_id].present? and params[:last_notification_id].present? @notifications = notifications_between @notifications.update_all(seen: true) end @counter = count_unseen end |
#toggle_read ⇒ Object
20 21 22 23 |
# File 'app/controllers/notifly/notifications_controller.rb', line 20 def toggle_read @notification = Notifly::Notification.find(params[:notification_id]) @notification.update(read: params[:read] || !@notification.read) end |