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
24 25 26 27 28 29 30 |
# File 'app/helpers/tags_helper.rb', line 24 def (model) content_tag(:ul) do model..each do |tag| concat(content_tag(:li, tag.name)) end end end |
#tags_for_index(model) ⇒ Object
Generate tag links for use on asset index pages.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/tags_helper.rb', line 11 def (model) model..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 |