Module: E9Tags::Helper
- Defined in:
- lib/e9_tags/helper.rb
Instance Method Summary collapse
- #humanize_context(*context_and_is_private) ⇒ Object
- #tag_list(resource, highlighted_tag = nil, options = {}) ⇒ Object
- #tag_list_with_context(resource, highlighted_tag = nil, options = {}) ⇒ Object
- #tag_template(object, tag = "__TAG__", context = "__CONTEXT__", u_context = "__UCONTEXT__") ⇒ Object
Instance Method Details
#humanize_context(*context_and_is_private) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/e9_tags/helper.rb', line 12 def humanize_context(*context_and_is_private) context, is_private = context_and_is_private context = E9Tags.unescape_context(context) if is_private && context !~ /#{E9Tags::PRIVATE_TAG_SUFFIX_REGEX}$/ context << E9Tags::PRIVATE_TAG_SUFFIX end context end |
#tag_list(resource, highlighted_tag = nil, options = {}) ⇒ Object
24 25 26 |
# File 'lib/e9_tags/helper.rb', line 24 def tag_list(resource, highlighted_tag = nil, = {}) _tag_list(resource.(), highlighted_tag) if resource.respond_to?(:tags) end |
#tag_list_with_context(resource, highlighted_tag = nil, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/e9_tags/helper.rb', line 28 def tag_list_with_context(resource, highlighted_tag = nil, = {}) if resource.respond_to?(:tagging_contexts) # by default, we don't want to show all tags [:show_all] = false if .blank? content_tag(:div, :class => 'tag-lists') do ''.html_safe.tap do |html| resource.tagging_contexts().each do |context| = resource.tag_list_on(context) next if .blank? str = ''.html_safe str.safe_concat content_tag(:div, "#{humanize_context(E9Tags.unescape_context(context))}:", :class => 'heading') str.safe_concat _tag_list(, highlighted_tag) html.safe_concat content_tag(:div, str.html_safe, :class => 'tag-context-list') end end end end end |
#tag_template(object, tag = "__TAG__", context = "__CONTEXT__", u_context = "__UCONTEXT__") ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/e9_tags/helper.rb', line 3 def tag_template(object, tag = "__TAG__", context = "__CONTEXT__", u_context = "__UCONTEXT__") render('e9_tags/template', { :tag => tag, :context => context, :u_context => u_context, :class_name => object.class.name.underscore }) end |