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, #BuildActionsDropdown, #BuildBlock, #BuildBreadcrumbs, #BuildBulkActionsToolbar, #BuildColorModeSelector, #BuildDynaFrameContent, #BuildDynaFrameHost, #BuildEmptyCard, #BuildFrameNavigatorPanel, #BuildModalCentered, #BuildModalSlideover, #BuildPageHeader, #BuildPanel, #BuildRowActionsDropdown, #BuildSkeletonTable, #BuildTabList, #BuildTableFilterPills, #BuildTableInfo, #BuildTablePagination, #BuildTableScopesBar, #BuildTableScopesPills, #BuildTableSearchBar, #BuildTableToolbar, #BuildTableViewSwitcher, #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
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/plutonium/ui/table/resource.rb', line 15

def view_template
  # filter-panel controller wraps everything so the toolbar's
  # filter button AND the FilterPills "+ Filter" pill (a sibling
  # below the toolbar) share the same controller scope and can
  # toggle the slideover rendered alongside them.
  div(data: filter_panel_controller_data) do
    render_scopes_pills
    render_toolbar

    div(data: bulk_actions_controller_data) do
      render_filter_pills
      render_bulk_actions_toolbar
      collection.empty? ? render_empty_card : render_table
    end

    render_filter_slideover if current_query_object.filter_definitions.present?
  end

  render_footer
end