Class: Interview::Tooltip

Inherits:
Control
  • Object
show all
Defined in:
lib/interview/controls/tooltip.rb

Instance Attribute Summary collapse

Attributes inherited from Control

#parent

Instance Method Summary collapse

Methods inherited from Control

#ancestors, #build_child, #build_with_params, #find_attribute, #find_attribute!, #initialize, #set_attributes, #set_defaults

Constructor Details

This class inherits a constructor from Interview::Control

Instance Attribute Details

#styleObject

Returns the value of attribute style.



4
5
6
# File 'lib/interview/controls/tooltip.rb', line 4

def style
  @style
end

#tooltipObject

Returns the value of attribute tooltip.



4
5
6
# File 'lib/interview/controls/tooltip.rb', line 4

def tooltip
  @tooltip
end

Instance Method Details

#build(b) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/interview/controls/tooltip.rb', line 6

def build(b)
  tooltip = @tooltip || find_attribute(:tooltip)
  if @style == 'box'
    b.section html_class: 'alert alert-info' do
      b.text text: tooltip
    end
  elsif @style == 'popover'
    b.space
    b.link image: 'question-sign', url: '#', html_class: 'tip', html_options: { data: { toogle: 'popover', content: tooltip } }
  else
    b.text text: tooltip, style: 'p', html_class: 'help-block'
  end
end