mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Take two on disabled logic
This commit is contained in:
@@ -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: =>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user