Class: Plutonium::UI::Table::Base
- Inherits:
-
Phlexi::Table::Base
- Object
- Phlexi::Table::Base
- Plutonium::UI::Table::Base
- Includes:
- Component::Behaviour
- Defined in:
- lib/plutonium/ui/table/base.rb
Defined Under Namespace
Classes: DataColumn, Display, SelectionColumn, SortableHeaderCell
Instance Method Summary collapse
-
#positioned? ⇒ Boolean
Reorderable AND currently orderable.
-
#table_body_row_attributes(wrapped_object) ⇒ Object
Make every body row a row-click candidate.
-
#table_wrapper_attributes ⇒ Object
Scope the drag controller to the div that wraps
: the tightest element that contains every row, and nothing else the drag cares about.
Methods included from Component::Behaviour
Methods included from Component::Tokens
Methods included from Component::Kit
#BuildActionButton, #BuildActionsDropdown, #BuildAvatar, #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?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Plutonium::UI::Component::Kit
Instance Method Details
#positioned? ⇒ Boolean
Reorderable AND currently orderable. Table::Resource passes the template only when the collection is in ascending position order — a drop under any other sort is rejected by the server, so the client must not offer it (the grip still renders, disabled, to say so).
47 48 49
# File 'lib/plutonium/ui/table/base.rb', line 47 def positioned? @options[:positioned_url_template].present? end
#table_body_row_attributes(wrapped_object) ⇒ Object
Make every body row a row-click candidate. The controller delegates to whatever element inside the row is tagged
data-row-click-target="show"(typically the show action button). Rows without such a target become a no-op — no special-casing needed in this layer.14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
# File 'lib/plutonium/ui/table/base.rb', line 14 def table_body_row_attributes(wrapped_object) attributes = super.merge(data: {controller: "row-click", action: "click->row-click#click auxclick->row-click#click"}) return attributes unless positioned? # The row — never the grip — is the single source of truth for which # record a drag is about. See positioned_controller.js. row_data = attributes[:data].merge(positioned_row_id: wrapped_object.identifier) # Present only for a scoped resource, where a drop across groups is # meaningless and the drag must refuse it (see Positionable). group = @options[:positioned_group_resolver]&.call(wrapped_object.unwrapped) row_data = row_data.merge(positioned_group: group) unless group.nil? attributes.merge(data: row_data) end
#table_wrapper_attributes ⇒ Object
Scope the drag controller to the div that wraps
: the tightest element that contains every row, and nothing else the drag cares about.
32 33 34 35 36 37 38 39 40 41
# File 'lib/plutonium/ui/table/base.rb', line 32 def table_wrapper_attributes return super unless positioned? super.merge( data: { controller: "positioned", positioned_url_template_value: @options[:positioned_url_template] } ) end