Module: MailyHerald::Webui::SubscribersHelper

Defined in:
app/helpers/maily_herald/webui/subscribers_helper.rb

Instance Method Summary collapse

Instance Method Details

#subscriber_actions(list, entity) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/maily_herald/webui/subscribers_helper.rb', line 4

def subscriber_actions list, entity
  actions = []
  subscription = list.subscription_for(entity)
  actions << {
    name:      :custom, 
    url:       subscription_path(subscription),
    icon:      "fa fa-book",
    title:     tw("label_subscription")
  } if subscription
  actions << {
    name:      :custom, 
    url:       !list.subscribed?(entity) ? subscribe_to_list_path(list, entity) : unsubscribe_from_list_path(list, entity),
    method:    :post, 
    icon:      !list.subscribed?(entity) ? "fa fa-square-o" : "fa fa-check-square-o", 
    remote:    true, 
    title:     !list.subscribed?(entity) ? tw("subscribers.item.subscribe") : tw("subscribers.item.unsubscribe"),
    confirm:   tw("subscriptions.show.toggle_confirm")
  }
end