Have user setup use a cookie to determine which section to have open by default
This commit is contained in:
parent
9dbbd33afc
commit
242f844055
2 changed files with 13 additions and 3 deletions
|
@ -8,7 +8,7 @@
|
|||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseSignin" class="panel-collapse collapse in">
|
||||
<div id="collapseSignin" class="panel-collapse collapse" ng-class="hasSignedIn() ? 'in' : 'out'">
|
||||
<div class="panel-body">
|
||||
<div class="signin-form" signed-in="signedIn()" sign-in-started="signInStarted()" redirect-url="redirectUrl"></div>
|
||||
</div>
|
||||
|
@ -22,7 +22,7 @@
|
|||
</a>
|
||||
</h6>
|
||||
</div>
|
||||
<div id="collapseRegister" class="panel-collapse collapse out">
|
||||
<div id="collapseRegister" class="panel-collapse collapse" ng-class="hasSignedIn() ? 'out' : 'in'">
|
||||
<div class="panel-body">
|
||||
<div class="signup-form"></div>
|
||||
</div>
|
||||
|
|
|
@ -90,7 +90,7 @@ function getMarkedDown(string) {
|
|||
|
||||
// Start the application code itself.
|
||||
quayApp = angular.module('quay', ['ngRoute', 'restangular', 'angularMoment', 'angulartics', 'angulartics.mixpanel', '$strap.directives', 'ngCookies'], function($provide) {
|
||||
$provide.factory('UserService', ['Restangular', function(Restangular) {
|
||||
$provide.factory('UserService', ['Restangular', '$cookies', function(Restangular, $cookies) {
|
||||
var userResponse = {
|
||||
verified: false,
|
||||
anonymous: true,
|
||||
|
@ -102,6 +102,10 @@ quayApp = angular.module('quay', ['ngRoute', 'restangular', 'angularMoment', 'an
|
|||
|
||||
var userService = {}
|
||||
|
||||
userService.hasEverLoggedIn = function() {
|
||||
return $cookies.loggedIn == 'true';
|
||||
};
|
||||
|
||||
userService.load = function(opt_callback) {
|
||||
var userFetch = Restangular.one('user/');
|
||||
userFetch.get().then(function(loadedUser) {
|
||||
|
@ -117,6 +121,8 @@ quayApp = angular.module('quay', ['ngRoute', 'restangular', 'angularMoment', 'an
|
|||
mixpanel.people.set_once({
|
||||
'$created': new Date()
|
||||
})
|
||||
|
||||
$cookies.loggedIn = 'true';
|
||||
}
|
||||
|
||||
if (opt_callback) {
|
||||
|
@ -661,6 +667,10 @@ quayApp.directive('userSetup', function () {
|
|||
$scope.sent = false;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.hasSignedIn = function() {
|
||||
return UserService.hasEverLoggedIn();
|
||||
};
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
|
|
Reference in a new issue