Module: CampaignsHelper
- Defined in:
- app/helpers/campaigns_helper.rb
Overview
Copyright © 2008-2013 Michael Dvorkin and contributors.
Fat Free CRM is freely distributable under the terms of MIT license. See MIT-LICENSE file or www.opensource.org/licenses/mit-license.php
Instance Method Summary collapse
-
#campaign_status_checkbox(status, count) ⇒ Object
Sidebar checkbox control for filtering campaigns by status.
-
#campaign_summary(campaign) ⇒ Object
Quick campaign summary for RSS/ATOM feeds.
-
#performance(actual, target) ⇒ Object
—————————————————————————-.
Instance Method Details
#campaign_status_checkbox(status, count) ⇒ Object
Sidebar checkbox control for filtering campaigns by status.
11 12 13 |
# File 'app/helpers/campaigns_helper.rb', line 11 def campaign_status_checkbox(status, count) entity_filter_checkbox(:status, status, count) end |
#campaign_summary(campaign) ⇒ Object
Quick campaign summary for RSS/ATOM feeds.
31 32 33 34 35 |
# File 'app/helpers/campaigns_helper.rb', line 31 def campaign_summary(campaign) status = render file: "campaigns/_status.html.haml", locals: { campaign: campaign } metrics = render file: "campaigns/_metrics.html.haml", locals: { campaign: campaign } "#{t(campaign.status)}, " + [status, metrics].map { |str| (str) }.join(' ').delete("\n") end |
#performance(actual, target) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/campaigns_helper.rb', line 16 def performance(actual, target) if target.to_i.positive? && actual.to_i.positive? if target > actual n = 100 - actual * 100 / target html = content_tag(:span, "(-#{number_to_percentage(n, precision: 1)})", class: "warn") else n = actual * 100 / target - 100 html = content_tag(:span, "(+#{number_to_percentage(n, precision: 1)})", class: "cool") end end html || "" end |