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
Constant Summary
Constants included from CommonController
CommonController::DEFAULT_VIEW_DIRECTORY
Instance Method Summary collapse
-
#destroy(params) ⇒ Responce
Deletes a notification.
-
#index(params) ⇒ Responce
Shows notification index of the target.
-
#open(params) ⇒ Responce
Moves to notifiable_path of the notification.
-
#open(params) ⇒ Responce
Opens a notification.
-
#open_all(params) ⇒ Responce
Opens all notifications of the target.
-
#show(params) ⇒ Responce
Shows a notification.
-
#target_view_path ⇒ Object
Returns path of the target view templates.
Methods included from StoreController
#store_controller_for_activity_notification
Instance Method Details
#destroy(params) ⇒ Responce
Deletes a notification.
DELETE /:target_type/:target_id/notifications/:id
74 75 76 77 |
# File 'app/controllers/activity_notification/notifications_controller.rb', line 74 def destroy @notification.destroy return_back_or_ajax end |
#index(params) ⇒ Responce
Shows notification index of the target.
GET /:target_type/:target_id/notifications
24 25 26 27 28 29 30 31 |
# File 'app/controllers/activity_notification/notifications_controller.rb', line 24 def index load_index if params[:reload].to_s.to_boolean(true) respond_to do |format| format.html # index.html.erb format.json { render json: @notifications.to_json(include: [:target, :notifiable, :group]) } end end |
#open(params) ⇒ Responce
Moves to notifiable_path of the notification.
GET /:target_type/:target_id/notifications/:id/move
109 110 111 112 |
# File 'app/controllers/activity_notification/notifications_controller.rb', line 109 def move @notification.open! if params[:open].to_s.to_boolean(false) redirect_to @notification.notifiable_path end |
#open(params) ⇒ Responce
Opens a notification.
POST /:target_type/:target_id/notifications/:id/open
91 92 93 94 95 96 97 |
# File 'app/controllers/activity_notification/notifications_controller.rb', line 91 def open with_members = !(params[:with_group_members].to_s.to_boolean(false) || params[:without_grouping].to_s.to_boolean(false)) @notification.open!(with_members: with_members) params[:move].to_s.to_boolean(false) ? move : return_back_or_ajax end |
#open_all(params) ⇒ Responce
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 @target.open_all_notifications(params) return_back_or_ajax end |
#show(params) ⇒ Responce
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 |