diff --git a/cmd/drone-server/static/scripts/controllers/users.js b/cmd/drone-server/static/scripts/controllers/users.js index 4ee361baf..d0849b3df 100644 --- a/cmd/drone-server/static/scripts/controllers/users.js +++ b/cmd/drone-server/static/scripts/controllers/users.js @@ -1,5 +1,17 @@ (function () { + function UserHeaderCtrl($scope, $stateParams, users) { + // Gets the currently authenticated user + users.getCurrent().then(function(payload){ + $scope.user = payload.data; + }); + + $scope.number = $stateParams.number || undefined; + $scope.owner = $stateParams.owner || undefined; + $scope.name = $stateParams.name || undefined; + $scope.full_name = $scope.owner + '/' + $scope.name; + } + function UserLoginCtrl($scope, $window) { // attempts to extract an error message from // the URL hash in format #error=? @@ -101,6 +113,7 @@ angular .module('drone') + .controller('UserHeaderCtrl', UserHeaderCtrl) .controller('UserLoginCtrl', UserLoginCtrl) .controller('UserCtrl', UserCtrl) .controller('UsersCtrl', UsersCtrl); diff --git a/cmd/drone-server/static/scripts/drone.js b/cmd/drone-server/static/scripts/drone.js index 3cc10e07b..93c612c59 100644 --- a/cmd/drone-server/static/scripts/drone.js +++ b/cmd/drone-server/static/scripts/drone.js @@ -111,24 +111,12 @@ }, title: 'Users' }) - .state('app.new_repo', { - url: '/new', - views: { - 'toolbar': {templateUrl: '/static/scripts/views/repos/add/toolbar.html'}, - 'content': { - templateUrl: '/static/scripts/views/repos/add/content.html', - controller: 'RepoAddCtrl', - resolve: resolveUser - } - }, - title: 'Add Repository' - }) .state('app.builds', { url: '/:owner/:name', views: { 'toolbar': { templateUrl: '/static/scripts/views/builds/index/toolbar.html', - controller: 'RepoEditCtrl', + controller: 'UserHeaderCtrl', resolve: resolveUser }, 'content': { @@ -143,7 +131,7 @@ views: { 'toolbar': { templateUrl: '/static/scripts/views/repos/toolbar.html', - controller: 'RepoEditCtrl', + controller: 'UserHeaderCtrl', resolve: resolveUser }, 'content': { @@ -177,7 +165,7 @@ views: { 'toolbar': { templateUrl: '/static/scripts/views/builds/show/toolbar.html', - controller: 'BuildOutCtrl', + controller: 'UserHeaderCtrl', resolve: resolveUser }, 'content': { @@ -193,7 +181,7 @@ views: { 'toolbar': { templateUrl: '/static/scripts/views/builds/show/toolbar.html', - controller: 'BuildOutCtrl', + controller: 'UserHeaderCtrl', resolve: resolveUser }, 'content': { diff --git a/cmd/drone-server/static/scripts/views/builds/index/toolbar.html b/cmd/drone-server/static/scripts/views/builds/index/toolbar.html index e17ed49c9..83dbfa9d4 100644 --- a/cmd/drone-server/static/scripts/views/builds/index/toolbar.html +++ b/cmd/drone-server/static/scripts/views/builds/index/toolbar.html @@ -4,5 +4,5 @@ arrow_back -