Class: Practical::Views::Navigation::Pagination::GotoFormComponent
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Practical::Views::Navigation::Pagination::GotoFormComponent
- Includes:
- Pagy::Frontend
- Defined in:
- app/components/practical/views/navigation/pagination/goto_form_component.rb
Constant Summary collapse
- URIParts =
Data.define(:uri, :params)
Instance Attribute Summary collapse
-
#dialog_id ⇒ Object
Returns the value of attribute dialog_id.
-
#page_detail_text ⇒ Object
Returns the value of attribute page_detail_text.
-
#pagy ⇒ Object
Returns the value of attribute pagy.
Instance Method Summary collapse
- #hidden_field_for_goto_form(key:, value:) ⇒ Object
-
#initialize(pagy:, dialog_id:, page_detail_text:) ⇒ GotoFormComponent
constructor
A new instance of GotoFormComponent.
- #uri_parts ⇒ Object
Constructor Details
#initialize(pagy:, dialog_id:, page_detail_text:) ⇒ GotoFormComponent
Returns a new instance of GotoFormComponent.
9 10 11 12 13 |
# File 'app/components/practical/views/navigation/pagination/goto_form_component.rb', line 9 def initialize(pagy:, dialog_id:, page_detail_text:) self.pagy = pagy self.dialog_id = dialog_id self.page_detail_text = page_detail_text end |
Instance Attribute Details
#dialog_id ⇒ Object
Returns the value of attribute dialog_id.
5 6 7 |
# File 'app/components/practical/views/navigation/pagination/goto_form_component.rb', line 5 def dialog_id @dialog_id end |
#page_detail_text ⇒ Object
Returns the value of attribute page_detail_text.
5 6 7 |
# File 'app/components/practical/views/navigation/pagination/goto_form_component.rb', line 5 def page_detail_text @page_detail_text end |
#pagy ⇒ Object
Returns the value of attribute pagy.
5 6 7 |
# File 'app/components/practical/views/navigation/pagination/goto_form_component.rb', line 5 def pagy @pagy end |
Instance Method Details
#hidden_field_for_goto_form(key:, value:) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/practical/views/navigation/pagination/goto_form_component.rb', line 24 def hidden_field_for_goto_form(key:, value:) case value when Array value.each do |x| helpers.hidden_field_tag key, x end else helpers.hidden_field_tag key, value end end |
#uri_parts ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/components/practical/views/navigation/pagination/goto_form_component.rb', line 15 def uri_parts uri = URI.parse(pagy_url_for(pagy, nil)) params = Rack::Utils.parse_query(uri.query) params.delete("page") uri.query = "" URIParts.new(uri: uri, params: params) end |