mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Reworking the way the Sidebar works
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
window.LoginSidebarCtrl = Darkswarm.controller "LoginSidebarCtrl", ($scope, $http) ->
|
||||
window.LoginSidebarCtrl = Darkswarm.controller "LoginSidebarCtrl", ($scope, $http, $location) ->
|
||||
$scope.spree_user = {
|
||||
remember_me: 0
|
||||
}
|
||||
|
||||
$scope.active = ->
|
||||
$scope.active_sidebar == '/login'
|
||||
$location.path() == '/login'
|
||||
|
||||
$scope.submit = ->
|
||||
$http.post("/user/spree_user/sign_in", {spree_user: $scope.spree_user}).success (data)->
|
||||
location.href = location.origin + location.pathname # Strips out hash fragments
|
||||
.error (data) ->
|
||||
$scope.errors = data.message
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
window.MenuCtrl = Darkswarm.controller "MenuCtrl", ($scope, $location) ->
|
||||
$scope.toggleLogin = ->
|
||||
if $location.path() == "/login"
|
||||
$location.url("/")
|
||||
else
|
||||
$location.url("login#sidebar")
|
||||
|
||||
$scope.toggleSignup = ->
|
||||
if $location.path() == "/signup"
|
||||
$location.url("/")
|
||||
else
|
||||
$location.url("signup#sidebar")
|
||||
@@ -1,8 +1,3 @@
|
||||
window.SidebarCtrl = Darkswarm.controller "SidebarCtrl", ($scope, $location) ->
|
||||
$scope.$watch ->
|
||||
$location.path()
|
||||
, ->
|
||||
$scope.active_sidebar = $location.path()
|
||||
|
||||
$scope.active = ->
|
||||
return "active" if $scope.active_sidebar != null and $scope.active_sidebar != ""
|
||||
$location.hash() == "sidebar"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
window.SignupSidebarCtrl = Darkswarm.controller "SignupSidebarCtrl", ($scope, $http) ->
|
||||
window.SignupSidebarCtrl = Darkswarm.controller "SignupSidebarCtrl", ($scope, $http, $location) ->
|
||||
$scope.spree_user = {}
|
||||
$scope.errors =
|
||||
email: null
|
||||
password: null
|
||||
|
||||
$scope.active = ->
|
||||
$scope.active_sidebar == '/signup'
|
||||
$location.path() == '/signup'
|
||||
|
||||
$scope.submit = ->
|
||||
$http.post("/user/spree_user", {spree_user: $scope.spree_user}).success (data)->
|
||||
|
||||
Reference in New Issue
Block a user