Make the new repo page support all the trigger types automatically.

This commit is contained in:
Joseph Schorr 2015-05-12 12:40:26 -04:00
parent 07b4fb9105
commit af5fc42f27
2 changed files with 17 additions and 11 deletions

View file

@ -19,6 +19,7 @@
UserService.updateUserIn($scope); UserService.updateUserIn($scope);
$scope.Features = Features; $scope.Features = Features;
$scope.TriggerService = TriggerService;
$scope.repo = { $scope.repo = {
'is_public': 0, 'is_public': 0,
@ -95,9 +96,10 @@
return; return;
} }
// Conduct the Github redirect if applicable. // Conduct the SCM redirect if applicable.
if ($scope.repo.initialize == 'github') { var redirectUrl = TriggerService.getRedirectUrl($scope.repo.initialize, repo.namespace, repo.name);
window.location = TriggerService.getRedirectUrl('github', repo.namespace, repo.name); if (redirectUrl) {
window.location = redirectUrl;
return; return;
} }

View file

@ -137,11 +137,14 @@
<label for="initDockerfile">Initialize from a <b>Dockerfile</b></label> <label for="initDockerfile">Initialize from a <b>Dockerfile</b></label>
</div> </div>
<!-- Github --> <!-- SCM -->
<div class="repo-option" ng-show="Features.GITHUB_BUILD"> <div class="repo-option"
<input type="radio" id="initGithub" name="initialize" ng-model="repo.initialize" value="github"> ng-repeat="type in TriggerService.getTypes()"
<i class="fa fa-github fa-lg" style="padding: 6px; padding-left: 10px; padding-right: 12px;"></i> ng-if="TriggerService.isEnabled(type)">
<label for="initGithub">Link to a GitHub Repository</label> <input type="radio" id="init{{type}}" name="initialize" ng-model="repo.initialize" value="{{ type }}">
<i class="fa fa-lg" ng-class="TriggerService.getIcon(type)"
style="padding: 6px; padding-left: 10px; padding-right: 12px;"></i>
<label for="init{{type}}">Link to a {{ TriggerService.getTitle(type) }}</label>
</div> </div>
</div> </div>
</div> </div>
@ -167,11 +170,12 @@
</div> </div>
</div> </div>
<div class="row" ng-show="repo.initialize == 'github'"> <div class="row"
ng-repeat="type in TriggerService.getTypes()"
ng-if="TriggerService.isEnabled(type) && repo.initialize == type">
<div class="col-md-12"> <div class="col-md-12">
<div class="co-alert co-alert-info"> <div class="co-alert co-alert-info">
You will be redirected to authorize via GitHub once the repository has been created You will be redirected to authorize for {{ TriggerService.getTitle(type) }} once the repository has been created
</div> </div>
</div> </div>
</div> </div>