Module: Wallaby::StylingHelper

Included in:
CoreHelper
Defined in:
lib/helpers/wallaby/styling_helper.rb

Instance Method Summary collapse

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, html_options = {}, &block)
  html_options[:class] = Array html_options[:class]
  html_options[:class] << "glyphicon glyphicon-#{ icon_suffix }"

   :i, nil, html_options, &block
end


16
17
18
19
20
21
# File 'lib/helpers/wallaby/styling_helper.rb', line 16

def ilink_to(options = nil, html_options = {})
  icon_suffix = html_options.delete(:icon) || 'info-sign'
  link_to options, html_options 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, html_options = {})
  uuid = random_uuid
  label ||= html_options.delete(:label) ||
            html_options.delete(:icon) ||
            icon('circle-arrow-up')
  link_to(label, 'javascript:;', data: { toggle: 'modal', target: "##{ uuid }" }) +
  (:div, id: uuid, class: 'modal fade', tabindex: -1, role: 'dialog') do
     :div, class: 'modal-dialog modal-lg' do
       :div, class: 'modal-content' do
        (:div, class: 'modal-header') do
          button_tag(type: 'button', class: 'close', data: { dismiss: 'modal' }, aria: { label: 'Close' }) do
             :span, raw('&times;'), aria: { hidden: true }
          end +
          (:h4, title, class: 'modal-title')
        end +
        (: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', html_options = {})
  html_options[:title] = title
  (html_options[:data] ||= {}).merge! toggle: "tooltip", placement: "top"

  icon icon_suffix, html_options
end

#muted(content) ⇒ Object



54
55
56
# File 'lib/helpers/wallaby/styling_helper.rb', line 54

def muted(content)
   :i, "<#{ content }>", class: 'text-muted'
end

#naObject



50
51
52
# File 'lib/helpers/wallaby/styling_helper.rb', line 50

def na
  muted 'n/a'
end

#nullObject



46
47
48
# File 'lib/helpers/wallaby/styling_helper.rb', line 46

def null
  muted 'null'
end