diff --git a/app/assets/javascripts/darkswarm/controllers/authentication/signup_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/authentication/signup_controller.js.coffee index d15ef4141d..123079b6b5 100644 --- a/app/assets/javascripts/darkswarm/controllers/authentication/signup_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/authentication/signup_controller.js.coffee @@ -1,4 +1,4 @@ -Darkswarm.controller "SignupCtrl", ($scope, $http, $location, AuthenticationService) -> +Darkswarm.controller "SignupCtrl", ($scope, $http, $window, $location, Redirections, AuthenticationService) -> $scope.path = "/signup" $scope.errors = email: null @@ -6,6 +6,9 @@ Darkswarm.controller "SignupCtrl", ($scope, $http, $location, AuthenticationServ $scope.submit = -> $http.post("/user/spree_user", {spree_user: $scope.spree_user}).success (data)-> - location.href = location.origin + location.pathname # Strips out hash fragments + if Redirections.after_login + $window.location.href = $window.location.origin + Redirections.after_login + else + $window.location.href = $window.location.origin + $window.location.pathname # Strips out hash fragments .error (data) -> $scope.errors = data diff --git a/app/assets/javascripts/darkswarm/controllers/authentication_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/authentication_controller.js.coffee index 7c45fd53d1..1a22f34b0c 100644 --- a/app/assets/javascripts/darkswarm/controllers/authentication_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/authentication_controller.js.coffee @@ -1,7 +1,7 @@ Darkswarm.controller "AuthenticationCtrl", ($scope, AuthenticationService, SpreeUser)-> $scope.open = AuthenticationService.open $scope.toggle = AuthenticationService.toggle - + $scope.spree_user = SpreeUser.spree_user $scope.active = AuthenticationService.active $scope.select = AuthenticationService.select diff --git a/app/assets/javascripts/darkswarm/services/authentication_service.js.coffee b/app/assets/javascripts/darkswarm/services/authentication_service.js.coffee index ff7db62f4a..2dad1bc4f2 100644 --- a/app/assets/javascripts/darkswarm/services/authentication_service.js.coffee +++ b/app/assets/javascripts/darkswarm/services/authentication_service.js.coffee @@ -4,12 +4,14 @@ Darkswarm.factory "AuthenticationService", (Navigation, $modal, $location, Redir selectedPath: "/login" constructor: -> - if $location.path() in ["/login", "/signup", "/forgot"] - @open() + if $location.path() in ["/login", "/signup", "/forgot"] && location.pathname is not '/register/auth' + @open $location.path() + else if location.pathname is '/register/auth' + @open '/signup', 'registration_authentication.html' - open: (path = false)=> + open: (path = false, template = 'authentication.html') => @modalInstance = $modal.open - templateUrl: 'authentication.html' + templateUrl: template windowClass: "login-modal medium" @modalInstance.result.then @close, @close @selectedPath = path || @selectedPath diff --git a/app/assets/javascripts/darkswarm/services/registration_service.js.coffee b/app/assets/javascripts/darkswarm/services/registration_service.js.coffee index 025c403358..a2a1fe2dc4 100644 --- a/app/assets/javascripts/darkswarm/services/registration_service.js.coffee +++ b/app/assets/javascripts/darkswarm/services/registration_service.js.coffee @@ -14,7 +14,7 @@ Darkswarm.factory "RegistrationService", (Navigation, $modal, Loading)-> select: (step)=> @current_step = step - + currentStep: => @current_step diff --git a/app/assets/javascripts/templates/registration/about.html.haml b/app/assets/javascripts/templates/registration/about.html.haml index e2dad4a66b..b1065d104c 100644 --- a/app/assets/javascripts/templates/registration/about.html.haml +++ b/app/assets/javascripts/templates/registration/about.html.haml @@ -7,9 +7,9 @@ %ofn-inline-flash.turquoise.small-12.columns{ ng: { show: 'visible' } } %i.ofn-i_009-close.close-button{ ng: { click: 'closeFlash()' } } {{ enterprise.name }} has been created on the Open Food Network. If you leave at any point from here onwards, your enterprise will be saved, and you can always login to the admin section to update or continue filling out your enterprise details. - %ofn-inline-flash.brick.small-12.columns{ ng: { show: 'visible' } } - %i.ofn-i_009-close.close-button{ ng: { click: 'closeFlash()' } } - {{ enterprise.name }} won't be visible on the Open Food Network until you enter a long and short description. + -# %ofn-inline-flash.brick.small-12.columns{ ng: { show: 'visible' } } + -# %i.ofn-i_009-close.close-button{ ng: { click: 'closeFlash()' } } + -# {{ enterprise.name }} won't be visible on the Open Food Network until you enter a long and short description. .small-12.large-8.columns .row diff --git a/app/assets/javascripts/templates/registration_authentication.html.haml b/app/assets/javascripts/templates/registration_authentication.html.haml new file mode 100644 index 0000000000..c7bfbabeca --- /dev/null +++ b/app/assets/javascripts/templates/registration_authentication.html.haml @@ -0,0 +1,17 @@ +.container + .row.modal-centered + %h2 Welcome to the Open Food Network! + %h5 Start By Signing Up (or logging in): + %div{"ng-controller" => "AuthenticationCtrl"} + %tabset + %ng-include{src: "'signup.html'"} + %ng-include{src: "'login.html'"} + %ng-include{src: "'forgot.html'"} + %div{ ng: { show: "active('/signup')"} } + %hr + Already have an account? + %a{ href: "", ng: { click: "select('/login')"}} + Log in now. + +%a.close-reveal-modal{"ng-click" => "$close()"} + %i.ofn-i_009-close diff --git a/app/assets/javascripts/templates/signup.html.haml b/app/assets/javascripts/templates/signup.html.haml index db066685f1..28bec19b49 100644 --- a/app/assets/javascripts/templates/signup.html.haml +++ b/app/assets/javascripts/templates/signup.html.haml @@ -1,12 +1,12 @@ -%tab#sign-up-content{"ng-controller" => "SignupCtrl", - heading: "Sign up", +%tab#sign-up-content{"ng-controller" => "SignupCtrl", + heading: "Sign up", active: "active(path)", select: "select(path)"} %form{"ng-submit" => "submit()"} .row .large-12.columns %label{for: "email"} Your email - %input.title.input-text{name: "email", + %input.title.input-text{name: "email", type: "email", id: "email", tabindex: 1, @@ -16,7 +16,7 @@ .row .large-12.columns %label{for: "password"} Choose a password - %input.title.input-text{name: "password", + %input.title.input-text{name: "password", type: "password", id: "password", autocomplete: "off", @@ -27,7 +27,7 @@ .row .large-12.columns %label{for: "password_confirmation"} Confirm password - %input.title.input-text{name: "password_confirmation", + %input.title.input-text{name: "password_confirmation", type: "password", id: "password_confirmation", autocomplete: "off", @@ -35,7 +35,7 @@ "ng-model" => "spree_user.password_confirmation"} .row .large-12.columns - %input.button.primary{name: "commit", - tabindex: "3", - type: "submit", + %input.button.primary{name: "commit", + tabindex: "3", + type: "submit", value: "Sign up now"} diff --git a/app/controllers/registration_controller.rb b/app/controllers/registration_controller.rb index 2915f71639..c378d24215 100644 --- a/app/controllers/registration_controller.rb +++ b/app/controllers/registration_controller.rb @@ -7,7 +7,7 @@ class RegistrationController < BaseController def index if spree_current_user.nil? - redirect_to registration_auth_path(anchor: "login?after_login=/register") + redirect_to registration_auth_path(anchor: "signup?after_login=/register") end end end