Class: Plutonium::UI::Table::Resource

Inherits:
Component::Base show all
Defined in:
lib/plutonium/ui/table/resource.rb

Direct Known Subclasses

Definition::Base::Table

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Component::Behaviour

#around_template

Methods included from Component::Tokens

#classes, #tokens

Methods included from Component::Kit

#BuildActionButton, #BuildBlock, #BuildBreadcrumbs, #BuildColorModeSelector, #BuildDynaFrameContent, #BuildDynaFrameHost, #BuildEmptyCard, #BuildFrameNavigatorPanel, #BuildPageHeader, #BuildPanel, #BuildSkeletonTable, #BuildTabList, #BuildTableInfo, #BuildTablePagination, #BuildTableScopesBar, #BuildTableSearchBar, #method_missing, #respond_to_missing?

Constructor Details

#initialize(collection, resource_fields:, resource_definition:) ⇒ Resource

Returns a new instance of Resource.



9
10
11
12
13
# File 'lib/plutonium/ui/table/resource.rb', line 9

def initialize(collection, resource_fields:, resource_definition:)
  @collection = collection
  @resource_fields = resource_fields
  @resource_definition = resource_definition
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Plutonium::UI::Component::Kit

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



7
8
9
# File 'lib/plutonium/ui/table/resource.rb', line 7

def collection
  @collection
end

#resource_definitionObject (readonly)

Returns the value of attribute resource_definition.



7
8
9
# File 'lib/plutonium/ui/table/resource.rb', line 7

def resource_definition
  @resource_definition
end

#resource_fieldsObject (readonly)

Returns the value of attribute resource_fields.



7
8
9
# File 'lib/plutonium/ui/table/resource.rb', line 7

def resource_fields
  @resource_fields
end

Instance Method Details

#view_templateObject



15
16
17
18
19
20
21
22
# File 'lib/plutonium/ui/table/resource.rb', line 15

def view_template
  render_search_bar
  render_scopes_bar

  collection.empty? ? render_empty_card : render_table

  render_footer
end