Splitting between path and hashfragment for offcanvas and tabs respectively

This commit is contained in:
Will Marshall
2014-03-26 17:15:45 +11:00
parent c118a86119
commit 007428b6dc
5 changed files with 10 additions and 11 deletions

View File

@@ -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")

View File

@@ -1,3 +1,3 @@
window.SidebarCtrl = Darkswarm.controller "SidebarCtrl", ($scope, $location) ->
$scope.active = ->
$location.hash() == "sidebar"
$location.path() == "/login" || $location.path() == "/signup"

View File

@@ -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

View File

@@ -1,5 +1,5 @@
%tab#login-content{"ng-controller" => "LoginSidebarCtrl",
header: "Login",
heading: "Login",
active: "active()",
select: "select()"}
%form{"ng-submit" => "submit()"}

View File

@@ -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()"}