Take two on disabled logic

This commit is contained in:
Rob Harrington
2015-01-15 17:34:04 +11:00
parent ac34da4f24
commit b3e67fa164
3 changed files with 10 additions and 11 deletions

View File

@@ -8,7 +8,6 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http)->
for line_item in @line_items
line_item.variant.line_item = line_item
Variants.register line_item.variant
@dirty = @empty()
orderChanged: =>
@unsaved()
@@ -32,7 +31,7 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http)->
saved: =>
@dirty = @empty()
@dirty = false
$(window).unbind "beforeunload"
unsaved: =>

View File

@@ -1,6 +1,6 @@
%span.cart-span{"ng-controller" => "CartCtrl", "ng-class" => "{ dirty: Cart.dirty }"}
%span.cart-span{"ng-controller" => "CartCtrl", "ng-class" => "{ dirty: Cart.dirty || Cart.empty() }"}
%a#cart.icon{cart: true}
%span.nav-branded
%span.nav-branded
%i.ofn-i_027-shopping-cart
%span
{{ Cart.line_items_present().length }}
@@ -23,19 +23,19 @@
%span.quantity {{ line_item.quantity }}
%i.ofn-i_009-close
%span.price {{ line_item.variant.price_with_fees | localizeCurrency }}
.columns.small-2
%small
\=
%strong
%strong
.total-price.right {{ line_item.variant.totalPrice() | localizeCurrency }}
%li.total-cart{"ng-show" => "Cart.line_items_present().length > 0"}
.row
.columns.small-6
%em Total:
%em Total:
.columns.small-6.text-right
%strong {{ Cart.total() | localizeCurrency }}
%strong {{ Cart.total() | localizeCurrency }}
.text-right
%a.button.primary.small{href: checkout_path, "ng-disabled" => "Cart.dirty"} Quick checkout
%a.button.primary.small{href: checkout_path, "ng-disabled" => "Cart.dirty || Cart.empty()"} Quick checkout

View File

@@ -13,7 +13,7 @@
%form{action: cart_path}
.small-12.medium-4.large-3.columns
%input.button.primary.right.add_to_cart{type: :submit, value: "Your shopping cart",
"ng-disabled" => "Cart.dirty"}
"ng-disabled" => "Cart.dirty || Cart.empty()"}
%div.pad-top{bindonce: true}
%product.animate-repeat{"ng-controller" => "ProductNodeCtrl",
@@ -42,5 +42,5 @@
.small-12.columns
%form{action: cart_path}
%input.button.primary.right.add_to_cart{type: :submit, value: "Your shopping cart",
"ng-disabled" => "Cart.dirty"}
"ng-disabled" => "Cart.dirty || Cart.empty()"}