Module: E9Crm::CampaignsHelper
- Defined in:
- app/helpers/e9_crm/campaigns_helper.rb
Instance Method Summary collapse
- #campaign_active_select_options ⇒ Object
- #campaign_date_select_options ⇒ Object
- #campaign_group_select_options ⇒ Object
- #campaign_type_select_options(with_all_option = true) ⇒ Object
- #display_campaign_code(val) ⇒ Object
- #display_campaign_fee(val) ⇒ Object
- #display_campaign_type(val = '') ⇒ Object
-
#link_to_edit_campaign(record) ⇒ Object
Accommodate for “NoCampaign” campaign in link.
- #no_money ⇒ Object
Instance Method Details
#campaign_active_select_options ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 35 def = [ ['Active', true], ['Inactive', false] ] () end |
#campaign_date_select_options ⇒ Object
31 32 33 |
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 31 def '' end |
#campaign_group_select_options ⇒ Object
25 26 27 28 29 |
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 25 def = CampaignGroup.select('name, id').ordered.all.map {|c| [c.name, c.id] } .unshift(['All Groups', nil]) () end |
#campaign_type_select_options(with_all_option = true) ⇒ Object
19 20 21 22 23 |
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 19 def (with_all_option = true) = %w( advertising affiliate email sales ).map {|t| [t.titleize, t] } .unshift(['All Types', nil]) if with_all_option () end |
#display_campaign_code(val) ⇒ Object
10 11 12 |
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 10 def display_campaign_code(val) val && "?#{E9Crm.query_param}=#{val}" || 'n/a' end |
#display_campaign_fee(val) ⇒ Object
2 3 4 |
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 2 def display_campaign_fee(val) Money === val && val || 'n/a' end |
#display_campaign_type(val = '') ⇒ Object
14 15 16 17 |
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 14 def display_campaign_type(val = '') retv = val[/(.*)Campaign/, 1] retv == 'No' ? 'No Campaign' : retv end |
#link_to_edit_campaign(record) ⇒ Object
Accommodate for “NoCampaign” campaign in link
46 47 48 |
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 46 def link_to_edit_campaign(record) link_to_edit_resource(record) unless record.is_a?(NoCampaign) end |
#no_money ⇒ Object
6 7 8 |
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 6 def no_money @_no_money ||= Money.new(0) end |