mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Improving the navigation by moving it all to a service, adding a generic icon
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
window.AccountSidebarCtrl = Darkswarm.controller "AccountSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
$scope.path = "/account"
|
||||
Navigation.paths.push $scope.path
|
||||
|
||||
$scope.active = ->
|
||||
$location.path() == $scope.path
|
||||
|
||||
$scope.select = ->
|
||||
Navigation.navigate($scope.path)
|
||||
@@ -1,12 +1,14 @@
|
||||
window.ForgotSidebarCtrl = Darkswarm.controller "ForgotSidebarCtrl", ($scope, $http, $location, SpreeUser) ->
|
||||
window.ForgotSidebarCtrl = Darkswarm.controller "ForgotSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
$scope.spree_user = SpreeUser.spree_user
|
||||
$scope.path = "/forgot"
|
||||
$scope.sent = false
|
||||
Navigation.paths.push $scope.path
|
||||
|
||||
$scope.active = ->
|
||||
$location.path() == '/forgot'
|
||||
$location.path() == $scope.path
|
||||
|
||||
$scope.select = ->
|
||||
$location.path("/forgot")
|
||||
Navigation.navigate($scope.path)
|
||||
|
||||
$scope.submit = ->
|
||||
if $scope.spree_user.email != null
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
window.LoginSidebarCtrl = Darkswarm.controller "LoginSidebarCtrl", ($scope, $http, $location, SpreeUser) ->
|
||||
window.LoginSidebarCtrl = Darkswarm.controller "LoginSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
$scope.spree_user = SpreeUser.spree_user
|
||||
$scope.path = "/login"
|
||||
Navigation.paths.push $scope.path
|
||||
|
||||
$scope.active = ->
|
||||
$location.path() == '/login'
|
||||
$location.path() == $scope.path
|
||||
|
||||
$scope.select = ->
|
||||
$location.path("/login")
|
||||
Navigation.navigate($scope.path)
|
||||
|
||||
|
||||
$scope.submit = ->
|
||||
$http.post("/user/spree_user/sign_in", {spree_user: $scope.spree_user}).success (data)->
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
window.MenuCtrl = Darkswarm.controller "MenuCtrl", ($scope, $location) ->
|
||||
window.MenuCtrl = Darkswarm.controller "MenuCtrl", ($scope, Navigation) ->
|
||||
|
||||
$scope.toggleLogin = ->
|
||||
if $location.path() == "/login"
|
||||
$location.path("/")
|
||||
else
|
||||
$location.path("login")
|
||||
Navigation.navigate "/login"
|
||||
|
||||
$scope.toggleSignup = ->
|
||||
if $location.path() == "/signup"
|
||||
$location.path("/")
|
||||
else
|
||||
$location.path("signup")
|
||||
Navigation.navigate "/signup"
|
||||
|
||||
$scope.toggle = ->
|
||||
Navigation.navigate()
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
window.SidebarCtrl = Darkswarm.controller "SidebarCtrl", ($scope, $location) ->
|
||||
$scope.sidebarPaths = ["/login", "/signup", "/forgot", "/account"]
|
||||
|
||||
$scope.active = ->
|
||||
$location.path() in ["/login", "/signup", "/forgot"]
|
||||
$location.path() in $scope.sidebarPaths
|
||||
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
window.SignupSidebarCtrl = Darkswarm.controller "SignupSidebarCtrl", ($scope, $http, $location, SpreeUser) ->
|
||||
window.SignupSidebarCtrl = Darkswarm.controller "SignupSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
$scope.spree_user = SpreeUser.spree_user
|
||||
$scope.path = "/signup"
|
||||
Navigation.paths.push $scope.path
|
||||
$scope.errors =
|
||||
email: null
|
||||
password: null
|
||||
|
||||
$scope.active = ->
|
||||
$location.path() == '/signup'
|
||||
$location.path() == $scope.path
|
||||
|
||||
$scope.select = ->
|
||||
$location.path("/signup")
|
||||
Navigation.navigate($scope.path)
|
||||
|
||||
$scope.submit = ->
|
||||
$http.post("/user/spree_user", {spree_user: $scope.spree_user}).success (data)->
|
||||
|
||||
Reference in New Issue
Block a user