Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Search properties in Admin by filterable status (#11258)
Virginia Nguyenc48e1ac00991
diff --git a/backend/app/views/spree/admin/properties/index.html.erb b/backend/app/views/spree/admin/properties/index.html.erbindex b0b628dec2..9d810f4e23 100644--- a/backend/app/views/spree/admin/properties/index.html.erb+++ b/backend/app/views/spree/admin/properties/index.html.erb@@ -28,6 +28,16 @@</div></div>+ <div class="row">+ <div class="col-12 col-lg-6">+ <div class="form-group">+ <%= label_tag :q_filterable_eq, Spree.t(:filterable_status) %>+ <%= f.select :filterable_eq, options_for_select([[Spree.t(:filterable), true], [Spree.t(:non_filterable), false]]), { include_blank: true }, class: 'select2-clear js-filterable' %>+ </div>+ </div>+ </div>+ </div>+<div class="form-actions" data-hook="admin_pproperties_index_search_buttons"><%= button Spree.t(:search), 'search.svg' %></div>diff --git a/backend/spec/features/admin/products/properties_spec.rb b/backend/spec/features/admin/products/properties_spec.rbindex c3983a2f9e..3bc61dc579 100644--- a/backend/spec/features/admin/products/properties_spec.rb+++ b/backend/spec/features/admin/products/properties_spec.rb@@ -9,8 +9,8 @@ describe 'Properties', type: :feature, js: true docontext 'Property index' dobefore do- create(:property, name: 'shirt size', presentation: 'size')- create(:property, name: 'shirt fit', presentation: 'fit')+ create(:property, name: 'shirt size', presentation: 'size', filterable: true)+ create(:property, name: 'shirt fit', presentation: 'fit', filterable: false)visit spree.admin_properties_pathend@@ -38,6 +38,16 @@ describe 'Properties', type: :feature, js: true doexpect(page).not_to have_content('shirt fit')end+ it 'search by filterable status' do+ click_on 'Filter'+ select 'Filterable', from: 'Filterable Status'++ click_on 'Search'++ expect(page).to have_content('shirt size')+ expect(page).not_to have_content('shirt fit')+ end+it 'renders selected filters' doclick_on 'Filter'diff --git a/core/app/models/spree/property.rb b/core/app/models/spree/property.rbindex 44ff82aa14..e66101bd30 100644--- a/core/app/models/spree/property.rb+++ b/core/app/models/spree/property.rb@@ -18,7 +18,7 @@ module Spreeafter_touch :touch_all_productsafter_save :ensure_product_properties_have_filter_params- self.whitelisted_ransackable_attributes = ['presentation']+ self.whitelisted_ransackable_attributes = ['presentation', 'filterable']def uniq_values(product_properties_scope: nil)with_uniq_values_cache_key(product_properties_scope) do