mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Patched up popovers for our nefarious purposes + cart pretties
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
Darkswarm.directive "cart", ->
|
||||
restrict: 'A'
|
||||
link: (scope, elem, attr)->
|
||||
scope.open = false
|
||||
elem.bind 'click', ->
|
||||
scope.$apply ->
|
||||
scope.open = !scope.open
|
||||
@@ -0,0 +1,15 @@
|
||||
Darkswarm.directive "priceBreakdown", ($tooltip)->
|
||||
tooltip = $tooltip 'priceBreakdown', 'priceBreakdown', 'click'
|
||||
tooltip.scope =
|
||||
variant: "="
|
||||
tooltip
|
||||
|
||||
Darkswarm.directive 'priceBreakdownPopup', ()->
|
||||
restrict: 'EA'
|
||||
replace: true
|
||||
templateUrl: 'price_breakdown.html'
|
||||
scope: true
|
||||
#link: (scope, elem, attrs)->
|
||||
#angular.element($window).bind 'click', ->
|
||||
#scope.tt_isOpen = false
|
||||
#elem.remove()
|
||||
@@ -41,6 +41,12 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http)->
|
||||
@line_items.filter (li)->
|
||||
li.quantity > 0
|
||||
|
||||
total: =>
|
||||
@line_items_present().map (li)->
|
||||
li.variant.getPrice()
|
||||
.reduce (total, price)->
|
||||
total + price
|
||||
|
||||
register_variant: (variant)=>
|
||||
exists = @line_items.some (li)-> li.variant == variant
|
||||
@create_line_item(variant) unless exists
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
.joyride-tip-guide{"ng-class" => "{ in: isOpen(), fade: animation() }"}
|
||||
%span.joyride-nub.bottom
|
||||
.joyride-content-wrapper
|
||||
{{ variant.id }}
|
||||
@@ -1,5 +1,15 @@
|
||||
@import mixins
|
||||
@import branding
|
||||
@import "compass/css3/user-interface"
|
||||
|
||||
.cart
|
||||
@include user-select(none)
|
||||
.joyride-tip-guide
|
||||
display: block
|
||||
right: 0px
|
||||
top: 45px
|
||||
li
|
||||
float: none
|
||||
|
||||
#cart-detail
|
||||
.cart-item-delete
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
%a.icon{href: cart_url, "ng-controller" => "CartCtrl"}
|
||||
%span.nav-branded
|
||||
%i.ofn-i_027-shopping-cart
|
||||
%span
|
||||
{{ Cart.line_items_present().length }}
|
||||
items
|
||||
%ul
|
||||
%li{"ng-repeat" => "line_item in Cart.line_items_present()",
|
||||
"ng-controller" => "LineItemCtrl"}
|
||||
{{ line_item.id }}
|
||||
%span{"ng-controller" => "CartCtrl"}
|
||||
%a#cart.icon{cart: true}
|
||||
%span.nav-branded
|
||||
%i.ofn-i_027-shopping-cart
|
||||
%span
|
||||
{{ Cart.line_items_present().length }}
|
||||
items
|
||||
|
||||
.joyride-tip-guide{"ng-class" => "{ in: open }", "ng-show" => "open"}
|
||||
%span.joyride-nub.top
|
||||
.joyride-content-wrapper
|
||||
%ul
|
||||
%li{"ng-repeat" => "line_item in Cart.line_items_present()",
|
||||
"ng-controller" => "LineItemCtrl"}
|
||||
{{ line_item.variant.name_to_display }}
|
||||
({{line_item.quantity}})
|
||||
x
|
||||
{{ line_item.variant.unit_to_display }}
|
||||
x
|
||||
{{ line_item.variant.price | currency }}
|
||||
is
|
||||
{{ line_item.variant.getPrice() | currency }}
|
||||
%li{"ng-show" => "Cart.line_items_present().length > 0"}
|
||||
Total: {{ Cart.total() | currency }}
|
||||
%a.button{href: checkout_path, "ng-disabled" => "Cart.dirty"} Checkout now
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
%products.small-12.columns{"ng-controller" => "ProductsCtrl", "ng-show" => "order_cycle.order_cycle_id != null",
|
||||
"infinite-scroll" => "incrementLimit()", "infinite-scroll-distance" => "1"}
|
||||
|
||||
|
||||
= form_for :order, :url => populate_orders_path, html: {:class => "custom"} do
|
||||
%form.custom
|
||||
.row
|
||||
.small-12.columns
|
||||
%input#search.text{"ng-model" => "query",
|
||||
|
||||
@@ -47,8 +47,10 @@
|
||||
.table-cell
|
||||
%i.ofn-i_009-close
|
||||
{{ product.price | currency }}
|
||||
|
||||
%button.graph-button{popover: "This is the popover text", "popover-title" => "The title.", "popover-animation" => "true", "popover-trigger" =>"mouseenter", "popover-placement" => "top"}
|
||||
{{ $id }}
|
||||
%button.graph-button{"price-breakdown" => "_",
|
||||
"variant" => "product.master",
|
||||
"price-breakdown-animation" => "true"}
|
||||
%i.ofn-i-058-graph
|
||||
|
||||
.small-12.medium-2.large-2.columns.total-price.text-right
|
||||
|
||||
Reference in New Issue
Block a user