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']
|
repository_name = json['repository']
|
||||||
visibility = json['visibility']
|
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,
|
repo = model.create_repository(namespace_name, repository_name, owner,
|
||||||
visibility)
|
visibility)
|
||||||
repo.description = json['description']
|
repo.description = json['description']
|
||||||
|
|
|
@ -211,10 +211,14 @@
|
||||||
color: #444 !important;
|
color: #444 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.new-repo .new-header {
|
.new-repo .new-header span {
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.new-repo .new-header .popover {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
.new-repo .new-header .repo-circle {
|
.new-repo .new-header .repo-circle {
|
||||||
margin-right: 14px;
|
margin-right: 14px;
|
||||||
}
|
}
|
||||||
|
@ -398,6 +402,10 @@
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.landing .popover {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
.landing {
|
.landing {
|
||||||
color: white;
|
color: white;
|
||||||
|
|
||||||
|
|
|
@ -953,7 +953,7 @@ function V1Ctrl($scope, $location, UserService) {
|
||||||
}, true);
|
}, 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.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
|
||||||
$scope.user = currentUser;
|
$scope.user = currentUser;
|
||||||
}, true);
|
}, true);
|
||||||
|
@ -1079,6 +1079,8 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular, PlanSer
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.createNewRepo = function() {
|
$scope.createNewRepo = function() {
|
||||||
|
$('#repoName').popover('hide');
|
||||||
|
|
||||||
var uploader = $('#file-drop')[0];
|
var uploader = $('#file-drop')[0];
|
||||||
if ($scope.repo.initialize && uploader.files.length < 1) {
|
if ($scope.repo.initialize && uploader.files.length < 1) {
|
||||||
$('#missingfileModal').modal();
|
$('#missingfileModal').modal();
|
||||||
|
@ -1107,9 +1109,12 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular, PlanSer
|
||||||
|
|
||||||
// Otherwise, redirect to the repo page.
|
// Otherwise, redirect to the repo page.
|
||||||
$location.path('/repository/' + created.namespace + '/' + created.name);
|
$location.path('/repository/' + created.namespace + '/' + created.name);
|
||||||
}, function() {
|
}, function(result) {
|
||||||
$('#cannotcreateModal').modal();
|
|
||||||
$scope.creating = false;
|
$scope.creating = false;
|
||||||
|
$scope.createError = result.data;
|
||||||
|
$timeout(function() {
|
||||||
|
$('#repoName').popover('show');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container new-repo" ng-show="!user.anonymous && !creating && !uploading && !building">
|
<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 -->
|
<!-- Header -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
<span class="namespace-selector" user="user" namespace="repo.namespace"></span>
|
<span class="namespace-selector" user="user" namespace="repo.namespace"></span>
|
||||||
<span style="color: #ccc">/</span>
|
<span style="color: #ccc">/</span>
|
||||||
<span class="name-container">
|
<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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in a new issue