woodpecker/server/app/scripts/controllers/conf.js
Christopher Brickley 270ce52b76 add gogs support
2014-11-18 21:50:05 -05:00

43 lines
905 B
JavaScript

'use strict';
angular.module('app').controller("ConfigController", function($scope, $http, remotes) {
$scope.state=0;
$scope.user = remotes.get().success(function (data) {
$scope.remotes = (typeof data==="string")?[]:data;
$scope.state = 1;
// loop through the remotes and add each
// remote to the page scope.
for (remote in $scope.remotes) {
switch (remote.type) {
case 'github.com':
$scope.github = remote;
break;
case 'enterprise.github.com':
$scope.githubEnterprise = remote;
break;
case 'gitlab.com':
$scope.gitlab = remote;
break;
case 'bitbucket.org':
$scope.bitbucket = remote;
break;
case 'stash.atlassian.com':
$scope.stash = remote;
break;
case 'gogs':
$scope.gogs = remote;
break;
}
}
})
.error(function (error) {
$scope.remotes = [];
$scope.state = 1;
});
});