Method: Satis::Tab::Component#initialize

Defined in:
app/components/satis/tab/component.rb

#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