fixed issue w/ double-loading controllers

This commit is contained in:
Brad Rydzewski 2015-08-10 22:33:51 -07:00
parent c62ca29469
commit 25c905c7ed
5 changed files with 23 additions and 22 deletions

View file

@ -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);

View file

@ -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': {

View file

@ -4,5 +4,5 @@
<i class="material-icons">arrow_back</i>
</a>
</li>
<li>{{repo.owner}} / {{repo.name}}</li>
<li>{{owner}} / {{name}}</li>
</ol>

View file

@ -1,10 +1,10 @@
<ol>
<li>
<a ng-href="/{{ repo.full_name }}">
<a ng-href="/{{ full_name }}">
<i class="material-icons">arrow_back</i>
</a>
</li>
<li>{{repo.owner}} / {{repo.name}}</li>
<li>{{owner}} / {{name}}</li>
<li><i class="material-icons">chevron_right</i></li>
<li>{{build.number}}</li>
<li>{{number}}</li>
</ol>

View file

@ -1,8 +1,8 @@
<ol>
<li>
<a ng-href="/{{ repo.full_name}}">
<a ng-href="/{{ full_name}}">
<i class="material-icons">arrow_back</i>
</a>
</li>
<li>{{repo.owner}} / {{repo.name}}</li>
<li>{{owner}} / {{name}}</li>
</ol>