diff --git a/app/assets/images/map-icon-both.svg b/app/assets/images/map-icon-both.svg index 08ffa25f6c..a51867f841 100644 --- a/app/assets/images/map-icon-both.svg +++ b/app/assets/images/map-icon-both.svg @@ -1,7 +1,7 @@ - diff --git a/app/assets/images/map-icon-hub.svg b/app/assets/images/map-icon-hub.svg index bb0e20aec4..fcd6a4913e 100644 --- a/app/assets/images/map-icon-hub.svg +++ b/app/assets/images/map-icon-hub.svg @@ -1,7 +1,7 @@ - diff --git a/app/assets/images/map-icon-producer.svg b/app/assets/images/map-icon-producer.svg index 1f2e4184a1..50ec792e91 100644 --- a/app/assets/images/map-icon-producer.svg +++ b/app/assets/images/map-icon-producer.svg @@ -1,7 +1,7 @@ - diff --git a/app/assets/javascripts/darkswarm/services/shipping_methods.js.coffee b/app/assets/javascripts/darkswarm/services/shipping_methods.js.coffee index 3980aa5fed..6d060179b3 100644 --- a/app/assets/javascripts/darkswarm/services/shipping_methods.js.coffee +++ b/app/assets/javascripts/darkswarm/services/shipping_methods.js.coffee @@ -4,5 +4,6 @@ Darkswarm.factory "ShippingMethods", (shippingMethods)-> shipping_methods_by_id: {} constructor: -> for method in @shipping_methods + method.price = parseFloat(method.price) @shipping_methods_by_id[method.id] = method diff --git a/app/assets/javascripts/templates/partials/contact.html.haml b/app/assets/javascripts/templates/partials/contact.html.haml index 0f7ffb033d..78828984c4 100644 --- a/app/assets/javascripts/templates/partials/contact.html.haml +++ b/app/assets/javascripts/templates/partials/contact.html.haml @@ -4,11 +4,11 @@ %p{"ng-if" => "enterprise.phone"} {{ enterprise.phone }} - %p{"ng-if" => "enterprise.email"} + %p.word-wrap{"ng-if" => "enterprise.email"} %a{"ng-href" => "{{enterprise.email | stripUrl}}", target: "_blank", mailto: true} %span.email {{ enterprise.email | stripUrl }} - %p{"ng-if" => "enterprise.website"} + %p.word-wrap{"ng-if" => "enterprise.website"} %a{"ng-href" => "http://{{enterprise.website | stripUrl}}", target: "_blank" } {{ enterprise.website | stripUrl }} diff --git a/app/assets/javascripts/templates/partials/enterprise_header.html.haml b/app/assets/javascripts/templates/partials/enterprise_header.html.haml index 7b1fc74a03..cb41670831 100644 --- a/app/assets/javascripts/templates/partials/enterprise_header.html.haml +++ b/app/assets/javascripts/templates/partials/enterprise_header.html.haml @@ -1,7 +1,7 @@ .highlight .highlight-top %p.right - {{ [enterprise.address.city, enterprise.address.state] | printArray}} + {{ [enterprise.address.city, enterprise.address.state_name] | printArray}} %h3{"ng-if" => "enterprise.is_distributor"} %a{"bo-href" => "enterprise.path", "ofn-empties-cart" => "enterprise", bindonce: true} %i.ofn-i_040-hub diff --git a/app/assets/javascripts/templates/partials/hub_actions.html.haml b/app/assets/javascripts/templates/partials/hub_actions.html.haml index 2ed8bf3f65..54b8ee98b1 100644 --- a/app/assets/javascripts/templates/partials/hub_actions.html.haml +++ b/app/assets/javascripts/templates/partials/hub_actions.html.haml @@ -11,6 +11,6 @@ %i.ofn-i_033-open-sign{"bo-if" => "hub.active"} %i.ofn-i_032-closed-sign{"bo-if" => "!hub.active"} {{hub.name}} - .button-address {{ hub.address.city }} , {{hub.address.state}} + .button-address {{ hub.address.city }} , {{hub.address.state_name}} %i.ofn-i_007-caret-right diff --git a/app/assets/javascripts/templates/partials/hub_details.html.haml b/app/assets/javascripts/templates/partials/hub_details.html.haml index 256494bb4a..8de1039f10 100644 --- a/app/assets/javascripts/templates/partials/hub_details.html.haml +++ b/app/assets/javascripts/templates/partials/hub_details.html.haml @@ -1,10 +1,10 @@ .row.pad-top{bindonce: true} .cta-container.small-12.columns .row - .small-12.large-6.columns - %label{"active-table-hub-link" => "enterprise", change: "Change hub to", shop: "Shop now at"} - .small-12.large-6.columns.right - .right{"bo-if" => "enterprise.pickup || enterprise.delivery"} + .small-4.columns + %label{"active-table-hub-link" => "enterprise", change: "Change hub to:", shop: "Shop now at:"} + .small-8.columns.right + %label.right{"bo-if" => "enterprise.pickup || enterprise.delivery"} Delivery options: %span{"bo-if" => "enterprise.pickup"} %i.ofn-i_038-takeaway @@ -20,5 +20,5 @@ %i.ofn-i_033-open-sign{"bo-if" => "enterprise.active"} %i.ofn-i_032-closed-sign{"bo-if" => "!enterprise.active"} {{enterprise.name}} - .button-address {{ enterprise.address.city }} , {{enterprise.address.state}} + .button-address {{ enterprise.address.city }} , {{enterprise.address.state_name}} %i.ofn-i_007-caret-right diff --git a/app/assets/javascripts/templates/price_breakdown.html.haml b/app/assets/javascripts/templates/price_breakdown.html.haml index 9317356d02..01588933ca 100644 --- a/app/assets/javascripts/templates/price_breakdown.html.haml +++ b/app/assets/javascripts/templates/price_breakdown.html.haml @@ -1,4 +1,4 @@ -.joyride-tip-guide{bindonce: true, "ng-class" => "{ in: tt_isOpen, fade: tt_animation }"} +.joyride-tip-guide.price_breakdown{bindonce: true, "ng-class" => "{ in: tt_isOpen, fade: tt_animation }"} %span.joyride-nub.right .joyride-content-wrapper .collapsed{"ng-show" => "!expanded"} @@ -11,7 +11,7 @@ %ul %li.cost .right {{ variant.base_price | currency }} - Cost + Item cost %li{"bo-if" => "variant.fees.admin"} .right {{ variant.fees.admin | currency }} Admin fee diff --git a/app/assets/javascripts/templates/price_percentage.html.haml b/app/assets/javascripts/templates/price_percentage.html.haml index 4982f63eb7..e577d86d7a 100644 --- a/app/assets/javascripts/templates/price_percentage.html.haml +++ b/app/assets/javascripts/templates/price_percentage.html.haml @@ -1,5 +1,5 @@ .progress .right Fees .meter - Cost + Item cost diff --git a/app/assets/stylesheets/darkswarm/_shop-popovers.css.sass b/app/assets/stylesheets/darkswarm/_shop-popovers.css.sass index b79350818f..1b511deb6c 100644 --- a/app/assets/stylesheets/darkswarm/_shop-popovers.css.sass +++ b/app/assets/stylesheets/darkswarm/_shop-popovers.css.sass @@ -1,15 +1,28 @@ @import mixins +@import branding // .darkswarm // product +ordercycle + .joyride-tip-guide + background-color: $clr-brick + .joyride-nub.right + border-color: $clr-brick !important + border-top-color: transparent !important + border-right-color: transparent !important + border-bottom-color: transparent !important + p + margin: 0 + font-weight: 700 // Pop over // Foundation overrides -.joyride-tip-guide +.joyride-tip-guide.price_breakdown // JS needs to be tweaked to adjust for left alignment - this is dynamic can't rewrite in CSS background-color: #999 color: #1f1f1f + margin-left: -8px @include box-shadow(0 1px 2px 0 rgba(0,0,0,0.7)) .joyride-content-wrapper @@ -23,7 +36,7 @@ color: #1f1f1f .joyride-nub.right - top: 40px + top: 38px border-color: #999 !important border-top-color: transparent !important border-right-color: transparent !important @@ -62,19 +75,17 @@ button.graph-button + z-index: 9999999 + border: 1px solid transparent + @include box-shadow(none) padding: 0 margin: 0 - @include border-radius(99999) + @include border-radius(999rem) display: inline background-color: rgba(255,255,255,0.5) - padding: 0.2rem + padding: 5px - &:focus - background-color: rgba(255,255,255,0.5) - i.ofn-i-058-graph - color: #999 - - &:hover, &:active + &:hover, &:active, &:focus background-color: rgba(255,255,255,1) i.ofn-i-058-graph color: $clr-brick-bright @@ -86,10 +97,11 @@ button.graph-button font-size: 1rem button.graph-button.open - background-color: #999 + @include box-shadow(inset 0 1px 1px 0 rgba(0,0,0,0.35)) + border: 1px solid #999 &:hover, &:active, &:focus - background-color: #b2b2b2 + background-color: rgba(255,255,255,1) i.ofn-i-058-graph color: $clr-brick-bright diff --git a/app/assets/stylesheets/darkswarm/_shop-product-rows.css.sass b/app/assets/stylesheets/darkswarm/_shop-product-rows.css.sass index fbe5949e74..c2aadf5a46 100644 --- a/app/assets/stylesheets/darkswarm/_shop-product-rows.css.sass +++ b/app/assets/stylesheets/darkswarm/_shop-product-rows.css.sass @@ -1,3 +1,5 @@ +@import branding.css.sass + .darkswarm products product @@ -25,9 +27,13 @@ .row.variants margin-left: 0 margin-right: 0 - background: url("/assets/gray_jean.png") top left repeat + background-color: #ECECEC + &:hover, &:focus, &:active + background-color: $clr-brick-light &:nth-of-type(even) - background: url("/assets/gray_jean_light.png") top left repeat + background-color: #f9f9f9 + &:hover, &:focus, &:active + background-color: $clr-brick-ultra-light // Variant name .variant-name @@ -72,7 +78,6 @@ .table-cell height: 27px - // ROW SUMMARY .row.summary margin-left: 0 @@ -108,7 +113,3 @@ - - - - diff --git a/app/assets/stylesheets/darkswarm/branding.css.sass b/app/assets/stylesheets/darkswarm/branding.css.sass index 737915086b..68f60dde53 100644 --- a/app/assets/stylesheets/darkswarm/branding.css.sass +++ b/app/assets/stylesheets/darkswarm/branding.css.sass @@ -8,12 +8,13 @@ // $clr-turquoise: #097563 // $clr-turquoise-light: #cef2ec // $clr-turquoise-ultra-light: #e6faf7 -// $clr-turquoise-bright: #1d8f7c +// $clr-turquoise-bright: #1d8f7c $clr-brick: #c1122b $clr-brick-light: #f5e6e7 $clr-brick-ultra-light: #faf5f6 $clr-brick-bright: #eb4c46 +$clr-brick-med-bright: #e5a2a0 $clr-brick-light-bright: #f5c4c9 $clr-turquoise: #0b8c61 diff --git a/app/assets/stylesheets/darkswarm/hub_node.css.sass b/app/assets/stylesheets/darkswarm/hub_node.css.sass index de0b1ca58c..d0b5dcc0ef 100644 --- a/app/assets/stylesheets/darkswarm/hub_node.css.sass +++ b/app/assets/stylesheets/darkswarm/hub_node.css.sass @@ -12,7 +12,7 @@ //Hub icon styline i.ofn-i_040-hub - @include border-radius(9999em) + @include border-radius(99999rem) font-size: 1.15rem display: inline-block padding: 0.2rem diff --git a/app/assets/stylesheets/darkswarm/map.css.sass b/app/assets/stylesheets/darkswarm/map.css.sass index 78d350d6be..53e8fb5768 100644 --- a/app/assets/stylesheets/darkswarm/map.css.sass +++ b/app/assets/stylesheets/darkswarm/map.css.sass @@ -8,6 +8,7 @@ map, .angular-google-map-container, google-map, .angular-google-map display: block height: 100% + width: 100% img // https://github.com/zurb/foundation/issues/112 max-width: none diff --git a/app/assets/stylesheets/darkswarm/modal-enterprises.css.sass b/app/assets/stylesheets/darkswarm/modal-enterprises.css.sass index 7991969a7d..837fd8e08a 100644 --- a/app/assets/stylesheets/darkswarm/modal-enterprises.css.sass +++ b/app/assets/stylesheets/darkswarm/modal-enterprises.css.sass @@ -60,19 +60,26 @@ // CALL TO ACTION - hub click throughs .cta-container - background: url("/assets/gray_jean.png") repeat + background-color: #ececec padding-top: 0.75rem label text-transform: uppercase font-size: 0.875rem - margin-bottom: 0.5rem + margin-bottom: 0 + 5rem color: $dark-grey + label.right + color: $disabled-dark + span + text-transform: capitalize + .button.secondary background-color: #999 .button.hub margin-right: 1rem + margin-top: 0.25rem margin-bottom: 1rem padding-left: 1rem padding-right: 1rem @@ -114,4 +121,4 @@ border-bottom: 1px solid $disabled-dark margin-top: 0.75rem margin-bottom: 0.5rem - + diff --git a/app/assets/stylesheets/darkswarm/modals.css.sass b/app/assets/stylesheets/darkswarm/modals.css.sass index 086ab8b076..0681dd73b4 100644 --- a/app/assets/stylesheets/darkswarm/modals.css.sass +++ b/app/assets/stylesheets/darkswarm/modals.css.sass @@ -4,29 +4,38 @@ dialog, .reveal-modal border: none outline: none - padding: 1rem - // TO DO: look at bigger issue scrolling on mobile device + padding: 1rem overflow-y: scroll - @media only screen and (min-width: 40.063em) - max-height: 580px - @media all and (max-width: 768px) - max-height: 440px - @media all and (max-width: 640px) - max-height: 400px - @media all and (max-width: 640px) - max-height: inherit + + // Sets up max heights based on device height + @media all and (min-height: 1025px) + max-height: 80% + + @media all and (min-height: 700px) and (max-height: 1024px) + max-height: 70% + + @media all and (min-height: 600px) and (max-height: 699px) + max-height: 60% + + @media all and (min-height: 481px) and (max-height: 599px) + max-height: 60% + + @media only screen and (max-height: 480px) and (min-width: 641px) + max-height: 60% + + @media all and (max-height: 480px) overflow-y: scroll + .reveal-modal-bg background-color: rgba(0,0,0,0.65) dialog .close-reveal-modal, .reveal-modal .close-reveal-modal - top: 0.45rem right: 0.4rem background-color: rgba(235,235,235,0.85) text-shadow: none padding: 0.3rem - @include border-radius(999999) + @include border-radius(999999rem) &:hover, &:active, &:focus background-color: rgba(235,235,235,1) color: #333 diff --git a/app/assets/stylesheets/darkswarm/shop.css.sass b/app/assets/stylesheets/darkswarm/shop.css.sass index 70b3997825..a2df3706c7 100644 --- a/app/assets/stylesheets/darkswarm/shop.css.sass +++ b/app/assets/stylesheets/darkswarm/shop.css.sass @@ -30,6 +30,7 @@ product + @include csstrans border-bottom: 1px solid #e5e5e5 border-top: 1px solid #e5e5e5 padding-bottom: 1px @@ -38,6 +39,10 @@ display: block color: #444 + &:hover, &:focus, &:active + border-bottom: 1px solid $clr-brick-med-bright + border-top: 1px solid $clr-brick-med-bright + // BULK .bulk-buy font-size: 0.875rem diff --git a/app/assets/stylesheets/darkswarm/shopping-cart.css.sass b/app/assets/stylesheets/darkswarm/shopping-cart.css.sass index 3a63bb7a2e..72856eba72 100644 --- a/app/assets/stylesheets/darkswarm/shopping-cart.css.sass +++ b/app/assets/stylesheets/darkswarm/shopping-cart.css.sass @@ -12,7 +12,7 @@ display: block right: 10px top: 55px - width: 400px + width: 480px @media screen and (max-width: 640px) width: 96% diff --git a/app/assets/stylesheets/darkswarm/typography.css.sass b/app/assets/stylesheets/darkswarm/typography.css.sass index 254a277055..b49ce867c1 100644 --- a/app/assets/stylesheets/darkswarm/typography.css.sass +++ b/app/assets/stylesheets/darkswarm/typography.css.sass @@ -34,6 +34,10 @@ small, .small margin-bottom: 0.5rem &, & * font-size: 0.875rem + +.word-wrap + word-wrap: break-word + .light color: #999 display: inline diff --git a/app/assets/stylesheets/darkswarm/ui.css.sass b/app/assets/stylesheets/darkswarm/ui.css.sass index 9d28e16787..a4d70392bb 100644 --- a/app/assets/stylesheets/darkswarm/ui.css.sass +++ b/app/assets/stylesheets/darkswarm/ui.css.sass @@ -58,10 +58,10 @@ text-shadow: 0 1px 0 $clr-brick button.success, .button.success - background: $clr-turquoise + background: #0096ad .button.success:hover, .button.success:active, .button.success:focus, button.success:hover, button.success:active, button.success:focus - background: $clr-turquoise-bright + background: #14b6cc // Responsive @media screen and (min-width: 768px) diff --git a/app/helpers/checkout_helper.rb b/app/helpers/checkout_helper.rb index 5faccb781d..171a672cda 100644 --- a/app/helpers/checkout_helper.rb +++ b/app/helpers/checkout_helper.rb @@ -1,18 +1,31 @@ module CheckoutHelper def checkout_adjustments_for_summary(order, opts={}) adjustments = order.adjustments.eligible + exclude = opts[:exclude] || {} # Remove empty tax adjustments and (optionally) shipping fees adjustments.reject! { |a| a.originator_type == 'Spree::TaxRate' && a.amount == 0 } - adjustments.reject! { |a| a.originator_type == 'Spree::ShippingMethod' } if opts[:exclude_shipping] + adjustments.reject! { |a| a.originator_type == 'Spree::ShippingMethod' } if exclude.include? :shipping enterprise_fee_adjustments = adjustments.select { |a| a.originator_type == 'EnterpriseFee' } adjustments.reject! { |a| a.originator_type == 'EnterpriseFee' } - adjustments << Spree::Adjustment.new(label: 'Distribution', amount: enterprise_fee_adjustments.sum(&:amount)) + unless exclude.include? :distribution + adjustments << Spree::Adjustment.new(label: 'Distribution', amount: enterprise_fee_adjustments.sum(&:amount)) + end adjustments end + def checkout_adjustments_total(order) + adjustments = checkout_adjustments_for_summary(order, exclude: [:shipping]) + adjustments.sum &:display_amount + end + + def checkout_cart_total_with_adjustments(order) + current_order.display_item_total.money.to_f + checkout_adjustments_total(current_order).money.to_f + end + + def validated_input(name, path, args = {}) attributes = { required: true, diff --git a/app/serializers/api/current_order_serializer.rb b/app/serializers/api/current_order_serializer.rb index 6275710789..9f939b09c1 100644 --- a/app/serializers/api/current_order_serializer.rb +++ b/app/serializers/api/current_order_serializer.rb @@ -10,4 +10,8 @@ class Api::CurrentOrderSerializer < ActiveModel::Serializer def payment_method_id object.payments.first.andand.payment_method_id end + + def display_total + object.display_total.money.to_f + end end diff --git a/app/views/checkout/_form.html.haml b/app/views/checkout/_form.html.haml index 68aaf2d781..aa2312ccee 100644 --- a/app/views/checkout/_form.html.haml +++ b/app/views/checkout/_form.html.haml @@ -10,9 +10,9 @@ angular.module('Darkswarm').value('order', #{render "checkout/order"}) %div - %h3.text-center.pad-top - Checkout from - = current_distributor.name + / %h3.text-center.pad-top + / Checkout from + / = current_distributor.name = render partial: "checkout/details", locals: {f: f} = render partial: "checkout/billing", locals: {f: f} diff --git a/app/views/checkout/_summary.html.haml b/app/views/checkout/_summary.html.haml index 60fb8ca80a..0e03af7413 100644 --- a/app/views/checkout/_summary.html.haml +++ b/app/views/checkout/_summary.html.haml @@ -1,22 +1,24 @@ %orderdetails = form_for current_order, url: "#", html: {"ng-submit" => "purchase($event)"} do |f| %fieldset - %legend Your Order + %legend Your order %table %tr - %th Produce - %td= current_order.display_item_total + %th Cart total + %td.cart-total.text-right= number_to_currency checkout_cart_total_with_adjustments(current_order) - - checkout_adjustments_for_summary(current_order, exclude_shipping: true).each do |adjustment| + - checkout_adjustments_for_summary(current_order, exclude: [:shipping, :distribution]).each do |adjustment| %tr %th= adjustment.label - %td= adjustment.display_amount.to_html + %td.text-right= adjustment.display_amount.to_html + %tr %th Shipping - %td {{ Checkout.shippingPrice() | currency }} + %td.shipping.text-right {{ Checkout.shippingPrice() | currency }} + %tr - %th Cart total - %td {{ Checkout.cartTotal() | currency }} + %th Total + %td.total.text-right {{ Checkout.cartTotal() | currency }} - if current_order.price_adjustment_totals.present? - current_order.price_adjustment_totals.each do |label, total| %tr diff --git a/app/views/checkout/edit.html.haml b/app/views/checkout/edit.html.haml index 156f435970..1c4932c481 100644 --- a/app/views/checkout/edit.html.haml +++ b/app/views/checkout/edit.html.haml @@ -2,9 +2,12 @@ .darkswarm - content_for :order_cycle_form do - %strong.avenir + + %closing Checkout now + %p Order ready for - = pickup_time current_order_cycle + %strong + = pickup_time current_order_cycle = render partial: "shopping_shared/details" diff --git a/app/views/shared/_footer.html.haml b/app/views/shared/_footer.html.haml index afe27bc02f..f8fa116f5a 100644 --- a/app/views/shared/_footer.html.haml +++ b/app/views/shared/_footer.html.haml @@ -43,7 +43,7 @@ %a{href:"https://creativecommons.org/licenses/by-sa/3.0/", target: "_blank" } Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) %p %small - %a{href:'' } Site terms & conditions + %a{href:"/Terms-of-service.pdf", target: "_blank" } Site terms & conditions | %a{href:"https://github.com/openfoodfoundation/openfoodnetwork", target: "_blank" } Open Source & developer info on Github diff --git a/app/views/shared/menu/_cart.html.haml b/app/views/shared/menu/_cart.html.haml index 907fda0eff..a61f80bf88 100644 --- a/app/views/shared/menu/_cart.html.haml +++ b/app/views/shared/menu/_cart.html.haml @@ -14,20 +14,21 @@ %li.product-cart{"ng-repeat" => "line_item in Cart.line_items_present()", "ng-controller" => "LineItemCtrl"} .row - .columns.small-6 + .columns.small-7 %small %strong {{ line_item.variant.name_to_display }} %em {{ line_item.variant.unit_to_display }} - .columns.small-3 - %small - {{line_item.quantity}} - x - {{ line_item.variant.price | currency }} - .columns.small-3.text-right + %small + {{line_item.quantity}} + %i.ofn-i_009-close + {{ line_item.variant.price | currency }} + + .columns.small-2 %small \= - %strong {{ line_item.variant.getPrice() | currency }} + %strong + .right {{ line_item.variant.getPrice() | currency }} %li.total-cart{"ng-show" => "Cart.line_items_present().length > 0"} .row @@ -36,5 +37,5 @@ .columns.small-6.text-right %strong {{ Cart.total() | currency }} - .text-right - %a.button.primary.small{href: checkout_path, "ng-disabled" => "Cart.dirty"} Checkout now + .text-right + %a.button.primary.small{href: checkout_path, "ng-disabled" => "Cart.dirty"} Quick checkout diff --git a/app/views/shop/products/_form.html.haml b/app/views/shop/products/_form.html.haml index a10edd7fb9..16e003c83e 100644 --- a/app/views/shop/products/_form.html.haml +++ b/app/views/shop/products/_form.html.haml @@ -12,7 +12,7 @@ %form{action: cart_path} .small-12.medium-4.large-3.columns - %input.button.primary.right.add_to_cart{type: :submit, value: "Checkout now", + %input.button.primary.right.add_to_cart{type: :submit, value: "Your shopping cart", "ng-disabled" => "Cart.dirty"} %div.pad-top{bindonce: true} @@ -38,6 +38,6 @@ .row .small-12.columns %form{action: cart_path} - %input.button.primary.right.add_to_cart{type: :submit, value: "Checkout now", + %input.button.primary.right.add_to_cart{type: :submit, value: "Your shopping cart", "ng-disabled" => "Cart.dirty"} diff --git a/app/views/shop/show.html.haml b/app/views/shop/show.html.haml index 4057823d52..048dd13e73 100644 --- a/app/views/shop/show.html.haml +++ b/app/views/shop/show.html.haml @@ -15,7 +15,7 @@ %select.avenir#order_cycle_id{"ng-model" => "order_cycle.order_cycle_id", "ng-change" => "changeOrderCycle()", "ng-options" => "oc.id as oc.time for oc in #{@order_cycles.map {|oc| {time: pickup_time(oc), id: oc.id}}.to_json}", - "popover-placement" => "bottom", "popover" => "When do you want to get your order?", "popover-trigger" => "openTrigger"} + "popover-placement" => "left", "popover" => "Choose when you want your order:", "popover-trigger" => "openTrigger"} diff --git a/app/views/spree/orders/_cart_item_description.html.haml b/app/views/spree/orders/_cart_item_description.html.haml index 9a516168bc..8c99781d5c 100644 --- a/app/views/spree/orders/_cart_item_description.html.haml +++ b/app/views/spree/orders/_cart_item_description.html.haml @@ -1,7 +1,7 @@ %td{'data-hook' => "cart_item_description"} - %h4= link_to variant.product.name, product_path(variant.product) + %h4= variant.product.name = variant.options_text - if @order.insufficient_stock_lines.include? line_item %span.out-of-stock = variant.in_stock? ? t(:insufficient_stock, :on_hand => variant.on_hand) : t(:out_of_stock) - %br/ \ No newline at end of file + %br/ diff --git a/app/views/spree/orders/edit.html.haml b/app/views/spree/orders/edit.html.haml index 4fdeea348b..5f8186e568 100644 --- a/app/views/spree/orders/edit.html.haml +++ b/app/views/spree/orders/edit.html.haml @@ -2,12 +2,14 @@ .darkswarm - content_for :order_cycle_form do - %strong.avenir - Order ready on - - if @order.order_cycle - = pickup_time @order.order_cycle - - else - = @order.distributor.next_collection_at + %closing Your shopping cart + %p + Order ready for + %strong + - if @order.order_cycle + = pickup_time @order.order_cycle + - else + = @order.distributor.next_collection_at = render partial: "shopping_shared/details" diff --git a/public/404.html b/public/404.html index 77830da9f7..b650949066 100644 --- a/public/404.html +++ b/public/404.html @@ -28,7 +28,7 @@
- +

It seems the page you're looking for is in a grump.

Return home

diff --git a/public/422.html b/public/422.html index b222475557..c6a93d7ab6 100644 --- a/public/422.html +++ b/public/422.html @@ -28,7 +28,7 @@
- +

The change you wanted was rejected. Maybe you tried to change something you don't have access to.

Return home

diff --git a/public/500.html b/public/500.html index 30379bc44d..5c7fa05f07 100644 --- a/public/500.html +++ b/public/500.html @@ -28,7 +28,7 @@
- +

We're sorry, but something went wrong.
Try refreshing the page, or

Return home

diff --git a/public/Terms-of-service.pdf b/public/Terms-of-service.pdf new file mode 100644 index 0000000000..603ffc8f86 Binary files /dev/null and b/public/Terms-of-service.pdf differ diff --git a/spec/features/consumer/groups_spec.rb b/spec/features/consumer/groups_spec.rb index 7baa5a2807..b2db10d58c 100644 --- a/spec/features/consumer/groups_spec.rb +++ b/spec/features/consumer/groups_spec.rb @@ -17,5 +17,6 @@ feature 'Groups', js: true do page.should have_content enterprise.name open_enterprise_modal enterprise modal_should_be_open_for enterprise + page.should have_content "Herndon, Vic" end end diff --git a/spec/features/consumer/shopping/checkout_spec.rb b/spec/features/consumer/shopping/checkout_spec.rb index 9c5d56e8aa..e3e2c9c4ad 100644 --- a/spec/features/consumer/shopping/checkout_spec.rb +++ b/spec/features/consumer/shopping/checkout_spec.rb @@ -10,27 +10,29 @@ feature "As a consumer I want to check out my cart", js: true do let(:distributor) { create(:distributor_enterprise) } let(:supplier) { create(:supplier_enterprise) } - let!(:order_cycle) { create(:simple_order_cycle, distributors: [distributor], coordinator: create(:distributor_enterprise)) } + let!(:order_cycle) { create(:simple_order_cycle, suppliers: [supplier], distributors: [distributor], coordinator: create(:distributor_enterprise), variants: [product.master]) } + let(:enterprise_fee) { create(:enterprise_fee, amount: 1.23) } let(:product) { create(:simple_product, supplier: supplier) } let(:order) { create(:order, order_cycle: order_cycle, distributor: distributor) } before do + add_enterprise_fee enterprise_fee set_order order add_product_to_cart end - it "shows the current distributor oncheckout" do + it "shows the current distributor on checkout" do visit checkout_path page.should have_content distributor.name end describe "with shipping methods" do let(:sm1) { create(:shipping_method, require_ship_address: true, name: "Frogs", description: "yellow") } - let(:sm2) { create(:shipping_method, require_ship_address: false, name: "Donkeys", description: "blue") } + let(:sm2) { create(:shipping_method, require_ship_address: false, name: "Donkeys", description: "blue", calculator: Spree::Calculator::FlatRate.new(preferred_amount: 4.56)) } before do - distributor.shipping_methods << sm1 - distributor.shipping_methods << sm2 + distributor.shipping_methods << sm1 + distributor.shipping_methods << sm2 end context "on the checkout page" do @@ -39,6 +41,15 @@ feature "As a consumer I want to check out my cart", js: true do checkout_as_guest end + it "shows a breakdown of the order price" do + toggle_shipping + choose sm2.name + + page.should have_selector 'orderdetails .cart-total', text: "$11.23" + page.should have_selector 'orderdetails .shipping', text: "$4.56" + page.should have_selector 'orderdetails .total', text: "$15.79" + end + it "shows all shipping methods, but doesn't show ship address when not needed" do toggle_shipping page.should have_content "Frogs" @@ -157,7 +168,7 @@ feature "As a consumer I want to check out my cart", js: true do # Order should have a payment with the correct amount o = Spree::Order.complete.first - o.payments.first.amount.should == 10 + o.payments.first.amount.should == 11.23 end it "shows the payment processing failed message when submitted with an invalid credit card" do diff --git a/spec/javascripts/unit/darkswarm/services/shipping_methods_spec.js.coffee b/spec/javascripts/unit/darkswarm/services/shipping_methods_spec.js.coffee new file mode 100644 index 0000000000..ebfba165f6 --- /dev/null +++ b/spec/javascripts/unit/darkswarm/services/shipping_methods_spec.js.coffee @@ -0,0 +1,14 @@ +describe "Shipping method service", -> + ShippingMethods = null + shippingMethods = [ + {id: 1, price: "1.2"} + ] + + beforeEach -> + module 'Darkswarm' + angular.module('Darkswarm').value('shippingMethods', shippingMethods) + inject ($injector)-> + ShippingMethods = $injector.get("ShippingMethods") + + it "converts price to float", -> + expect(ShippingMethods.shipping_methods[0].price).toEqual 1.2 diff --git a/spec/support/request/shop_workflow.rb b/spec/support/request/shop_workflow.rb index e8fd6e3b17..6c47d6f706 100644 --- a/spec/support/request/shop_workflow.rb +++ b/spec/support/request/shop_workflow.rb @@ -7,13 +7,21 @@ module ShopWorkflow have_selector ".price", text: price end + def add_enterprise_fee(enterprise_fee) + order_cycle.exchanges.outgoing.first.enterprise_fees << enterprise_fee + end + def set_order(order) ApplicationController.any_instance.stub(:session).and_return({order_id: order.id, access_token: order.token}) end def add_product_to_cart create(:line_item, variant: product.master, order: order) - order.reload.save! # Recalculate totals + order.reload + + # Recalculate totals + order.save! + order.update_distribution_charge! end def toggle_accordion(name)