From fa26cf436052c9fb2f12ef4760068465fbef0961 Mon Sep 17 00:00:00 2001 From: saunmanoj888 Date: Tue, 19 Nov 2024 00:58:45 +0530 Subject: [PATCH] Hide search filters when no product is present --- app/views/admin/products_v3/_content.html.haml | 17 +++++++++-------- app/views/admin/products_v3/index.html.haml | 3 ++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/views/admin/products_v3/_content.html.haml b/app/views/admin/products_v3/_content.html.haml index 0a9459abae9..8c3e7be0f0a 100644 --- a/app/views/admin/products_v3/_content.html.haml +++ b/app/views/admin/products_v3/_content.html.haml @@ -3,14 +3,15 @@ .spinner-container .spinner = t('.loading') - .container - .sixteen.columns - = render partial: 'admin/shared/flashes', locals: { flashes: } if defined? flashes - = render partial: 'filters', locals: { search_term: search_term, - producer_id: producer_id, - producer_options: producer_options, - category_options: category_options, - category_id: category_id } + - if display_search_filter + .container + .sixteen.columns + = render partial: 'admin/shared/flashes', locals: { flashes: } if defined? flashes + = render partial: 'filters', locals: { search_term: search_term, + producer_id: producer_id, + producer_options: producer_options, + category_options: category_options, + category_id: category_id } - if products.any? .container.results .sixteen.columns diff --git a/app/views/admin/products_v3/index.html.haml b/app/views/admin/products_v3/index.html.haml index dfa010fdc85..9d2d5f5dc82 100644 --- a/app/views/admin/products_v3/index.html.haml +++ b/app/views/admin/products_v3/index.html.haml @@ -15,7 +15,8 @@ = render partial: "content", locals: { products: @products, pagy: @pagy, search_term: @search_term, producer_options: producers, producer_id: @producer_id, category_options: categories, category_id: @category_id, - tax_category_options:, flashes: flash } + tax_category_options:, flashes: flash, + display_search_filter: (@products.any? || @search_term.present? || @category_id.present?) } - %w[product variant].each do |object_type| = render partial: 'delete_modal', locals: { object_type: } #modal-component