New Credentials dialog

Fixes #279
This commit is contained in:
Joseph Schorr 2016-04-29 19:37:35 -04:00
parent 972e4be811
commit 08d7b4babe
23 changed files with 1290 additions and 630 deletions

View file

@ -240,7 +240,7 @@ angular.module('quay').factory('UIService', ['$timeout', '$rootScope', '$locatio
el.dispatchEvent(ev);
};
uiService.initializeTabs = function(scope, element, opt_clickCallback) {
uiService.initializeTabs = function(scope, element, opt_clickCallback, opt_rememberCookie) {
var locationListener = null;
var disposed = false;
@ -314,32 +314,38 @@ angular.module('quay').factory('UIService', ['$timeout', '$rootScope', '$locatio
});
// Listen for route changes and update the tabs accordingly.
locationListener = $rootScope.$on('$routeUpdate', function(){
if ($location.search()['tab']) {
changeTab($location.search()['tab']);
} else {
resetDefaultTab();
}
});
if (!opt_rememberCookie) {
locationListener = $rootScope.$on('$routeUpdate', function(){
if ($location.search()['tab']) {
changeTab($location.search()['tab']);
} else {
resetDefaultTab();
}
});
}
// Listen for tab changes.
tabs.on('shown.bs.tab', function (e) {
// Invoke the callback, if any.
opt_clickCallback && opt_clickCallback();
// Update the search location.
var tabName = e.target.getAttribute('data-target').substr(1);
$rootScope.$apply(function() {
var isDefaultTab = tabs[0] == e.target;
var newSearch = $.extend($location.search(), {});
if (isDefaultTab) {
delete newSearch['tab'];
} else {
newSearch['tab'] = tabName;
}
// Update the search location or cookie.
if (opt_rememberCookie) {
// TODO: this
} else {
var tabName = e.target.getAttribute('data-target').substr(1);
$rootScope.$apply(function() {
var isDefaultTab = tabs[0] == e.target;
var newSearch = $.extend($location.search(), {});
if (isDefaultTab) {
delete newSearch['tab'];
} else {
newSearch['tab'] = tabName;
}
$location.search(newSearch);
});
$location.search(newSearch);
});
}
e.preventDefault();
});