Class: ActivityNotification::SubscriptionsController
- Inherits:
-
Object
- Object
- ActivityNotification::SubscriptionsController
- Includes:
- CommonController
- Defined in:
- app/controllers/activity_notification/subscriptions_controller.rb
Overview
Controller to manage subscriptions.
Direct Known Subclasses
SubscriptionsApiController, SubscriptionsWithDeviseController
Constant Summary
Constants included from CommonController
CommonController::DEFAULT_VIEW_DIRECTORY
Instance Method Summary collapse
-
#create(params) ⇒ Response
Creates new subscription.
-
#destroy(params) ⇒ Response
Deletes a subscription.
-
#index(params) ⇒ Response
Finds and shows a subscription from specified key.
-
#index(params) ⇒ Response
Shows subscription index of the target.
-
#show(params) ⇒ Response
Shows a subscription.
-
#open(params) ⇒ Response
Updates a subscription to subscribe to notifications.
-
#open(params) ⇒ Response
Updates a subscription to subscribe to the notification email.
-
#open(params) ⇒ Response
Updates a subscription to subscribe to the specified optional target.
-
#open(params) ⇒ Response
Updates a subscription to unsubscribe to the notifications.
-
#open(params) ⇒ Response
Updates a subscription to unsubscribe to the notification email.
-
#open(params) ⇒ Response
Updates a subscription to unsubscribe to the specified optional target.
Instance Method Details
#create(params) ⇒ Response
Creates new subscription.
PUT /:target_type/:target_id/subscriptions
39 40 41 42 |
# File 'app/controllers/activity_notification/subscriptions_controller.rb', line 39 def create @subscription = @target.create_subscription(subscription_params) return_back_or_ajax end |
#destroy(params) ⇒ Response
Deletes a subscription.
DELETE /:target_type/:target_id/subscriptions/:id
76 77 78 79 |
# File 'app/controllers/activity_notification/subscriptions_controller.rb', line 76 def destroy @subscription.destroy return_back_or_ajax end |
#index(params) ⇒ Response
Finds and shows a subscription from specified key.
GET /:target_type/:target_id/subscriptions/find
51 52 53 54 |
# File 'app/controllers/activity_notification/subscriptions_controller.rb', line 51 def find @subscription = @target.find_subscription(params[:key]) @subscription ? redirect_to_subscription_path : render_resource_not_found("Couldn't find subscription with this target and 'key'=#{params[:key]}") end |
#index(params) ⇒ Response
Shows subscription index of the target.
GET /:target_type/:target_id/subscriptions
20 21 22 23 |
# File 'app/controllers/activity_notification/subscriptions_controller.rb', line 20 def index load_index if params[:reload].to_s.to_boolean(true) end |
#show(params) ⇒ Response
Shows a subscription.
GET /:target_type/:target_id/subscriptions/:id
62 63 64 |
# File 'app/controllers/activity_notification/subscriptions_controller.rb', line 62 def show end |
#open(params) ⇒ Response
Updates a subscription to subscribe to notifications.
PUT /:target_type/:target_id/subscriptions/:id/subscribe
93 94 95 96 97 |
# File 'app/controllers/activity_notification/subscriptions_controller.rb', line 93 def subscribe @subscription.subscribe(with_email_subscription: params[:with_email_subscription].to_s.to_boolean(ActivityNotification.config.subscribe_to_email_as_default), with_optional_targets: params[:with_optional_targets].to_s.to_boolean(ActivityNotification.config.subscribe_to_optional_targets_as_default)) return_back_or_ajax end |
#open(params) ⇒ Response
Updates a subscription to subscribe to the notification email.
PUT /:target_type/:target_id/subscriptions/:id/subscribe_email
124 125 126 127 |
# File 'app/controllers/activity_notification/subscriptions_controller.rb', line 124 def subscribe_to_email @subscription.subscribe_to_email return_back_or_ajax end |
#open(params) ⇒ Response
Updates a subscription to subscribe to the specified optional target.
PUT /:target_type/:target_id/subscriptions/:id/subscribe_to_optional_target
155 156 157 158 |
# File 'app/controllers/activity_notification/subscriptions_controller.rb', line 155 def subscribe_to_optional_target @subscription.subscribe_to_optional_target(params[:optional_target_name]) return_back_or_ajax end |
#open(params) ⇒ Response
Updates a subscription to unsubscribe to the notifications.
PUT /:target_type/:target_id/subscriptions/:id/unsubscribe
109 110 111 112 |
# File 'app/controllers/activity_notification/subscriptions_controller.rb', line 109 def unsubscribe @subscription.unsubscribe return_back_or_ajax end |
#open(params) ⇒ Response
Updates a subscription to unsubscribe to the notification email.
PUT /:target_type/:target_id/subscriptions/:id/unsubscribe_email
139 140 141 142 |
# File 'app/controllers/activity_notification/subscriptions_controller.rb', line 139 def unsubscribe_to_email @subscription.unsubscribe_to_email return_back_or_ajax end |
#open(params) ⇒ Response
Updates a subscription to unsubscribe to the specified optional target.
PUT /:target_type/:target_id/subscriptions/:id/unsubscribe_to_optional_target
171 172 173 174 |
# File 'app/controllers/activity_notification/subscriptions_controller.rb', line 171 def unsubscribe_to_optional_target @subscription.unsubscribe_to_optional_target(params[:optional_target_name]) return_back_or_ajax end |