Move to Angular 1.5
This has been reasonably well tested, but further testing should be done on staging. Also optimizes avatar handling to use a constant size and not 404. Fixes #1434
This commit is contained in:
parent
dc42f22b79
commit
4aab834156
19 changed files with 91 additions and 133 deletions
|
@ -16,20 +16,38 @@ angular.module('quay').directive('avatar', function () {
|
|||
$scope.AvatarService = AvatarService;
|
||||
$scope.Config = Config;
|
||||
$scope.isLoading = true;
|
||||
$scope.hasGravatar = false;
|
||||
$scope.showGravatar = false;
|
||||
$scope.loadGravatar = false;
|
||||
|
||||
$scope.imageCallback = function(r) {
|
||||
$timeout(function() {
|
||||
$scope.isLoading = false;
|
||||
$scope.hasGravatar = r;
|
||||
}, 1);
|
||||
$scope.imageCallback = function(result) {
|
||||
$scope.isLoading = false;
|
||||
|
||||
if (!result) {
|
||||
$scope.showGravatar = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine whether the gravatar is blank.
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = 512;
|
||||
canvas.height = 512;
|
||||
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage($element.find('img')[0], 0, 0);
|
||||
|
||||
var blank = document.createElement("canvas");
|
||||
blank.width = 512;
|
||||
blank.height = 512;
|
||||
|
||||
var isBlank = canvas.toDataURL('text/png') == blank.toDataURL('text/png');
|
||||
$scope.showGravatar = !isBlank;
|
||||
};
|
||||
|
||||
$scope.$watch('size', function(size) {
|
||||
size = size * 1 || 16;
|
||||
$scope.fontSize = (size - 4) + 'px';
|
||||
$scope.lineHeight = size + 'px';
|
||||
$scope.imageSize = size;
|
||||
});
|
||||
|
||||
$scope.$watch('data', function(data) {
|
||||
|
|
|
@ -147,18 +147,6 @@ angular.module('quay').directive('headerBar', function () {
|
|||
});
|
||||
};
|
||||
|
||||
$scope.appLinkTarget = function() {
|
||||
if ($scope._appLinkTarget) {
|
||||
return $scope._appLinkTarget;
|
||||
}
|
||||
|
||||
if ($("div[ng-view]").length === 0) {
|
||||
return $scope._appLinkTarget = "_self";
|
||||
}
|
||||
|
||||
return $scope._appLinkTarget = "";
|
||||
};
|
||||
|
||||
$scope.getEnterpriseLogo = function() {
|
||||
return Config.getEnterpriseLogo(false);
|
||||
};
|
||||
|
|
|
@ -14,6 +14,8 @@ angular.module('quay').directive('popupInputButton', function () {
|
|||
'submitted': '&submitted'
|
||||
},
|
||||
controller: function($scope, $element) {
|
||||
$scope.patternMap = {};
|
||||
|
||||
$scope.popupShown = function() {
|
||||
setTimeout(function() {
|
||||
var box = $('#input-box');
|
||||
|
@ -26,7 +28,12 @@ angular.module('quay').directive('popupInputButton', function () {
|
|||
if (!pattern) {
|
||||
pattern = '.*';
|
||||
}
|
||||
return new RegExp(pattern);
|
||||
|
||||
if ($scope.patternMap[pattern]) {
|
||||
return $scope.patternMap[pattern];
|
||||
}
|
||||
|
||||
return $scope.patternMap[pattern] = new RegExp(pattern);
|
||||
};
|
||||
|
||||
$scope.inputSubmit = function() {
|
||||
|
|
|
@ -77,7 +77,12 @@ angular.module('quay').directive('signinForm', function () {
|
|||
if (redirectUrl == $location.path() || redirectUrl == null) {
|
||||
return;
|
||||
}
|
||||
window.location = (redirectUrl ? redirectUrl : '/');
|
||||
|
||||
if (redirectUrl) {
|
||||
window.location = redirectUrl
|
||||
} else {
|
||||
$location.path('/');
|
||||
}
|
||||
}, 500);
|
||||
}, function(result) {
|
||||
$scope.signingIn = false;
|
||||
|
|
Reference in a new issue