Class: Plutonium::UI::Table::Components::FilterForm
- Inherits:
-
Form::Base
- Object
- Phlexi::Form::Base
- Form::Base
- Plutonium::UI::Table::Components::FilterForm
- Defined in:
- lib/plutonium/ui/table/components/filter_form.rb
Overview
Phlexi form rendering the filter slideover body. Submits via GET
with q[<filter>][<input>]=value so the existing query object
parses values exactly as the legacy filter dropdown did. Hidden
fields preserve sort, scope and search state across applies.
Instance Attribute Summary collapse
-
#query_object ⇒ Object
readonly
Returns the value of attribute query_object.
-
#search_param ⇒ Object
readonly
Returns the value of attribute search_param.
-
#search_value ⇒ Object
readonly
Returns the value of attribute search_value.
Instance Method Summary collapse
- #form_class ⇒ Object
- #form_template ⇒ Object
-
#initialize(query_object:, search_url:, search_param: :q, search_value: nil, attributes: {}, **opts) ⇒ FilterForm
constructor
A new instance of FilterForm.
-
#initialize_attributes ⇒ Object
The Filters slideover renders on every index page (off-screen until opened) — same DOM as any CRUD modal that might appear.
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?
Constructor Details
#initialize(query_object:, search_url:, search_param: :q, search_value: nil, attributes: {}, **opts) ⇒ FilterForm
Returns a new instance of FilterForm.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/plutonium/ui/table/components/filter_form.rb', line 14 def initialize(*, query_object:, search_url:, search_param: :q, search_value: nil, attributes: {}, **opts, &) opts[:as] = :q opts[:method] = :get attributes = attributes.deep_merge(data: {turbo_frame: nil}) super(*, attributes:, **opts, &) @query_object = query_object @search_url = search_url @search_param = search_param @search_value = search_value end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Plutonium::UI::Component::Kit
Instance Attribute Details
#query_object ⇒ Object (readonly)
Returns the value of attribute query_object.
12 13 14 |
# File 'lib/plutonium/ui/table/components/filter_form.rb', line 12 def query_object @query_object end |
#search_param ⇒ Object (readonly)
Returns the value of attribute search_param.
12 13 14 |
# File 'lib/plutonium/ui/table/components/filter_form.rb', line 12 def search_param @search_param end |
#search_value ⇒ Object (readonly)
Returns the value of attribute search_value.
12 13 14 |
# File 'lib/plutonium/ui/table/components/filter_form.rb', line 12 def search_value @search_value end |
Instance Method Details
#form_class ⇒ Object
36 37 38 |
# File 'lib/plutonium/ui/table/components/filter_form.rb', line 36 def form_class "flex-1 flex flex-col min-h-0" end |
#form_template ⇒ Object
40 41 42 43 44 45 |
# File 'lib/plutonium/ui/table/components/filter_form.rb', line 40 def form_template render_header render_fields_region render_hidden_state end |
#initialize_attributes ⇒ Object
The Filters slideover renders on every index page (off-screen
until opened) — same DOM as any CRUD modal that might appear.
Base defaults the form id to "resource-form"; without this
override, document-level turbo_stream.replace("resource-form", …)
from a CRUD submit would clobber the wrong form. Pick a distinct
id so the two never collide.
31 32 33 34 |
# File 'lib/plutonium/ui/table/components/filter_form.rb', line 31 def initialize_attributes super attributes[:id] = "filter-form" end |