Class: SolidusAdmin::UI::Table::Component::Search
- Inherits:
-
Struct
- Object
- Struct
- SolidusAdmin::UI::Table::Component::Search
- Defined in:
- app/components/solidus_admin/ui/table/component.rb
Overview
rubocop:disable Style/StructInheritance
Instance Attribute Summary collapse
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#name ⇒ Object
Returns the value of attribute name.
-
#scopes ⇒ Object
Returns the value of attribute scopes.
-
#searchbar_key ⇒ Object
Returns the value of attribute searchbar_key.
-
#url ⇒ Object
Returns the value of attribute url.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #current_scope ⇒ Object
- #default_scope ⇒ Object
-
#initialize(**args) ⇒ Search
constructor
A new instance of Search.
- #on_default_scope? ⇒ Boolean
- #scope_param_name ⇒ Object
- #searchbar_param_name ⇒ Object
Constructor Details
#initialize(**args) ⇒ Search
Returns a new instance of Search.
31 32 33 34 35 36 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 31 def initialize(**args) super self.filters = filters.to_a.map { |filter| Filter.new(**filter) } self.scopes = scopes.to_a.map { |scope| Scope.new(**scope) } end |
Instance Attribute Details
#filters ⇒ Object
Returns the value of attribute filters
30 31 32 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 30 def filters @filters end |
#name ⇒ Object
Returns the value of attribute name
30 31 32 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 30 def name @name end |
#scopes ⇒ Object
Returns the value of attribute scopes
30 31 32 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 30 def scopes @scopes end |
#searchbar_key ⇒ Object
Returns the value of attribute searchbar_key
30 31 32 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 30 def @searchbar_key end |
#url ⇒ Object
Returns the value of attribute url
30 31 32 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 30 def url @url end |
#value ⇒ Object
Returns the value of attribute value
30 31 32 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 30 def value @value end |
Instance Method Details
#current_scope ⇒ Object
38 39 40 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 38 def current_scope scopes.find { |scope| scope.name.to_s == value[:scope].presence } || default_scope end |
#default_scope ⇒ Object
42 43 44 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 42 def default_scope scopes.find(&:default) end |
#on_default_scope? ⇒ Boolean
46 47 48 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 46 def on_default_scope? current_scope == default_scope end |
#scope_param_name ⇒ Object
50 51 52 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 50 def scope_param_name "#{name}[scope]" end |
#searchbar_param_name ⇒ Object
54 55 56 |
# File 'app/components/solidus_admin/ui/table/component.rb', line 54 def "#{name}[#{}]" end |