Class: Avo::Resources::Items::TabGroup
- Inherits:
-
Object
- Object
- Avo::Resources::Items::TabGroup
- Includes:
- Concerns::HasItemType, Concerns::HasItems, Concerns::IsResourceItem, Concerns::IsVisible, Concerns::VisibleInDifferentViews
- Defined in:
- lib/avo/resources/items/tab_group.rb
Defined Under Namespace
Classes: Builder
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#name ⇒ Object
Returns the value of attribute name.
-
#style ⇒ Object
Returns the value of attribute style.
Attributes included from Concerns::VisibleInDifferentViews
#show_on_edit, #show_on_index, #show_on_new, #show_on_preview, #show_on_show
Attributes included from Concerns::IsVisible
Attributes included from Concerns::HasItems
Attributes included from Concerns::IsResourceItem
Instance Method Summary collapse
- #group_param ⇒ Object
-
#id ⇒ Object
(also: #to_param)
The user might assign an id to a group.
-
#initialize(index: 0, view: nil, style: nil, id: nil, name: nil, **args) ⇒ TabGroup
constructor
A new instance of TabGroup.
- #turbo_frame_id ⇒ Object
Methods included from Concerns::VisibleInDifferentViews
#except_on, #hide_on, #initialize_views, #only_on, #post_initialize, #show_on, #show_on_create, #show_on_update, #visible_in_view?
Methods included from Concerns::IsVisible
Methods included from Concerns::HasItemType
#is_field?, #is_heading?, #is_main_panel?, #is_panel?, #is_row?, #is_sidebar?, #is_tab?, #is_tab_group?, #is_tool?
Methods included from Concerns::HasItems
#fields, #get_field, #get_field_definitions, #get_fields, #get_items, #get_preview_fields, #invalid_fields, #is_empty?, #items, #only_fields, #tab_groups, #visible_items
Methods included from Concerns::IsResourceItem
Methods included from Concerns::Hydration
Constructor Details
#initialize(index: 0, view: nil, style: nil, id: nil, name: nil, **args) ⇒ TabGroup
Returns a new instance of TabGroup.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/avo/resources/items/tab_group.rb', line 13 def initialize(index: 0, view: nil, style: nil, id: nil, name: nil, **args) @index = index @items_holder = Avo::Resources::Items::Holder.new @view = Avo::ViewInquirer.new view @style = style @id = id @name = name @args = args @visible = args[:visible] post_initialize if respond_to?(:post_initialize) end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
9 10 11 |
# File 'lib/avo/resources/items/tab_group.rb', line 9 def index @index end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/avo/resources/items/tab_group.rb', line 11 def name @name end |
#style ⇒ Object
Returns the value of attribute style.
10 11 12 |
# File 'lib/avo/resources/items/tab_group.rb', line 10 def style @style end |
Instance Method Details
#group_param ⇒ Object
41 42 43 |
# File 'lib/avo/resources/items/tab_group.rb', line 41 def group_param "tab-group_#{id}" end |
#id ⇒ Object Also known as: to_param
The user might assign an id to a group. If not, we’ll use the name. If not, we’ll use the index
29 30 31 32 33 34 |
# File 'lib/avo/resources/items/tab_group.rb', line 29 def id return @id if @id.present? return @name.parameterize if @name.present? index end |