diff --git a/cmd/drone-server/static/index.html b/cmd/drone-server/static/index.html index 3c9e6ff6a..2afe9dc62 100644 --- a/cmd/drone-server/static/index.html +++ b/cmd/drone-server/static/index.html @@ -8,6 +8,7 @@ + diff --git a/cmd/drone-server/static/scripts/controllers/builds.js b/cmd/drone-server/static/scripts/controllers/builds.js index 974b14be0..2942e59ae 100644 --- a/cmd/drone-server/static/scripts/controllers/builds.js +++ b/cmd/drone-server/static/scripts/controllers/builds.js @@ -9,6 +9,8 @@ var name = $stateParams.name; var fullName = owner + '/' + name; + $scope.loading=true; + // Gets the currently authenticated user users.getCached().then(function (payload) { $scope.user = payload.data; @@ -17,6 +19,7 @@ // Gets a repository repos.get(fullName).then(function (payload) { $scope.repo = payload.data; + $scope.loading=false; }).catch(function (err) { $scope.error = err; }); diff --git a/cmd/drone-server/static/scripts/controllers/users.js b/cmd/drone-server/static/scripts/controllers/users.js index bc47527be..4ee361baf 100644 --- a/cmd/drone-server/static/scripts/controllers/users.js +++ b/cmd/drone-server/static/scripts/controllers/users.js @@ -58,6 +58,7 @@ $scope.add = function(event, login) { $scope.error = undefined; + $scope.new_user = undefined; if (event.which && event.which !== 13) { return; } @@ -67,6 +68,7 @@ $scope.users.push(payload.data); $scope.search_text=undefined; $scope.waiting = false; + $scope.new_user = payload.data; }).catch(function (err) { $scope.error = err; $scope.waiting = false; @@ -75,11 +77,21 @@ } $scope.toggle = function(user) { + if (user.login === $scope.user.login) { + // cannot revoke admin privilege for self + $scope.error = {}; // todo display an actual error here + return; + } user.admin = !user.admin; users.put(user); } $scope.remove = function(user) { + if (user.login === $scope.user.login) { + // cannot delete self + $scope.error = {}; // todo display an actual error here + return; + } users.delete(user).then(function(){ var index = $scope.users.indexOf(user); $scope.users.splice(index, 1); diff --git a/cmd/drone-server/static/scripts/filters/gravatar.js b/cmd/drone-server/static/scripts/filters/gravatar.js index 2fbe71f86..73dfa1d9e 100644 --- a/cmd/drone-server/static/scripts/filters/gravatar.js +++ b/cmd/drone-server/static/scripts/filters/gravatar.js @@ -8,7 +8,7 @@ */ function gravatar() { return function(hash) { - if (hash === undefined) { return ""; } + if (!hash) { return "http://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&f=y"; } return "https://secure.gravatar.com/avatar/"+hash+"?s=48&d=mm"; } } @@ -19,7 +19,7 @@ */ function gravatarLarge() { return function(hash) { - if (hash === undefined) { return ""; } + if (!hash) { return "http://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&f=y"; } return "https://secure.gravatar.com/avatar/"+hash+"?s=128&d=mm"; } } diff --git a/cmd/drone-server/static/scripts/views/builds/index/content.html b/cmd/drone-server/static/scripts/views/builds/index/content.html index b23266102..46fdc33e4 100644 --- a/cmd/drone-server/static/scripts/views/builds/index/content.html +++ b/cmd/drone-server/static/scripts/views/builds/index/content.html @@ -2,7 +2,7 @@