mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Performance enhancements
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
Darkswarm.controller "ProductNodeCtrl", ($scope, $modal) ->
|
||||
$scope.enterprise = $scope.product.supplier # For the modal, so it's consistent
|
||||
$scope.hasVariants = $scope.product.variants.length > 0
|
||||
|
||||
$scope.triggerProductModal = ->
|
||||
$modal.open(templateUrl: "product_modal.html", scope: $scope)
|
||||
|
||||
@@ -26,3 +26,5 @@ Darkswarm.factory 'Product', ($resource, Enterprises, Dereferencer, Taxons) ->
|
||||
if product.variants.length > 0
|
||||
prices = (v.price for v in product.variants)
|
||||
product.price = Math.min.apply(null, prices)
|
||||
|
||||
product.hasVariants = product.variants.length > 0
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
"ng-repeat" => "product in filteredProducts = (Product.products | products:query | taxons:activeTaxons | orderBy:ordering.order) track by product.id "}
|
||||
%div
|
||||
= render partial: "shop/products/summary"
|
||||
%div{"bo-if" => "hasVariants"}
|
||||
%div{"bo-if" => "product.hasVariants"}
|
||||
= render partial: "shop/products/variants"
|
||||
.variants.row{"bo-if" => "!hasVariants"}
|
||||
.variants.row{"bo-if" => "!product.hasVariants"}
|
||||
= render partial: "shop/products/master"
|
||||
|
||||
%product{"ng-show" => "Product.loading"}
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
%producer-modal {{ enterprise.name }}
|
||||
|
||||
.small-2.columns.summary-price.text-right.price
|
||||
%span{"ng-if" => "hasVariants"}
|
||||
%span{"ng-if" => "product.hasVariants"}
|
||||
%em from
|
||||
{{ product.price | currency }}
|
||||
|
||||
Reference in New Issue
Block a user