Module: E9Crm::CampaignsHelper

Defined in:
app/helpers/e9_crm/campaigns_helper.rb

Instance Method Summary collapse

Instance Method Details

#campaign_active_select_optionsObject



35
36
37
38
39
40
41
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 35

def campaign_active_select_options
  options = [
    ['Active',     true],
    ['Inactive',   false]
  ]
  options_for_select(options)
end

#campaign_date_select_optionsObject



31
32
33
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 31

def campaign_date_select_options
  ''
end

#campaign_group_select_optionsObject



25
26
27
28
29
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 25

def campaign_group_select_options
  options = CampaignGroup.select('name, id').ordered.all.map {|c| [c.name, c.id] }
  options.unshift(['All Groups', nil])
  options_for_select(options)
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 campaign_type_select_options(with_all_option = true)
  options = %w( advertising affiliate email sales ).map {|t| [t.titleize, t] }
  options.unshift(['All Types', nil]) if with_all_option
  options_for_select(options)
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

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_moneyObject



6
7
8
# File 'app/helpers/e9_crm/campaigns_helper.rb', line 6

def no_money
  @_no_money ||= Money.new(0)
end