Skip to content

Commit

Permalink
[SDP-357] Add additional filter partials
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandraKaminska authored and damianlegawiec committed Jun 23, 2020
1 parent 76834eb commit ff7d78a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/app/helpers/spree/frontend_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ def static_filters
@static_filters ||= Spree::Frontend::Config[:products_filters]
end

def additional_filters_partials
@additional_filters_partials ||= Spree::Frontend::Config[:additional_filters_partials]
end

def filtering_params
@filtering_params ||= available_option_types.map(&:filter_param).concat(static_filters)
end
Expand Down
1 change: 1 addition & 0 deletions frontend/app/models/spree/frontend_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class FrontendConfiguration < Preferences::Configuration
preference :coupon_codes_enabled, :boolean, default: true # Determines if we show coupon code form at cart and checkout
preference :locale, :string, default: Rails.application.config.i18n.default_locale
preference :products_filters, :array, default: %w(keywords price sort_by)
preference :additional_filters_partials, :array, default: %w()
preference :remember_me_enabled, :boolean, default: true
end
end
4 changes: 4 additions & 0 deletions frontend/app/views/spree/products/_filters_desktop.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
<% end %>
</div>
</div>

<% additional_filters_partials.each do |partial| %>
<%= render "spree/products/filters/#{partial}", permitted_params: permitted_params %>
<% end %>
</div>
</div>
<% end %>
4 changes: 4 additions & 0 deletions frontend/app/views/spree/products/_filters_mobile.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
</div>
</div>
</div>

<% additional_filters_partials.each do |partial| %>
<%= render "spree/products/filters/mobile/#{partial}", permitted_params: permitted_params %>
<% end %>
</div>
</div>
<% end %>
Expand Down

0 comments on commit ff7d78a

Please sign in to comment.