Sha256: d3a26799e3b0f4ab95bbda0bf804d82c5f2a74cfef7634a202c217d1e1bac1dc

Contents?: true

Size: 1015 Bytes

Versions: 2

Compression:

Stored size: 1015 Bytes

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 TagsHelper

  # Generate tag links for use on asset index pages.
  #----------------------------------------------------------------------------
  def tags_for_index(model)
    model.tag_list.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('#{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

2 entries across 2 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 app/helpers/tags_helper.rb
fat_free_crm-0.13.5 app/helpers/tags_helper.rb