Sha256: cfc0eb6f0ad7dcf3cce50401dc6a73308547644af14e621446b35181024396f2

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

module E9Crm::CampaignsHelper
  def display_campaign_fee(val)
    Money === val && val || 'n/a'
  end

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

  def display_campaign_code(val)
    val && "?#{E9Crm.query_param}=#{val}" || 'n/a'
  end

  def display_campaign_type(val = '')
    retv = val[/(.*)Campaign/, 1]
    retv == 'No' ? 'No Campaign' : retv
  end

  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

  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

  def campaign_date_select_options
    ''
  end

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

  ##
  # Accommodate for "NoCampaign" campaign in link
  #
  def link_to_edit_campaign(record)
    link_to_edit_resource(record) unless record.is_a?(NoCampaign)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
e9_crm-0.1.17 app/helpers/e9_crm/campaigns_helper.rb
e9_crm-0.1.16 app/helpers/e9_crm/campaigns_helper.rb
e9_crm-0.1.14 app/helpers/e9_crm/campaigns_helper.rb
e9_crm-0.1.13 app/helpers/e9_crm/campaigns_helper.rb
e9_crm-0.1.12 app/helpers/e9_crm/campaigns_helper.rb
e9_crm-0.1.11 app/helpers/e9_crm/campaigns_helper.rb