Module: ActivityNotification::ViewHelpers

Defined in:
lib/activity_notification/helpers/view_helpers.rb

Overview

Provides a shortcut from views to the rendering method. Module extending ActionView::Base and adding ‘render_notification` helper.

Instance Method Summary collapse

Instance Method Details

#move_notification_path_for(notification, params = {}) ⇒ String

TODO:

Needs any other better implementation

TODO:

Must handle devise namespace

Returns move_notification_path for the target of specified notification

Parameters:

  • notification (Notification)

    Notification instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    move_notification_path for the target



113
114
115
116
117
118
# File 'lib/activity_notification/helpers/view_helpers.rb', line 113

def move_notification_path_for(notification, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("move_#{routing_scope(options)}notification_path", notification, options) :
    send("move_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_path", notification.target, notification, options)
end

#move_notification_url_for(notification, params = {}) ⇒ String

TODO:

Needs any other better implementation

TODO:

Must handle devise namespace

Returns move_notification_url for the target of specified notification

Parameters:

  • notification (Notification)

    Notification instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    move_notification_url for the target



183
184
185
186
187
188
# File 'lib/activity_notification/helpers/view_helpers.rb', line 183

def move_notification_url_for(notification, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("move_#{routing_scope(options)}notification_url", notification, options) :
    send("move_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url", notification.target, notification, options)
end

#notification_path_for(notification, params = {}) ⇒ String

TODO:

Needs any other better implementation

TODO:

Must handle devise namespace

Returns notification_path for the notification

Parameters:

  • notification (Notification)

    Notification instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    notification_path for the notification



99
100
101
102
103
104
# File 'lib/activity_notification/helpers/view_helpers.rb', line 99

def notification_path_for(notification, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("#{routing_scope(options)}notification_path", notification, options) :
    send("#{routing_scope(options)}#{notification.target.to_resource_name}_notification_path", notification.target, notification, options)
end

#notification_url_for(notification, params = {}) ⇒ String

TODO:

Needs any other better implementation

TODO:

Must handle devise namespace

Returns notification_url for the target of specified notification

Parameters:

  • notification (Notification)

    Notification instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    notification_url for the target



169
170
171
172
173
174
# File 'lib/activity_notification/helpers/view_helpers.rb', line 169

def notification_url_for(notification, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("#{routing_scope(options)}notification_url", notification, options) :
    send("#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url", notification.target, notification, options)
end

#notifications_path_for(target, params = {}) ⇒ String

TODO:

Needs any other better implementation

TODO:

Must handle devise namespace

Returns notifications_path for the target

Parameters:

  • target (Object)

    Target instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    notifications_path for the target



85
86
87
88
89
90
# File 'lib/activity_notification/helpers/view_helpers.rb', line 85

def notifications_path_for(target, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("#{routing_scope(options)}notifications_path", options) :
    send("#{routing_scope(options)}#{target.to_resource_name}_notifications_path", target, options)
end

#notifications_url_for(target, params = {}) ⇒ String

TODO:

Needs any other better implementation

TODO:

Must handle devise namespace

Returns notifications_url for the target

Parameters:

  • target (Object)

    Target instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    notifications_url for the target



155
156
157
158
159
160
# File 'lib/activity_notification/helpers/view_helpers.rb', line 155

def notifications_url_for(target, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("#{routing_scope(options)}notifications_url", options) :
    send("#{routing_scope(options)}#{target.to_resource_name}_notifications_url", target, options)
end

#open_all_notifications_path_for(target, params = {}) ⇒ String

TODO:

Needs any other better implementation

TODO:

Must handle devise namespace

Returns open_all_notifications_path for the target

Parameters:

  • target (Object)

    Target instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    open_all_notifications_path for the target



141
142
143
144
145
146
# File 'lib/activity_notification/helpers/view_helpers.rb', line 141

def open_all_notifications_path_for(target, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("open_all_#{routing_scope(options)}notifications_path", options) :
    send("open_all_#{routing_scope(options)}#{target.to_resource_name}_notifications_path", target, options)
end

#open_all_notifications_url_for(target, params = {}) ⇒ String

TODO:

Needs any other better implementation

TODO:

Must handle devise namespace

Returns open_all_notifications_url for the target of specified notification

Parameters:

  • target (Target)

    Target instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    open_all_notifications_url for the target



211
212
213
214
215
216
# File 'lib/activity_notification/helpers/view_helpers.rb', line 211

def open_all_notifications_url_for(target, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("open_all_#{routing_scope(options)}notifications_url", options) :
    send("open_all_#{routing_scope(options)}#{target.to_resource_name}_notifications_url", target, options)
end

#open_notification_path_for(notification, params = {}) ⇒ String

TODO:

Needs any other better implementation

TODO:

Must handle devise namespace

Returns open_notification_path for the target of specified notification

Parameters:

  • notification (Notification)

    Notification instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    open_notification_path for the target



127
128
129
130
131
132
# File 'lib/activity_notification/helpers/view_helpers.rb', line 127

def open_notification_path_for(notification, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("open_#{routing_scope(options)}notification_path", notification, options) :
    send("open_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_path", notification.target, notification, options)
end

#open_notification_url_for(notification, params = {}) ⇒ String

TODO:

Needs any other better implementation

TODO:

Must handle devise namespace

Returns open_notification_url for the target of specified notification

Parameters:

  • notification (Notification)

    Notification instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    open_notification_url for the target



197
198
199
200
201
202
# File 'lib/activity_notification/helpers/view_helpers.rb', line 197

def open_notification_url_for(notification, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("open_#{routing_scope(options)}notification_url", notification, options) :
    send("open_#{routing_scope(options)}#{notification.target.to_resource_name}_notification_url", notification.target, notification, options)
end

#render_notification(notifications, options = {}) ⇒ String Also known as: render_notifications

View helper for rendering an notification, calls Notification#render internally.

Parameters:

  • notifications (Notification, Array<Notificaion>)

    Array or single instance of notifications to render

  • options (Hash) (defaults to: {})

    Options for rendering notifications

Options Hash (options):

  • :target (String, Symbol) — default: nil

    Target type name to find template or i18n text

  • :partial (String) — default: "activity_notification/notifications/#{target}", controller.target_view_path, 'activity_notification/notifications/default'

    Partial template name

  • :partial_root (String) — default: self.key.gsub('.', '/')

    Root path of partial template

  • :layout (String) — default: nil

    Layout template name

  • :layout_root (String) — default: 'layouts'

    Root path of layout template

  • :fallback (String, Symbol) — default: nil

    Fallback template to use when MissingTemplate is raised. Set :text to use i18n text as fallback.

  • :assigns (Hash) — default: nil

    Parameters to be set as assigns

  • :locals (Hash) — default: nil

    Parameters to be set as locals

Returns:

  • (String)

    Rendered view or text as string

See Also:

  • Notification#render


19
20
21
22
23
24
25
26
# File 'lib/activity_notification/helpers/view_helpers.rb', line 19

def render_notification(notifications, options = {})
  if notifications.is_a? ActivityNotification::Notification
    notifications.render self, options
  elsif notifications.respond_to?(:map)
    return nil if (notifications.respond_to?(:empty?) ? notifications.empty? : notifications.to_a.empty?)
    notifications.map {|notification| notification.render self, options.dup }.join.html_safe
  end
end

#render_notification_of(target, options = {}) ⇒ String Also known as: render_notifications_of

TODO:

Show examples

View helper for rendering on notifications of the target to embedded partial template. It calls Notification#render to prepare view as ‘content_for :index_content` and render partial index calling `yield :index_content` internally. For example, this method can be used for notification index as dropdown in common header.

Parameters:

  • target (Object)

    Target instance of the rendering notifications

  • options (Hash) (defaults to: {})

    Options for rendering notifications

Options Hash (options):

  • :target (String, Symbol) — default: nil

    Target type name to find template or i18n text

  • :index_content (Symbol) — default: :with_attributes

    Option method to load target notification index, [:simple, :unopened_simple, :opened_simple, :with_attributes, :unopened_with_attributes, :opened_with_attributes, :none] are available

  • :partial_root (String) — default: "activity_notification/notifications/#{target.to_resources_name}", 'activity_notification/notifications/default'

    Root path of partial template

  • :notification_partial (String) — default: "activity_notification/notifications/#{target.to_resources_name}", controller.target_view_path, 'activity_notification/notifications/default'

    Partial template name of the notification index content

  • :layout_root (String) — default: 'layouts'

    Root path of layout template

  • :notification_layout (String) — default: nil

    Layout template name of the notification index content

  • :fallback (String) — default: nil

    Fallback template to use when MissingTemplate is raised. Set :text to use i18n text as fallback.

  • :partial (String) — default: 'index'

    Partial template name of the partial index

  • :routing_scope (String) — default: nil

    Routing scope for notification and subscription routes

  • :devise_default_routes (Boolean) — default: false

    If links in default views will be handles as devise default routes

  • :layout (String) — default: nil

    Layout template name of the partial index

  • :limit (Integer) — default: nil

    Limit to query for notifications

  • :reverse (Boolean) — default: false

    If notification index will be ordered as earliest first

  • :with_group_members (Boolean) — default: false

    If notification index will include group members

  • :filtered_by_type (String) — default: nil

    Notifiable type for filter

  • :filtered_by_group (Object) — default: nil

    Group instance for filter

  • :filtered_by_group_type (String) — default: nil

    Group type for filter, valid with :filtered_by_group_id

  • :filtered_by_group_id (String) — default: nil

    Group instance id for filter, valid with :filtered_by_group_type

  • :filtered_by_key (String) — default: nil

    Key of the notification for filter

  • :later_than (String) — default: nil

    ISO 8601 format time to filter notification index later than specified time

  • :earlier_than (String) — default: nil

    ISO 8601 format time to filter notification index earlier than specified time

  • :custom_filter (Array) — default: nil

    Custom notification filter (e.g. [“created_at >= ?”, time.hour.ago])

Returns:

  • (String)

    Rendered view or text as string



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/activity_notification/helpers/view_helpers.rb', line 60

def render_notification_of(target, options = {})
  return unless target.is_a? ActivityNotification::Target

  # Prepare content for notifications index
  notification_options = options.merge( target: target.to_resources_name,
                                        partial: options[:notification_partial],
                                        layout: options[:notification_layout] )
  index_options = options.slice( :limit, :reverse, :with_group_members, :as_latest_group_member,
                                 :filtered_by_group, :filtered_by_group_type, :filtered_by_group_id,
                                 :filtered_by_type, :filtered_by_key, :custom_filter )
  notification_index = load_notification_index(target, options[:index_content], index_options)
  prepare_content_for(target, notification_index, notification_options)

  # Render partial index
  render_partial_index(target, options)
end

#subscribe_subscription_path_for(subscription, params = {}) ⇒ String Also known as: subscribe_path_for

TODO:

Needs any other better implementation

Returns subscribe_subscription_path for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_path for the subscription



250
251
252
253
254
255
# File 'lib/activity_notification/helpers/view_helpers.rb', line 250

def subscribe_subscription_path_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("subscribe_#{routing_scope(options)}subscription_path", subscription, options) :
    send("subscribe_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path", subscription.target, subscription, options)
end

#subscribe_subscription_url_for(subscription, params = {}) ⇒ String Also known as: subscribe_url_for

TODO:

Needs any other better implementation

Returns subscribe_subscription_url for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_url for the subscription



360
361
362
363
364
365
# File 'lib/activity_notification/helpers/view_helpers.rb', line 360

def subscribe_subscription_url_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("subscribe_#{routing_scope(options)}subscription_url", subscription, options) :
    send("subscribe_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url", subscription.target, subscription, options)
end

#subscribe_to_email_subscription_path_for(subscription, params = {}) ⇒ String Also known as: subscribe_to_email_path_for

TODO:

Needs any other better implementation

Returns subscribe_to_email_subscription_path for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_path for the subscription



278
279
280
281
282
283
# File 'lib/activity_notification/helpers/view_helpers.rb', line 278

def subscribe_to_email_subscription_path_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("subscribe_to_email_#{routing_scope(options)}subscription_path", subscription, options) :
    send("subscribe_to_email_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path", subscription.target, subscription, options)
end

#subscribe_to_email_subscription_url_for(subscription, params = {}) ⇒ String Also known as: subscribe_to_email_url_for

TODO:

Needs any other better implementation

Returns subscribe_to_email_subscription_url for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_url for the subscription



388
389
390
391
392
393
# File 'lib/activity_notification/helpers/view_helpers.rb', line 388

def subscribe_to_email_subscription_url_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("subscribe_to_email_#{routing_scope(options)}subscription_url", subscription, options) :
    send("subscribe_to_email_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url", subscription.target, subscription, options)
end

#subscribe_to_optional_target_subscription_path_for(subscription, params = {}) ⇒ String Also known as: subscribe_to_optional_target_path_for

TODO:

Needs any other better implementation

Returns subscribe_to_optional_target_subscription_path for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_path for the subscription



306
307
308
309
310
311
# File 'lib/activity_notification/helpers/view_helpers.rb', line 306

def subscribe_to_optional_target_subscription_path_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("subscribe_to_optional_target_#{routing_scope(options)}subscription_path", subscription, options) :
    send("subscribe_to_optional_target_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path", subscription.target, subscription, options)
end

#subscribe_to_optional_target_subscription_url_for(subscription, params = {}) ⇒ String Also known as: subscribe_to_optional_target_url_for

TODO:

Needs any other better implementation

Returns subscribe_to_optional_target_subscription_url for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_url for the subscription



416
417
418
419
420
421
# File 'lib/activity_notification/helpers/view_helpers.rb', line 416

def subscribe_to_optional_target_subscription_url_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("subscribe_to_optional_target_#{routing_scope(options)}subscription_url", subscription, options) :
    send("subscribe_to_optional_target_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url", subscription.target, subscription, options)
end

#subscription_path_for(subscription, params = {}) ⇒ String

TODO:

Needs any other better implementation

Returns subscription_path for the subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_path for the subscription



237
238
239
240
241
242
# File 'lib/activity_notification/helpers/view_helpers.rb', line 237

def subscription_path_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("#{routing_scope(options)}subscription_path", subscription, options) :
    send("#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path", subscription.target, subscription, options)
end

#subscription_url_for(subscription, params = {}) ⇒ String

TODO:

Needs any other better implementation

Returns subscription_url for the subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_url for the subscription



347
348
349
350
351
352
# File 'lib/activity_notification/helpers/view_helpers.rb', line 347

def subscription_url_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("#{routing_scope(options)}subscription_url", subscription, options) :
    send("#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url", subscription.target, subscription, options)
end

#subscriptions_path_for(target, params = {}) ⇒ String

TODO:

Needs any other better implementation

Returns subscriptions_path for the target

Parameters:

  • target (Object)

    Target instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscriptions_path for the target



224
225
226
227
228
229
# File 'lib/activity_notification/helpers/view_helpers.rb', line 224

def subscriptions_path_for(target, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("#{routing_scope(options)}subscriptions_path", options) :
    send("#{routing_scope(options)}#{target.to_resource_name}_subscriptions_path", target, options)
end

#subscriptions_url_for(target, params = {}) ⇒ String

TODO:

Needs any other better implementation

Returns subscriptions_url for the target

Parameters:

  • target (Object)

    Target instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscriptions_url for the target



334
335
336
337
338
339
# File 'lib/activity_notification/helpers/view_helpers.rb', line 334

def subscriptions_url_for(target, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("#{routing_scope(options)}subscriptions_url", options) :
    send("#{routing_scope(options)}#{target.to_resource_name}_subscriptions_url", target, options)
end

#unsubscribe_subscription_path_for(subscription, params = {}) ⇒ String Also known as: unsubscribe_path_for

TODO:

Needs any other better implementation

Returns unsubscribe_subscription_path for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_path for the subscription



264
265
266
267
268
269
# File 'lib/activity_notification/helpers/view_helpers.rb', line 264

def unsubscribe_subscription_path_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("unsubscribe_#{routing_scope(options)}subscription_path", subscription, options) :
    send("unsubscribe_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path", subscription.target, subscription, options)
end

#unsubscribe_subscription_url_for(subscription, params = {}) ⇒ String Also known as: unsubscribe_url_for

TODO:

Needs any other better implementation

Returns unsubscribe_subscription_url for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_url for the subscription



374
375
376
377
378
379
# File 'lib/activity_notification/helpers/view_helpers.rb', line 374

def unsubscribe_subscription_url_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("unsubscribe_#{routing_scope(options)}subscription_url", subscription, options) :
    send("unsubscribe_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url", subscription.target, subscription, options)
end

#unsubscribe_to_email_subscription_path_for(subscription, params = {}) ⇒ String Also known as: unsubscribe_to_email_path_for

TODO:

Needs any other better implementation

Returns unsubscribe_to_email_subscription_path for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_path for the subscription



292
293
294
295
296
297
# File 'lib/activity_notification/helpers/view_helpers.rb', line 292

def unsubscribe_to_email_subscription_path_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("unsubscribe_to_email_#{routing_scope(options)}subscription_path", subscription, options) :
    send("unsubscribe_to_email_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path", subscription.target, subscription, options)
end

#unsubscribe_to_email_subscription_url_for(subscription, params = {}) ⇒ String Also known as: unsubscribe_to_email_url_for

TODO:

Needs any other better implementation

Returns unsubscribe_to_email_subscription_url for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_url for the subscription



402
403
404
405
406
407
# File 'lib/activity_notification/helpers/view_helpers.rb', line 402

def unsubscribe_to_email_subscription_url_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("unsubscribe_to_email_#{routing_scope(options)}subscription_url", subscription, options) :
    send("unsubscribe_to_email_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url", subscription.target, subscription, options)
end

#unsubscribe_to_optional_target_subscription_path_for(subscription, params = {}) ⇒ String Also known as: unsubscribe_to_optional_target_path_for

TODO:

Needs any other better implementation

Returns unsubscribe_to_optional_target_subscription_path for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_path for the subscription



320
321
322
323
324
325
# File 'lib/activity_notification/helpers/view_helpers.rb', line 320

def unsubscribe_to_optional_target_subscription_path_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("unsubscribe_to_optional_target_#{routing_scope(options)}subscription_path", subscription, options) :
    send("unsubscribe_to_optional_target_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path", subscription.target, subscription, options)
end

#unsubscribe_to_optional_target_subscription_url_for(subscription, params = {}) ⇒ String Also known as: unsubscribe_to_optional_target_url_for

TODO:

Needs any other better implementation

Returns unsubscribe_to_optional_target_subscription_url for the target of specified subscription

Parameters:

  • subscription (Subscription)

    Subscription instance

  • params (Hash) (defaults to: {})

    Request parameters

Returns:

  • (String)

    subscription_url for the subscription



430
431
432
433
434
435
# File 'lib/activity_notification/helpers/view_helpers.rb', line 430

def unsubscribe_to_optional_target_subscription_url_for(subscription, params = {})
  options = params.dup
  options.delete(:devise_default_routes) ?
    send("unsubscribe_to_optional_target_#{routing_scope(options)}subscription_url", subscription, options) :
    send("unsubscribe_to_optional_target_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url", subscription.target, subscription, options)
end