mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Splitting between path and hashfragment for offcanvas and tabs respectively
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
window.MenuCtrl = Darkswarm.controller "MenuCtrl", ($scope, $location) ->
|
||||
$scope.toggleLogin = ->
|
||||
if $location.path() == "/login"
|
||||
$location.url("/")
|
||||
$location.path("/")
|
||||
else
|
||||
$location.url("login#sidebar")
|
||||
$location.path("login")
|
||||
|
||||
$scope.toggleSignup = ->
|
||||
if $location.path() == "/signup"
|
||||
$location.url("/")
|
||||
$location.path("/")
|
||||
else
|
||||
$location.url("signup#sidebar")
|
||||
$location.path("signup")
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
window.SidebarCtrl = Darkswarm.controller "SidebarCtrl", ($scope, $location) ->
|
||||
$scope.active = ->
|
||||
$location.hash() == "sidebar"
|
||||
$location.path() == "/login" || $location.path() == "/signup"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Darkswarm.controller "TabsCtrl", ($scope, $rootScope, $location) ->
|
||||
$scope.active = (path)->
|
||||
$location.path() == path
|
||||
$location.hash() == path
|
||||
|
||||
$scope.tabs = ["contact", "about", "groups", "producers"]
|
||||
for tab in $scope.tabs
|
||||
@@ -8,11 +8,10 @@ Darkswarm.controller "TabsCtrl", ($scope, $rootScope, $location) ->
|
||||
path: "/" + tab
|
||||
|
||||
$scope.select = (tab)->
|
||||
console.log tab
|
||||
if $scope.active(tab.path)
|
||||
$location.path "/"
|
||||
$location.hash "/"
|
||||
else
|
||||
$location.path tab.path
|
||||
$location.hash tab.path
|
||||
|
||||
|
||||
# directive -> ng-click -> scope method (not isolated) -> toggle active | change location
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%tab#login-content{"ng-controller" => "LoginSidebarCtrl",
|
||||
header: "Login",
|
||||
heading: "Login",
|
||||
active: "active()",
|
||||
select: "select()"}
|
||||
%form{"ng-submit" => "submit()"}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#sign-up-content{"ng-controller" => "SignupSidebarCtrl", "ng-show" => "active()"}
|
||||
%tab#sign-up-content{"ng-controller" => "SignupSidebarCtrl",
|
||||
header: "Signup",
|
||||
heading: "Signup",
|
||||
active: "active()",
|
||||
select: "select()"}
|
||||
%form{"ng-submit" => "submit()"}
|
||||
|
||||
Reference in New Issue
Block a user