mirror of
https://github.com/docusealco/docuseal
synced 2026-11-07 23:32:33 -05:00
add infinite scroll
This commit is contained in:
1 parent
d3cc2e1ca8
commit
8cb0a7a020
21 files changed
+179
-10
No files matched your search
@@ -12,13 +12,23 @@ class TemplatesArchivedController < ApplicationController
|
||||
|
||||
@pagy, @templates = pagy_auto(@templates.select_for_list, limit: 12)
|
||||
|
||||
return unless params[:q].present? && @templates.blank?
|
||||
if params[:q].present? && @templates.blank?
|
||||
@related_submissions_pagy, @related_submissions = load_related_submissions
|
||||
end
|
||||
|
||||
@related_submissions_pagy, @related_submissions = load_related_submissions
|
||||
render_infinite_scroll(@pagy, @templates) if turbo_infinite_scroll?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def render_infinite_scroll(pagy, templates)
|
||||
render turbo_stream: [
|
||||
turbo_stream.before('infinite_scroll', partial: 'templates/template', collection: templates,
|
||||
locals: { with_folder: true }),
|
||||
turbo_stream.replace('infinite_scroll', partial: 'shared/infinite_scroll', locals: { pagy: })
|
||||
]
|
||||
end
|
||||
|
||||
def load_related_submissions
|
||||
related_submissions =
|
||||
Submission.accessible_by(current_ability)
|
||||
|
||||
Reference in new issue
Block a user