Merge branch 'master' into orgs
Conflicts: endpoints/api.py static/partials/new-repo.html
This commit is contained in:
commit
633f603f9d
4 changed files with 25 additions and 6 deletions
|
@ -382,6 +382,12 @@ def create_repo_api():
|
|||
repository_name = json['repository']
|
||||
visibility = json['visibility']
|
||||
|
||||
existing = model.get_repository(namespace_name, repository_name)
|
||||
if existing:
|
||||
return make_response('Repository already exists', 400)
|
||||
|
||||
visibility = request.get_json()['visibility']
|
||||
|
||||
repo = model.create_repository(namespace_name, repository_name, owner,
|
||||
visibility)
|
||||
repo.description = json['description']
|
||||
|
|
|
@ -211,10 +211,14 @@
|
|||
color: #444 !important;
|
||||
}
|
||||
|
||||
.new-repo .new-header {
|
||||
.new-repo .new-header span {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.new-repo .new-header .popover {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.new-repo .new-header .repo-circle {
|
||||
margin-right: 14px;
|
||||
}
|
||||
|
@ -398,6 +402,10 @@
|
|||
padding: 20px;
|
||||
}
|
||||
|
||||
.landing .popover {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.landing {
|
||||
color: white;
|
||||
|
||||
|
|
|
@ -953,7 +953,7 @@ function V1Ctrl($scope, $location, UserService) {
|
|||
}, true);
|
||||
}
|
||||
|
||||
function NewRepoCtrl($scope, $location, $http, UserService, Restangular, PlanService) {
|
||||
function NewRepoCtrl($scope, $location, $http, $timeout, UserService, Restangular, PlanService) {
|
||||
$scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
|
||||
$scope.user = currentUser;
|
||||
}, true);
|
||||
|
@ -1079,6 +1079,8 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular, PlanSer
|
|||
};
|
||||
|
||||
$scope.createNewRepo = function() {
|
||||
$('#repoName').popover('hide');
|
||||
|
||||
var uploader = $('#file-drop')[0];
|
||||
if ($scope.repo.initialize && uploader.files.length < 1) {
|
||||
$('#missingfileModal').modal();
|
||||
|
@ -1107,9 +1109,12 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular, PlanSer
|
|||
|
||||
// Otherwise, redirect to the repo page.
|
||||
$location.path('/repository/' + created.namespace + '/' + created.name);
|
||||
}, function() {
|
||||
$('#cannotcreateModal').modal();
|
||||
}, function(result) {
|
||||
$scope.creating = false;
|
||||
$scope.createError = result.data;
|
||||
$timeout(function() {
|
||||
$('#repoName').popover('show');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</div>
|
||||
|
||||
<div class="container new-repo" ng-show="!user.anonymous && !creating && !uploading && !building">
|
||||
<form method="post" name="newRepoForm" ng-submit="createNewRepo()">
|
||||
<form method="post" name="newRepoForm" id="newRepoForm" ng-submit="createNewRepo()">
|
||||
|
||||
<!-- Header -->
|
||||
<div class="row">
|
||||
|
@ -32,7 +32,7 @@
|
|||
<span class="namespace-selector" user="user" namespace="repo.namespace"></span>
|
||||
<span style="color: #ccc">/</span>
|
||||
<span class="name-container">
|
||||
<input id="repoName" name="repoName" type="text" class="form-control" placeholder="Repository Name" ng-model="repo.name" required autofocus>
|
||||
<input id="repoName" name="repoName" type="text" class="form-control" placeholder="Repository Name" ng-model="repo.name" required autofocus data-trigger="manual" data-content="{{ createError }}" data-placement="right">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in a new issue