Class: Avo::Resources::Items::Tab
- Inherits:
-
Object
- Object
- Avo::Resources::Items::Tab
- Includes:
- Concerns::FrameLoadingMode, Concerns::HasItemType, Concerns::HasItems, Concerns::IsResourceItem, Concerns::IsVisible, Concerns::VisibleInDifferentViews, Concerns::VisibleItems
- Defined in:
- lib/avo/resources/items/tab.rb
Defined Under Namespace
Classes: Builder
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#lazy_load ⇒ Object
readonly
Returns the value of attribute lazy_load.
-
#loading ⇒ Object
readonly
Returns the value of attribute loading.
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
- #get_items ⇒ Object
- #id ⇒ Object (also: #to_param)
-
#initialize(title: nil, description: nil, view: nil, **args) ⇒ Tab
constructor
A new instance of Tab.
- #title ⇒ Object
- #turbo_frame_id(parent: nil) ⇒ Object
Methods included from Concerns::FrameLoadingMode
#auto_load_for, #default_manual_auto_load_for, #frame_loading_defaults, #lazy_loading_mode?, #loading_mode, #manual?
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::VisibleItems
Methods included from Concerns::HasItemType
#is_card?, #is_collaboration?, #is_field?, #is_header?, #is_heading?, #is_panel?, #is_sidebar?, #is_tab?, #is_tab_group?, #is_tool?
Methods included from Concerns::HasItems
#fields, #get_field, #get_field_definitions, #get_fields, #get_preview_fields, #invalid_fields, #is_empty?, #items, #items_with_standalone_fields_wrapped_in_cards, #only_fields, #tab_groups, #visible_items
Methods included from Concerns::IsResourceItem
Methods included from Concerns::Hydration
Constructor Details
#initialize(title: nil, description: nil, view: nil, **args) ⇒ Tab
Returns a new instance of Tab.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/avo/resources/items/tab.rb', line 17 def initialize(title: nil, description: nil, view: nil, **args) @title = title @description = description @items_holder = Avo::Resources::Items::Holder.new @view = Avo::ViewInquirer.new view @args = args @visible = args[:visible] @lazy_load = args[:lazy_load] @loading = args[:loading] post_initialize if respond_to?(:post_initialize) end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
13 14 15 |
# File 'lib/avo/resources/items/tab.rb', line 13 def description @description end |
#lazy_load ⇒ Object (readonly)
Returns the value of attribute lazy_load.
14 15 16 |
# File 'lib/avo/resources/items/tab.rb', line 14 def lazy_load @lazy_load end |
#loading ⇒ Object (readonly)
Returns the value of attribute loading.
15 16 17 |
# File 'lib/avo/resources/items/tab.rb', line 15 def loading @loading end |
Instance Method Details
#get_items ⇒ Object
47 48 49 |
# File 'lib/avo/resources/items/tab.rb', line 47 def get_items items_with_standalone_fields_wrapped_in_cards end |
#id ⇒ Object Also known as: to_param
34 35 36 |
# File 'lib/avo/resources/items/tab.rb', line 34 def id title.to_s.parameterize end |
#title ⇒ Object
30 31 32 |
# File 'lib/avo/resources/items/tab.rb', line 30 def title Avo::ExecutionContext.new(target: @title).handle end |
#turbo_frame_id(parent: nil) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/avo/resources/items/tab.rb', line 39 def turbo_frame_id(parent: nil) digest_name = Digest::MD5.hexdigest(title) id = "#{Avo::Resources::Items::Tab.to_s.parameterize} #{digest_name}".parameterize return id if parent.nil? "#{parent.turbo_frame_id} #{id}".parameterize end |