Re-add changes to variant bulk show to fix 'I'm a teapot' fails

This commit is contained in:
Rob H
2014-03-28 16:47:52 +11:00
parent b74a845875
commit 00df441bc2
2 changed files with 4 additions and 4 deletions

View File

@@ -259,11 +259,11 @@ productEditModule.controller "AdminProductEditCtrl", [
$scope.addVariant = (product) ->
product.variants.push
id: $scope.nextVariantId()
price: null
unit_value: null
unit_description: null
on_demand: false
on_hand: null
price: null
$scope.displayProperties[product.id].showVariants = true
@@ -358,7 +358,6 @@ productEditModule.controller "AdminProductEditCtrl", [
# conflicted with some changes I made before merging my work, so for now I've reverted to the old way of
# doing things. TODO: Review together and decide on strategy here. -- Rohan, 14-1-2014
#if subset($scope.productsWithoutDerivedAttributes(), data)
if $scope.productListsMatch $scope.products, data
$scope.resetProducts data
$timeout -> $scope.displaySuccess()

View File

@@ -1,6 +1,7 @@
object @variant
attributes :id, :price, :options_text, :unit_value, :unit_description, :on_demand
attributes :id, :options_text, :unit_value, :unit_description, :on_demand
# Infinity is not a valid JSON object, but Rails encodes it anyway
node( :on_hand ) { |v| v.on_hand.to_f.finite? ? v.on_hand : "On demand" }
node( :on_hand ) { |v| v.on_hand.nil? ? 0 : ( v.on_hand.to_f.finite? ? v.on_hand : "On demand" ) }
node( :price ) { |v| v.price.nil? ? 0.to_f : v.price }