Module: Refinery::TagHelper
- Defined in:
- app/helpers/refinery/tag_helper.rb
Instance Method Summary collapse
- #action_icon(action, url, title, options = {}) ⇒ Object
- #action_icon_label(action, url, title, options = {}, label = true) ⇒ Object
- #action_label(action, url, title, options = {}) ⇒ Object
-
#locale_text_icon(text) ⇒ Object
this stacks the text onto the locale icon (actually a comment balloon).
-
#refinery_help_tag(title = 'Tip') ⇒ Object
Remember to wrap your block with <span class=‘label_with_help’></span> if you’re using a label next to the help tag.
-
#refinery_icon_tag(filename, options = {}) ⇒ Object
This is just a quick wrapper to render an image tag that lives inside refinery/icons.
Instance Method Details
#action_icon(action, url, title, options = {}) ⇒ Object
20 21 22 |
# File 'app/helpers/refinery/tag_helper.rb', line 20 def action_icon(action, url, title, ={}) action_icon_label(action, url, title, , false) end |
#action_icon_label(action, url, title, options = {}, label = true) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/helpers/refinery/tag_helper.rb', line 28 def action_icon_label(action, url, title, ={}, label = true) # See icons.scss for defined icons/classes [:title] = title [:class].presence ? [:class] << " #{action}_icon " : [:class] = "#{action}_icon" [:class] << ' icon_label' if label case action when :preview [:target] = '_blank' when :delete [:method] = :delete when :reorder_done [:class] << ' hidden' end link_to(label && title || '', url, ) end |
#action_label(action, url, title, options = {}) ⇒ Object
24 25 26 |
# File 'app/helpers/refinery/tag_helper.rb', line 24 def action_label(action, url, title, ={}) action_icon_label(action, url, title, , true) end |
#locale_text_icon(text) ⇒ Object
this stacks the text onto the locale icon (actually a comment balloon)
48 49 50 51 52 |
# File 'app/helpers/refinery/tag_helper.rb', line 48 def locale_text_icon(text) content_tag(:span, class: 'fa-stack') do content_tag(:i, '', class: 'fa fa-comment') << content_tag(:strong, text) end end |
#refinery_help_tag(title = 'Tip') ⇒ Object
Remember to wrap your block with <span class=‘label_with_help’></span> if you’re using a label next to the help tag.
7 8 9 10 |
# File 'app/helpers/refinery/tag_helper.rb', line 7 def refinery_help_tag(title='Tip') title = title.html_safe? ? title : h(title) action_icon(:info, '#', title, {tooltip: title}) end |
#refinery_icon_tag(filename, options = {}) ⇒ Object
This is just a quick wrapper to render an image tag that lives inside refinery/icons. They are all 16x16 so this is the default but is able to be overriden with supplied options.
14 15 16 17 18 |
# File 'app/helpers/refinery/tag_helper.rb', line 14 def refinery_icon_tag(filename, = {}) filename = "#{filename}.png" unless filename.split('.').many? path = image_path "refinery/icons/#{filename}", skip_pipeline: true image_tag path, {:width => 16, :height => 16}.merge() end |