Class: Olivander::Components::TabsComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/olivander/components/tabs_component.rb

Overview

component to render tabs

Defined Under Namespace

Classes: Tab

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ TabsComponent

Returns a new instance of TabsComponent.



12
13
14
15
16
17
18
19
20
# File 'app/components/olivander/components/tabs_component.rb', line 12

def initialize(*args)
  super
  options = args.extract_options!
  @id = options[:id] || "tabs-#{SecureRandom.hex(4)}"
  @card = options.key?(:card) ? !!options[:card] : true
  @card_class = options.key?(:card_class) ? options[:card_class] : 'card-primary'
  @tab_strip_id = "tab-strip-#{SecureRandom.hex(4)}"
  @tab_content_id = "tab-strip-#{SecureRandom.hex(4)}"
end

Instance Attribute Details

#cardObject (readonly)

Returns the value of attribute card.



10
11
12
# File 'app/components/olivander/components/tabs_component.rb', line 10

def card
  @card
end

#card_classObject (readonly)

Returns the value of attribute card_class.



10
11
12
# File 'app/components/olivander/components/tabs_component.rb', line 10

def card_class
  @card_class
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'app/components/olivander/components/tabs_component.rb', line 10

def id
  @id
end

#tab_content_idObject (readonly)

Returns the value of attribute tab_content_id.



10
11
12
# File 'app/components/olivander/components/tabs_component.rb', line 10

def tab_content_id
  @tab_content_id
end

#tab_strip_idObject (readonly)

Returns the value of attribute tab_strip_id.



10
11
12
# File 'app/components/olivander/components/tabs_component.rb', line 10

def tab_strip_id
  @tab_strip_id
end