Sha256: e8e61bb99e83e60c0f31f5fc2aa79c3a6d1cb210ac4dfc8dfa8bf3e0576ac16e

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 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 VersionsHelper
  # Parse the changes for each version
  #----------------------------------------------------------------------------
  def parse_version(attr_name, change)
    if attr_name =~ /\Acf_/ && (field = CustomField.where(name: attr_name).first).present?
      label = field.label
      first = field.render(change.first)
      second = field.render(change.second)
    else
      label = t(attr_name)
      first = change.first
      second = change.second
    end

    # Find account and link to it.
    if attr_name == 'account_id'
      if first.present? && (account = Account.find_by_id(first))
        first = link_to(h(account.name), account_path(account))
      end
      if second.present? && (account = Account.find_by_id(second))
        second = link_to(h(account.name), account_path(account))
      end
    end

    [label, first, second]
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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