Module: TagsHelper
- Defined in:
- app/helpers/tags_helper.rb
Overview
Copyright © 2008-2013 Michael Dvorkin and contributors.
Fat Free CRM is freely distributable under the terms of MIT license. See MIT-LICENSE file or www.opensource.org/licenses/mit-license.php
Instance Method Summary collapse
- #tags_for_dashboard(model) ⇒ Object
-
#tags_for_index(model) ⇒ Object
Generate tag links for use on asset index pages.
Instance Method Details
#tags_for_dashboard(model) ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/helpers/tags_helper.rb', line 23 def (model) content_tag(:ul) do model.tag_list.each do |tag| concat(content_tag(:li, tag)) end end.html_safe end |
#tags_for_index(model) ⇒ Object
Generate tag links for use on asset index pages.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/tags_helper.rb', line 10 def (model) model.tag_list.inject([]) do |arr, tag| query = controller.send(:current_query) || "" hashtag = "##{tag}" if query.empty? query = hashtag elsif !query.include?(hashtag) query += " #{hashtag}" end arr << link_to_function(tag, "crm.search_tagged('#{query}', '#{model.class.to_s.tableize}')", :title => tag) end.join(" ").html_safe end |