From cf85bea0df2d8a35e39cfc5f7ce6577ed99dd74d Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Sat, 23 Sep 2023 10:19:14 +0300 Subject: [PATCH] fix dashboard search --- app/controllers/dashboard_controller.rb | 2 +- app/views/dashboard/index.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 3f9eff1d..aa08ae4d 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -51,7 +51,7 @@ class DashboardController < ApplicationController def filter_templates(templates) rel = templates.active.preload(:author).order(id: :desc) - .where(folder_id: current_account.default_template_folder.id) + rel = rel.where(folder_id: current_account.default_template_folder.id) if params[:q].blank? Templates.search(rel, params[:q]) end diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index 2bccb360..d2b6b830 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -1,5 +1,5 @@ <% if Docuseal.demo? %><%= render 'shared/demo_alert' %><% end %> -<% if @pagy.count > 0 || params[:q].present? %> +<% if @pagy.count > 0 || params[:q].present? || @template_folders.present? %>

Templates