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.
10 11 12 |
# File 'app/helpers/campaigns_helper.rb', line 10 def campaign_status_checkbox(status, count) entity_filter_checkbox(:status, status, count) end |
#campaign_summary(campaign) ⇒ Object
Quick campaign summary for RSS/ATOM feeds.
30 31 32 33 34 |
# File 'app/helpers/campaigns_helper.rb', line 30 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(' ').gsub("\n", '') end |
#performance(actual, target) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/campaigns_helper.rb', line 15 def performance(actual, target) if target.to_i > 0 && actual.to_i > 0 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 |