Sha256: 801f66326be213e8c422d43dd86bb44111baab7255ece2739277332599a6440c

Contents?: true

Size: 1.48 KB

Versions: 9

Compression:

Stored size: 1.48 KB

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module CampaignsHelper
  # Sidebar checkbox control for filtering campaigns by status.
  #----------------------------------------------------------------------------
  def campaign_status_checkbox(status, count)
    entity_filter_checkbox(:status, status, count)
  end

  #----------------------------------------------------------------------------
  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

  # Quick campaign summary for RSS/ATOM feeds.
  #----------------------------------------------------------------------------
  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| strip_tags(str) }.join(' ').delete("\n")
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fat_free_crm-0.15.2 app/helpers/campaigns_helper.rb
fat_free_crm-0.16.4 app/helpers/campaigns_helper.rb
fat_free_crm-0.15.1 app/helpers/campaigns_helper.rb
fat_free_crm-0.16.3 app/helpers/campaigns_helper.rb
fat_free_crm-0.16.2 app/helpers/campaigns_helper.rb
fat_free_crm-0.16.1 app/helpers/campaigns_helper.rb
fat_free_crm-0.16.0 app/helpers/campaigns_helper.rb
fat_free_crm-0.15.0 app/helpers/campaigns_helper.rb
fat_free_crm-0.15.0.beta.2 app/helpers/campaigns_helper.rb