Class: ActivityNotification::NotificationsController
- Inherits:
-
Object
- Object
- ActivityNotification::NotificationsController
- Includes:
- CommonController
- Defined in:
- app/controllers/activity_notification/notifications_controller.rb
Overview
Controller to manage notifications.
Direct Known Subclasses
NotificationsApiController, NotificationsWithDeviseController
Constant Summary
Constants included from CommonController
CommonController::DEFAULT_VIEW_DIRECTORY
Instance Method Summary collapse
-
#destroy(params) ⇒ Response
Deletes a notification.
-
#index(params) ⇒ Response
Shows notification index of the target.
-
#open(params) ⇒ Response
Moves to notifiable_path of the notification.
-
#open(params) ⇒ Response
Opens a notification.
-
#open_all(params) ⇒ Response
Opens all notifications of the target.
-
#show(params) ⇒ Response
Shows a notification.
-
#target_view_path ⇒ Object
Returns path of the target view templates.
Instance Method Details
#destroy(params) ⇒ Response
Deletes a notification.
DELETE /:target_type/:target_id/notifications/:id
73 74 75 76 |
# File 'app/controllers/activity_notification/notifications_controller.rb', line 73 def destroy @notification.destroy return_back_or_ajax end |
#index(params) ⇒ Response
Shows notification index of the target.
GET /:target_type/:target_id/notifications
26 27 28 29 |
# File 'app/controllers/activity_notification/notifications_controller.rb', line 26 def index load_index if params[:reload].to_s.to_boolean(true) end |
#open(params) ⇒ Response
Moves to notifiable_path of the notification.
GET /:target_type/:target_id/notifications/:id/move
108 109 110 111 112 |
# File 'app/controllers/activity_notification/notifications_controller.rb', line 108 def move with_members = !(params[:with_group_members].to_s.to_boolean(false) || params[:without_grouping].to_s.to_boolean(false)) @opened_notifications_count = @notification.open!(with_members: with_members) if params[:open].to_s.to_boolean(false) redirect_to_notifiable_path end |
#open(params) ⇒ Response
Opens a notification.
PUT /:target_type/:target_id/notifications/:id/open
90 91 92 93 94 |
# File 'app/controllers/activity_notification/notifications_controller.rb', line 90 def open with_members = !(params[:with_group_members].to_s.to_boolean(false) || params[:without_grouping].to_s.to_boolean(false)) @opened_notifications_count = @notification.open!(with_members: with_members) params[:move].to_s.to_boolean(false) ? move : return_back_or_ajax end |
#open_all(params) ⇒ Response
Opens all notifications of the target.
POST /:target_type/:target_id/notifications/open_all
48 49 50 51 |
# File 'app/controllers/activity_notification/notifications_controller.rb', line 48 def open_all @opened_notifications = @target.open_all_notifications(params) return_back_or_ajax end |
#show(params) ⇒ Response
Shows a notification.
GET /:target_type/:target_id/notifications/:id
59 60 |
# File 'app/controllers/activity_notification/notifications_controller.rb', line 59 def show end |
#target_view_path ⇒ Object
Returns path of the target view templates. This method has no action routing and needs to be public since it is called from view helper.
116 117 118 |
# File 'app/controllers/activity_notification/notifications_controller.rb', line 116 def target_view_path super end |