Module: Wallaby::StylingHelper
- Included in:
- CoreHelper
- Defined in:
- lib/helpers/wallaby/styling_helper.rb
Instance Method Summary collapse
- #icon(icon_suffix, html_options = {}, &block) ⇒ Object
- #ilink_to(options = nil, html_options = {}) ⇒ Object
- #imodal(title, body, html_options = {}) ⇒ Object
- #itooltip(title, icon_suffix = 'info-sign', html_options = {}) ⇒ Object
- #muted(content) ⇒ Object
- #na ⇒ Object
- #null ⇒ Object
Instance Method Details
#icon(icon_suffix, html_options = {}, &block) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 2 def icon(icon_suffix, = {}, &block) [:class] = Array [:class] [:class] << "glyphicon glyphicon-#{ icon_suffix }" content_tag :i, nil, , &block end |
#ilink_to(options = nil, html_options = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 16 def ilink_to( = nil, = {}) icon_suffix = .delete(:icon) || 'info-sign' link_to , do icon icon_suffix end end |
#imodal(title, body, html_options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 23 def imodal(title, body, = {}) uuid = random_uuid label ||= .delete(:label) || .delete(:icon) || icon('circle-arrow-up') link_to(label, 'javascript:;', data: { toggle: 'modal', target: "##{ uuid }" }) + content_tag(:div, id: uuid, class: 'modal fade', tabindex: -1, role: 'dialog') do content_tag :div, class: 'modal-dialog modal-lg' do content_tag :div, class: 'modal-content' do content_tag(:div, class: 'modal-header') do (type: 'button', class: 'close', data: { dismiss: 'modal' }, aria: { label: 'Close' }) do content_tag :span, raw('×'), aria: { hidden: true } end + content_tag(:h4, title, class: 'modal-title') end + content_tag(:div, class: 'modal-body') do body end end end end end |
#itooltip(title, icon_suffix = 'info-sign', html_options = {}) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 9 def itooltip(title, icon_suffix = 'info-sign', = {}) [:title] = title ([:data] ||= {}).merge! toggle: "tooltip", placement: "top" icon icon_suffix, end |
#muted(content) ⇒ Object
54 55 56 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 54 def muted(content) content_tag :i, "<#{ content }>", class: 'text-muted' end |
#na ⇒ Object
50 51 52 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 50 def na muted 'n/a' end |
#null ⇒ Object
46 47 48 |
# File 'lib/helpers/wallaby/styling_helper.rb', line 46 def null muted 'null' end |