Class: TurboScroll::Auto
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- TurboScroll::Auto
- Includes:
- Turbo::FramesHelper
- Defined in:
- lib/turbo-scroll/auto.rb
Instance Attribute Summary collapse
-
#loader_dom_id ⇒ Object
readonly
Returns the value of attribute loader_dom_id.
-
#loading_indicator ⇒ Object
readonly
Returns the value of attribute loading_indicator.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
-
#initialize(page:, loader_dom_id: :turbo_loader, loading_indicator: true) ⇒ Auto
constructor
A new instance of Auto.
- #next_page_path ⇒ Object
- #next_page_stream_path ⇒ Object
- #query_params ⇒ Object
- #render? ⇒ Boolean
Constructor Details
#initialize(page:, loader_dom_id: :turbo_loader, loading_indicator: true) ⇒ Auto
Returns a new instance of Auto.
10 11 12 13 14 |
# File 'lib/turbo-scroll/auto.rb', line 10 def initialize(page:, loader_dom_id: :turbo_loader, loading_indicator: true) @page = page @loader_dom_id = loader_dom_id @loading_indicator = loading_indicator end |
Instance Attribute Details
#loader_dom_id ⇒ Object (readonly)
Returns the value of attribute loader_dom_id.
8 9 10 |
# File 'lib/turbo-scroll/auto.rb', line 8 def loader_dom_id @loader_dom_id end |
#loading_indicator ⇒ Object (readonly)
Returns the value of attribute loading_indicator.
8 9 10 |
# File 'lib/turbo-scroll/auto.rb', line 8 def loading_indicator @loading_indicator end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
8 9 10 |
# File 'lib/turbo-scroll/auto.rb', line 8 def page @page end |
Instance Method Details
#next_page_path ⇒ Object
21 22 23 |
# File 'lib/turbo-scroll/auto.rb', line 21 def next_page_path url_for(page: page, **query_params) end |
#next_page_stream_path ⇒ Object
25 26 27 |
# File 'lib/turbo-scroll/auto.rb', line 25 def next_page_stream_path url_for(format: :turbo_stream, page: page, **query_params) end |
#query_params ⇒ Object
16 17 18 19 |
# File 'lib/turbo-scroll/auto.rb', line 16 def query_params @query_params ||= request.query_parameters.except(:page, :raw, :format) end |
#render? ⇒ Boolean
29 30 31 |
# File 'lib/turbo-scroll/auto.rb', line 29 def render? page end |