Sha256: 1dad2f5bbd73bc09276d095b3e391732c050d07a451f2683271b8e8ad630e2b9

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

# 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 TagsHelper
  # Generate tag links for use on asset index pages.
  #----------------------------------------------------------------------------
  def tags_for_index(model)
    model.tags.inject("".html_safe) do |out, tag|
      query = controller.send(:current_query) || ""
      hashtag = "##{tag}"
      if query.empty?
        query = hashtag
      elsif !query.include?(hashtag)
        query += " #{hashtag}"
      end
      out << link_to_function(tag, "crm.search_tagged('#{escape_javascript(query)}', '#{model.class.to_s.tableize}')", title: tag)
    end
  end

  def tags_for_dashboard(model)
    content_tag(:ul) do
      model.tags.each do |tag|
        concat(content_tag(:li, tag.name))
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fat_free_crm-0.22.1 app/helpers/tags_helper.rb
fat_free_crm-0.22.0 app/helpers/tags_helper.rb
fat_free_crm-0.21.0 app/helpers/tags_helper.rb
fat_free_crm-0.20.1 app/helpers/tags_helper.rb
fat_free_crm-0.20.0 app/helpers/tags_helper.rb
fat_free_crm-0.19.2 app/helpers/tags_helper.rb
fat_free_crm-0.19.0 app/helpers/tags_helper.rb
fat_free_crm-0.18.2 app/helpers/tags_helper.rb
fat_free_crm-0.17.3 app/helpers/tags_helper.rb
fat_free_crm-0.18.1 app/helpers/tags_helper.rb