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 () {
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) { function UserLoginCtrl($scope, $window) {
// attempts to extract an error message from // attempts to extract an error message from
// the URL hash in format #error=? // the URL hash in format #error=?
@ -101,6 +113,7 @@
angular angular
.module('drone') .module('drone')
.controller('UserHeaderCtrl', UserHeaderCtrl)
.controller('UserLoginCtrl', UserLoginCtrl) .controller('UserLoginCtrl', UserLoginCtrl)
.controller('UserCtrl', UserCtrl) .controller('UserCtrl', UserCtrl)
.controller('UsersCtrl', UsersCtrl); .controller('UsersCtrl', UsersCtrl);

View file

@ -111,24 +111,12 @@
}, },
title: 'Users' 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', { .state('app.builds', {
url: '/:owner/:name', url: '/:owner/:name',
views: { views: {
'toolbar': { 'toolbar': {
templateUrl: '/static/scripts/views/builds/index/toolbar.html', templateUrl: '/static/scripts/views/builds/index/toolbar.html',
controller: 'RepoEditCtrl', controller: 'UserHeaderCtrl',
resolve: resolveUser resolve: resolveUser
}, },
'content': { 'content': {
@ -143,7 +131,7 @@
views: { views: {
'toolbar': { 'toolbar': {
templateUrl: '/static/scripts/views/repos/toolbar.html', templateUrl: '/static/scripts/views/repos/toolbar.html',
controller: 'RepoEditCtrl', controller: 'UserHeaderCtrl',
resolve: resolveUser resolve: resolveUser
}, },
'content': { 'content': {
@ -177,7 +165,7 @@
views: { views: {
'toolbar': { 'toolbar': {
templateUrl: '/static/scripts/views/builds/show/toolbar.html', templateUrl: '/static/scripts/views/builds/show/toolbar.html',
controller: 'BuildOutCtrl', controller: 'UserHeaderCtrl',
resolve: resolveUser resolve: resolveUser
}, },
'content': { 'content': {
@ -193,7 +181,7 @@
views: { views: {
'toolbar': { 'toolbar': {
templateUrl: '/static/scripts/views/builds/show/toolbar.html', templateUrl: '/static/scripts/views/builds/show/toolbar.html',
controller: 'BuildOutCtrl', controller: 'UserHeaderCtrl',
resolve: resolveUser resolve: resolveUser
}, },
'content': { 'content': {

View file

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

View file

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

View file

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