Module: CampaignsHelper
- Defined in:
- app/helpers/campaigns_helper.rb
Overview
Fat Free CRM Copyright © 2008-2011 by Michael Dvorkin
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <www.gnu.org/licenses/>.
Instance Method Summary collapse
-
#campaign_status_checbox(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_checbox(status, count) ⇒ Object
Sidebar checkbox control for filtering campaigns by status.
22 23 24 25 26 27 28 29 30 31 |
# File 'app/helpers/campaigns_helper.rb', line 22 def campaign_status_checbox(status, count) checked = (session[:campaigns_filter] ? session[:campaigns_filter].split(",").include?(status.to_s) : count.to_i > 0) onclick = remote_function( :url => { :action => :filter }, :with => h(%Q/"status=" + $$("input[name='status[]']").findAll(function (el) { return el.checked }).pluck("value")/), :loading => "$('loading').show()", :complete => "$('loading').hide()" ) check_box_tag("status[]", status, checked, :id => status, :onclick => onclick) end |
#campaign_summary(campaign) ⇒ Object
Quick campaign summary for RSS/ATOM feeds.
49 50 51 52 53 |
# File 'app/helpers/campaigns_helper.rb', line 49 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
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/helpers/campaigns_helper.rb', line 34 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 |