diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 4818da9b..bbf54813 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -8,6 +8,7 @@ class DashboardController < ApplicationController return render 'pages/landing' unless signed_in? templates = current_account.templates.active.preload(:author).order(id: :desc) + templates = Templates.search(templates, params[:q]) @pagy, @templates = pagy(templates, items: 12) end diff --git a/app/controllers/templates_archived_controller.rb b/app/controllers/templates_archived_controller.rb index d515817c..a4fccc0b 100644 --- a/app/controllers/templates_archived_controller.rb +++ b/app/controllers/templates_archived_controller.rb @@ -3,6 +3,7 @@ class TemplatesArchivedController < ApplicationController def index templates = current_account.templates.where.not(deleted_at: nil).preload(:author).order(id: :desc) + templates = Templates.search(templates, params[:q]) @pagy, @templates = pagy(templates, items: 12) end diff --git a/app/controllers/templates_archived_submissions_controller.rb b/app/controllers/templates_archived_submissions_controller.rb index d777e2f1..2ea5938f 100644 --- a/app/controllers/templates_archived_submissions_controller.rb +++ b/app/controllers/templates_archived_submissions_controller.rb @@ -4,7 +4,10 @@ class TemplatesArchivedSubmissionsController < ApplicationController def show @template = current_account.templates.find(params[:template_id]) - @pagy, @submissions = pagy(@template.submissions.where.not(deleted_at: nil).preload(:submitters).order(id: :desc)) + submissions = @template.submissions.where.not(deleted_at: nil) + submissions = Submissions.search(submissions, params[:q]) + + @pagy, @submissions = pagy(submissions.preload(:submitters).order(id: :desc)) rescue ActiveRecord::RecordNotFound redirect_to root_path end diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index 93df873f..98fd7e99 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -7,6 +7,7 @@ class TemplatesController < ApplicationController @template = current_account.templates.find(params[:id]) submissions = @template.submissions submissions = submissions.active if @template.deleted_at.blank? + submissions = Submissions.search(submissions, params[:q]) @pagy, @submissions = pagy(submissions.preload(:submitters).order(id: :desc)) rescue ActiveRecord::RecordNotFound diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index 56499a90..c74730eb 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -1,8 +1,11 @@ <% if Docuseal.demo? %><%= render 'shared/demo_alert' %><% end %> -<% if @templates.any? %> +<% if @pagy.count > 0 || params[:q].present? %>
Submissions
There are no Submissions
- <% if @template.deleted_at.blank? %> + <% if @template.deleted_at.blank? && params[:q].blank? %>Send an invitation to fill and complete the form
Submissions Archived