-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These are only really valid in the frontend, and don't we don't gain anything by it living inside of core. This moves us forward to being able to deprecate Spree::Taxon.applicable_filters
- Loading branch information
Showing
5 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spree/core/product_filters' | ||
|
||
module Spree | ||
module TaxonFiltersHelper | ||
def applicable_filters_for(_taxon) | ||
[:brand_filter, :price_filter].map do |filter_name| | ||
Spree::Core::ProductFilters.send(filter_name) if Spree::Core::ProductFilters.respond_to?(filter_name) | ||
end.compact | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe Spree::TaxonFiltersHelper, type: :helper do | ||
let(:taxon) { nil } | ||
subject { applicable_filters_for(taxon) } | ||
|
||
it "returns the price/brand filters" do | ||
expect(subject.map { |y| y[:name] }).to eq ['Brands', 'Price Range'] | ||
end | ||
end |