From cf3681b93489350ddbb9ed3c3ec55e91dfbb2b73 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Fri, 11 Apr 2014 12:26:36 +1000 Subject: [PATCH] Moving over the new checkout authentication --- .../authentication_actions_controller.js.coffee | 12 ++++++++++++ app/views/shared/_menu.html.haml | 2 +- .../shop/checkout/_authentication.html.haml | 9 +++++++++ app/views/shop/checkout/edit.html.haml | 16 ++++------------ 4 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 app/assets/javascripts/darkswarm/controllers/authentication_actions_controller.js.coffee create mode 100644 app/views/shop/checkout/_authentication.html.haml diff --git a/app/assets/javascripts/darkswarm/controllers/authentication_actions_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/authentication_actions_controller.js.coffee new file mode 100644 index 0000000000..188867d7da --- /dev/null +++ b/app/assets/javascripts/darkswarm/controllers/authentication_actions_controller.js.coffee @@ -0,0 +1,12 @@ +window.AuthenticationActionsCtrl = Darkswarm.controller "AuthenticationActionsCtrl", ($scope, Navigation, storage) -> + $scope.toggleLogin = -> + Navigation.navigate "/login" + + $scope.toggleSignup = -> + Navigation.navigate "/signup" + + $scope.toggleSignup = -> + Navigation.navigate "/signup" + + $scope.toggle = (path = null)-> + Navigation.navigate(path) diff --git a/app/views/shared/_menu.html.haml b/app/views/shared/_menu.html.haml index 3ece58cf4d..f5aee8cc17 100644 --- a/app/views/shared/_menu.html.haml +++ b/app/views/shared/_menu.html.haml @@ -1,6 +1,6 @@ %nav.top-bar %section.top-bar-section - %ul.left{"ng-controller" => "MenuCtrl"} + %ul.left{"ng-controller" => "AuthenticationActionsCtrl"} %li %a.icon{"ng-click" => "toggle()"} %i.fi-list diff --git a/app/views/shop/checkout/_authentication.html.haml b/app/views/shop/checkout/_authentication.html.haml new file mode 100644 index 0000000000..891958de25 --- /dev/null +++ b/app/views/shop/checkout/_authentication.html.haml @@ -0,0 +1,9 @@ +%fieldset + %accordion-group{heading: "User", "is-open" => "accordion.user"} + .row + .large-4.columns.text-center{"ng-controller" => "AuthenticationActionsCtrl"} + %button{"ng-click" => "toggle('/login')"} Login + .large-4.columns.text-center{"ng-controller" => "AuthenticationActionsCtrl"} + %button{"ng-click" => "toggle('/signup')"} Signup + .large-4.columns.text-center + %button{"ng-click" => "show('details')"} Checkout as guest diff --git a/app/views/shop/checkout/edit.html.haml b/app/views/shop/checkout/edit.html.haml index 98cead9b9f..c3db3fddf6 100644 --- a/app/views/shop/checkout/edit.html.haml +++ b/app/views/shop/checkout/edit.html.haml @@ -6,21 +6,13 @@ = render partial: "shop/details" - %checkout - .row + %accordion.row{"close-others" => "true"} + %checkout{"ng-controller" => "CheckoutCtrl"} .large-9.columns - unless spree_current_user - .row - %section#checkout_login - .large-6.columns - = render partial: "shop/checkout/login" - %section#checkout_signup - .large-6.columns - = render partial: "shop/checkout/signup" + = render partial: "shop/checkout/authentication" .row = render partial: "shop/checkout/form" - .large-3.columns - .row - = render partial: "shop/checkout/summary" + = render partial: "shop/checkout/summary"