Sha256: edae1f6ca3ff1e97c1fd63ac3e4a16545154fb167ca96051bc5f51cabe159e81

Contents?: true

Size: 943 Bytes

Versions: 1

Compression:

Stored size: 943 Bytes

Contents

module MailyHerald
  module Webui
    module SubscribersHelper
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maily_herald-webui-0.8.0 app/helpers/maily_herald/webui/subscribers_helper.rb