Module: EffectiveMailchimpHelper

Defined in:
app/helpers/effective_mailchimp_helper.rb

Instance Method Summary collapse

Instance Method Details

#mailchimp_list_member_interests_collection(mailchimp_interests) ⇒ Object



3
4
5
6
7
8
9
10
# File 'app/helpers/effective_mailchimp_helper.rb', line 3

def mailchimp_list_member_interests_collection(mailchimp_interests)
  interests = mailchimp_interests.select { |interest| interest.can_subscribe? || interest.force_subscribe? }

  interests.map do |interest| 
    label = (interest.force_subscribe? ? (interest.to_s + ' ' + (:small, 'required', class: 'text-hint')) : interest.to_s).html_safe
    [label, interest.mailchimp_id, disabled: (interest.force_subscribe || !interest.can_subscribe?)]
  end
end