Last active
August 15, 2022 14:38
-
-
Save michalkorzawski/efbc3134f6d7f991529f92ed0b65620d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def results | |
| params_hash = element.dataset['params-hash'].present? ? JSON.parse(element.dataset['params-hash']) : filtered_params | |
| pagy, collection = pagy(active_record_collection(filters), page: page) | |
| # The HTML provided can be a partial or ViewComponent (as we use in our case) | |
| cable_ready.morph( | |
| children_only: true, | |
| selector: '#id_of_a_dom_element', | |
| html: render( | |
| PaginationComponent.new( | |
| pagy: pagy, | |
| params_hash: params_hash.to_json, | |
| collection: collection | |
| ), layout: false | |
| ) | |
| ) | |
| morph :nothing | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment