Class: IronAdmin::Filters::SearchComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- IronAdmin::Filters::SearchComponent
- Defined in:
- app/components/iron_admin/filters/search_component.rb
Overview
Renders the search input in the filter bar.
Instance Attribute Summary collapse
-
#form_url ⇒ String
readonly
Form submission URL.
-
#hidden_params ⇒ Hash
readonly
Hidden params to preserve.
-
#placeholder ⇒ String
readonly
Placeholder text.
-
#value ⇒ String?
readonly
Current search value.
Instance Method Summary collapse
-
#initialize(form_url:, value: nil, placeholder: "Search...", hidden_params: {}) ⇒ SearchComponent
constructor
A new instance of SearchComponent.
-
#input_classes ⇒ String
private
CSS classes for search input field.
-
#theme ⇒ IronAdmin::Configuration::Theme
private
Theme configuration.
Constructor Details
#initialize(form_url:, value: nil, placeholder: "Search...", hidden_params: {}) ⇒ SearchComponent
Returns a new instance of SearchComponent.
23 24 25 26 27 28 |
# File 'app/components/iron_admin/filters/search_component.rb', line 23 def initialize(form_url:, value: nil, placeholder: "Search...", hidden_params: {}) @value = value @placeholder = placeholder @form_url = form_url @hidden_params = hidden_params end |
Instance Attribute Details
#form_url ⇒ String (readonly)
Returns Form submission URL.
14 15 16 |
# File 'app/components/iron_admin/filters/search_component.rb', line 14 def form_url @form_url end |
#hidden_params ⇒ Hash (readonly)
Returns Hidden params to preserve.
17 18 19 |
# File 'app/components/iron_admin/filters/search_component.rb', line 17 def hidden_params @hidden_params end |
#placeholder ⇒ String (readonly)
Returns Placeholder text.
11 12 13 |
# File 'app/components/iron_admin/filters/search_component.rb', line 11 def placeholder @placeholder end |
#value ⇒ String? (readonly)
Returns Current search value.
8 9 10 |
# File 'app/components/iron_admin/filters/search_component.rb', line 8 def value @value end |
Instance Method Details
#input_classes ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns CSS classes for search input field.
38 39 40 41 42 |
# File 'app/components/iron_admin/filters/search_component.rb', line 38 def input_classes "block w-full border py-2 pl-10 pr-4 text-sm shadow-sm outline-none " \ "transition duration-150 ease-in-out #{theme.border_radius} #{theme.input_border} " \ "#{theme.} #{theme.body_text} #{theme.input_focus} #{theme.}" end |
#theme ⇒ IronAdmin::Configuration::Theme
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Theme configuration.
32 33 34 |
# File 'app/components/iron_admin/filters/search_component.rb', line 32 def theme IronAdmin.configuration.theme end |