Module: Wallaby::StylingHelper
- Included in:
- BaseHelper
- Defined in:
- lib/helpers/wallaby/styling_helper.rb
Overview
Styling helper
Instance Method Summary collapse
-
#fa_icon(icon_suffix, html_options = {}, &block) ⇒ String
Shortcut for fontawesome icons.
-
#html_classes(string_or_array) ⇒ Hash
Shortcut to build up the html options as keyword arguments.
-
#imodal(title, body, html_options = {}) ⇒ String
Build up modal.
-
#itooltip(title, icon_suffix = 'info-circle', html_options = {}) ⇒ String
Build up tooltip.
-
#muted(text_content) ⇒ String
Grey text.
-
#na ⇒ String
Grey N/A.
-
#null ⇒ String
Grey null.
Instance Method Details
#fa_icon(icon_suffix, html_options = {}, &block) ⇒ String
Shortcut for fontawesome icons
15 16 17 18 19 20 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 15 def fa_icon(icon_suffix, = {}, &block) [:class] = Array [:class] [:class] << "fa fa-#{icon_suffix}" content_tag :i, nil, , &block end |
#html_classes(string_or_array) ⇒ Hash
Shortcut to build up the html options as keyword arguments
7 8 9 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 7 def html_classes(string_or_array) { html_options: { class: string_or_array } } end |
#imodal(title, body, html_options = {}) ⇒ String
Build up modal
39 40 41 42 43 44 45 46 47 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 39 def imodal(title, body, = {}) label ||= .delete(:label) \ || .delete(:icon) || fa_icon('clone') content_tag :span, class: 'modaler' do concat link_to(label, '#', data: { target: '#imodal', toggle: 'modal' }) concat content_tag(:span, title, class: 'modaler__title') concat content_tag(:span, body, class: 'modaler__body') end end |
#itooltip(title, icon_suffix = 'info-circle', html_options = {}) ⇒ String
Build up tooltip
27 28 29 30 31 32 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 27 def itooltip(title, icon_suffix = 'info-circle', = {}) [:title] = title ([:data] ||= {}).merge! toggle: 'tooltip', placement: 'top' fa_icon icon_suffix, end |
#muted(text_content) ⇒ String
Grey text
62 63 64 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 62 def muted(text_content) content_tag :i, "<#{text_content}>", class: 'text-muted' end |
#na ⇒ String
Returns grey N/A.
55 56 57 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 55 def na muted 'n/a' end |
#null ⇒ String
Returns grey null.
50 51 52 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 50 def null muted 'null' end |