Class: Satis::Tab::Component

Inherits:
ApplicationComponent show all
Defined in:
app/components/satis/tab/component.rb

Instance Attribute Summary collapse

Attributes inherited from ApplicationComponent

#original_view_context

Instance Method Summary collapse

Methods inherited from ApplicationComponent

add_helper, #component_name

Constructor Details

#initialize(name = nil, icon: nil, badge: nil, id: nil, tab_menu: nil, menu: nil, padding: false, dirty: false, title: nil, responsive: false, options: nil, selected_tab_index: nil, selected: false, &block) ⇒ Component

Returns a new instance of Component.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/components/satis/tab/component.rb', line 9

def initialize(name = nil,
               icon: nil,
               badge: nil,
               id: nil,
               tab_menu: nil,
               menu: nil,
               padding: false,
               dirty: false,
               title: nil,
               responsive: false,
               options: nil,
               selected_tab_index: nil,
               selected: false,
               &block)
  super

  @name = name
  @icon = icon
  @id = id || name.to_s.underscore
  @badge = badge
  @padding = padding
  @dirty = dirty
  @title = title
  @responsive = responsive
  @selected = selected

  @menu = menu
  # FIXME: Obsolete these
  if tab_menu.present?
    @menu ||= tab_menu
    ActiveSupport::Deprecation.warn('Calling tab with the tab_menu parameter, use menu instead')
  end

  if selected_tab_index.present?
    @selected_tab_index = selected_tab_index # use selected
    ActiveSupport::Deprecation.warn('Calling tab with the selected_tab_index parameter, use selected instead')
  end

  @block = block
end

Instance Attribute Details

#badgeObject (readonly)

Returns the value of attribute badge.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def badge
  @badge
end

#dirtyObject (readonly)

Returns the value of attribute dirty.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def dirty
  @dirty
end

#iconObject (readonly)

Returns the value of attribute icon.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def icon
  @icon
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def id
  @id
end

Returns the value of attribute menu.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def menu
  @menu
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def options
  @options
end

#paddingObject (readonly)

Returns the value of attribute padding.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def padding
  @padding
end

#responsiveObject (readonly)

Returns the value of attribute responsive.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def responsive
  @responsive
end

#selectedObject (readonly)

Returns the value of attribute selected.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def selected
  @selected
end

#selected_tab_indexObject (readonly)

Returns the value of attribute selected_tab_index.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def selected_tab_index
  @selected_tab_index
end

#tab_menuObject (readonly)

Returns the value of attribute tab_menu.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def tab_menu
  @tab_menu
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'app/components/satis/tab/component.rb', line 6

def title
  @title
end

Instance Method Details

#callObject



62
63
64
# File 'app/components/satis/tab/component.rb', line 62

def call
  content
end

#dirty?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'app/components/satis/tab/component.rb', line 58

def dirty?
  dirty == true
end

#responsive?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'app/components/satis/tab/component.rb', line 50

def responsive?
  responsive == true
end

#selected?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'app/components/satis/tab/component.rb', line 54

def selected?
  selected == true
end