mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fixing a minor regression
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
Darkswarm.controller "ProductsCtrl", ($scope, $rootScope, Product, OrderCycle) ->
|
||||
$scope.products = Product.products
|
||||
$scope.loading = Product.loading
|
||||
$scope.Product = Product
|
||||
$scope.limit = 3
|
||||
$scope.ordering = {order: "name"}
|
||||
$scope.order_cycle = OrderCycle.order_cycle
|
||||
|
||||
$scope.incrementLimit = ->
|
||||
if $scope.limit < $scope.products.length
|
||||
if $scope.limit < $scope.Product.products.length
|
||||
$scope.limit = $scope.limit + 1
|
||||
|
||||
$scope.searchKeypress = (e)->
|
||||
|
||||
@@ -9,6 +9,7 @@ Darkswarm.factory 'Product', ($resource) ->
|
||||
loading: true
|
||||
|
||||
update: =>
|
||||
@loading = true
|
||||
@products = $resource("/shop/products").query =>
|
||||
@loading = false
|
||||
@
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
%div{bindonce: true}
|
||||
%product{"ng-controller" => "ProductNodeCtrl",
|
||||
"ng-repeat" => "product in products | filter:query | orderBy:ordering.order | limitTo: limit track by product.id"}
|
||||
"ng-repeat" => "product in Product.products | filter:query | orderBy:ordering.order | limitTo: limit track by product.id"}
|
||||
%div
|
||||
= render partial: "shop/products/summary"
|
||||
%div{"bo-if" => "hasVariants"}
|
||||
@@ -22,12 +22,10 @@
|
||||
.variants.row{"bo-if" => "!hasVariants"}
|
||||
= render partial: "shop/products/master"
|
||||
|
||||
%product{"ng-show" => "loading"}
|
||||
%product{"ng-show" => "Product.loading"}
|
||||
.row.summary
|
||||
.small-12.columns.text-center
|
||||
Loading products
|
||||
|
||||
|
||||
.row
|
||||
.small-12.columns
|
||||
%input.button.primary.right.add_to_cart{type: :submit, value: "Add to Cart"}
|
||||
|
||||
@@ -77,7 +77,6 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
page.should have_content "Next order closing in 2 days"
|
||||
Spree::Order.last.order_cycle.should == oc1
|
||||
page.should have_content product.name
|
||||
save_screenshot "/Users/willmarshall/Desktop/shop.png"
|
||||
page.should have_content product.master.display_name
|
||||
page.should have_content product.master.display_as
|
||||
end
|
||||
|
||||
@@ -18,4 +18,4 @@ describe 'ProductsCtrl', ->
|
||||
ctrl = $controller 'ProductsCtrl', {$scope: scope, Product: Product, OrderCycle: OrderCycle}
|
||||
|
||||
it 'fetches products from Product', ->
|
||||
expect(scope.products).toEqual 'testy mctest'
|
||||
expect(scope.Product.products).toEqual 'testy mctest'
|
||||
|
||||
Reference in New Issue
Block a user