Class: Interview::Actionbar

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

Instance Attribute Summary collapse

Attributes inherited from Control

#parent

Instance Method Summary collapse

Methods inherited from Control

#ancestors, #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

#iconObject

Returns the value of attribute icon.



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

def icon
  @icon
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#build(b) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/interview/controls/actionbar.rb', line 6

def build(b)
  title = @title || find_attribute(:title)
  icon = @icon
  if icon == :polymorphic
    object = find_attribute! :object
    icon = object.icon
  end
  
  b.section html_class: 'clearfix' do
    if block_given?
      b.section style: 'ul', html_class: 'list-inline pull-right' do
        b.meta_class pointer: self do
          yield
        end
      end
    end
    if title
      b.section style: 'p', html_class: 'h3' do
        if icon
          b.section style: 'span', html_class: icon
          b.space
        end
        b.text text: title
      end
    end
  end
end

#build_child(b, control, &block) ⇒ Object



34
35
36
37
38
# File 'lib/interview/controls/actionbar.rb', line 34

def build_child(b, control, &block)
  b.section style: 'li' do
    super
  end
end