Supports tag filters persistence during product updates

Adds functionality to retain tag filters applied in the admin product interface after bulk updates. Updates controller parameters to include tags_name_in, adds hidden fields for tag persistence in the view, and includes specs to verify filter state retention across update operations.
This commit is contained in:
Ahmed Ejaz
2026-02-18 01:37:41 +05:00
parent d99a88817d
commit 1d4bbfa506
4 changed files with 59 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ module Admin
flash[:success] = I18n.t('admin.products_v3.bulk_update.success')
redirect_to [:index,
{ page: @page, per_page: @per_page, search_term: @search_term,
producer_id: @producer_id, category_id: @category_id }]
producer_id: @producer_id, category_id: @category_id, tags_name_in: @tags }]
elsif product_set.errors.present?
@error_counts = { saved: product_set.saved_count, invalid: product_set.invalid.count }
@@ -120,7 +120,7 @@ module Admin
@search_term = params[:search_term] || params[:_search_term]
@producer_id = params[:producer_id] || params[:_producer_id]
@category_id = params[:category_id] || params[:_category_id]
@tags = params[:tags_name_in] || params[:_tags_name_in]
@tags = params[:tags_name_in] || []
end
def init_pagination_params