Sha256: c4f077f16d047e5e9efc046a9d2668862f3c1792fbbd9c21d239fbab7f5188c0

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

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

  def display_campaign_code(val)
    val || 'n/a'
  end

  def display_campaign_type(val)
    val[/(.*)Campaign/, 1]
  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').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 = [
      ['All Statuses', nil],
      ['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

5 entries across 5 versions & 1 rubygems

Version Path
e9_crm-0.1.8 app/helpers/e9_crm/campaigns_helper.rb
e9_crm-0.1.7 app/helpers/e9_crm/campaigns_helper.rb
e9_crm-0.1.6 app/helpers/e9_crm/campaigns_helper.rb
e9_crm-0.1.5 app/helpers/e9_crm/campaigns_helper.rb
e9_crm-0.1.4 app/helpers/e9_crm/campaigns_helper.rb