From 142cef3f3a25057e47fbc5a9231f161279b18368 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sun, 19 Apr 2020 15:59:23 +0200 Subject: [PATCH] Add filters count --- .../darkswarm/controllers/products_controller.js.coffee | 3 +++ app/views/shop/products/_form.html.haml | 5 ++++- config/locales/en.yml | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee index 217118ee82..36aaa9a338 100644 --- a/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/products_controller.js.coffee @@ -94,3 +94,6 @@ Darkswarm.controller "ProductsCtrl", ($scope, $filter, $rootScope, Products, Ord $scope.Products.products = [] $scope.update_filters() $scope.loadProducts() + + $scope.filtersCount = () -> + $scope.taxonSelectors.totalActive() + $scope.propertySelectors.totalActive() diff --git a/app/views/shop/products/_form.html.haml b/app/views/shop/products/_form.html.haml index 7d7028578f..1db1c3e340 100644 --- a/app/views/shop/products/_form.html.haml +++ b/app/views/shop/products/_form.html.haml @@ -49,5 +49,8 @@ %input.small.button.primary.right.add_to_cart{type: :submit, value: "{{ Cart.dirty ? '#{t(:products_updating_cart)}' : (Cart.empty() ? '#{t(:products_cart_empty)}' : '#{t(:products_edit_cart)}' ) }}", "ng-disabled" => "Cart.dirty || Cart.empty()", "ng-class" => "{ dirty: Cart.dirty }" } .hide-for-medium-down.large-2.columns - %h5= t(:products_filter_by) + %h5 + = t(:products_filter_by) + %span{ng: {show: 'filtersCount()' }} + = "({{ filtersCount() }} #{t(:products_filter_selected)})" = render partial: "shop/products/filters" diff --git a/config/locales/en.yml b/config/locales/en.yml index 83a6c95025..86be792153 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1654,6 +1654,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using products_with: with products_search: "Search by product or producer" products_filter_by: "Filter by" + products_filter_selected: "selected" products_loading: "Loading products..." products_updating_cart: "Updating cart..." products_cart_empty: "Cart empty"