diff --git a/endpoints/api.py b/endpoints/api.py index 1ebe4f2a2..109fd95a7 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -221,13 +221,15 @@ def get_organization(orgname): def create_repo_api(): owner = current_user.db_user() - namespace_name = owner.username - repository_name = request.get_json()['repository'] - visibility = request.get_json()['visibility'] + # TODO(jake): Verify that the user can create a repo in this namespace. + json = request.get_json() + namespace_name = json['namespace'] if 'namespace' in json else owner.username + repository_name = json['repository'] + visibility = json['visibility'] repo = model.create_repository(namespace_name, repository_name, owner, visibility) - repo.description = request.get_json()['description'] + repo.description = json['description'] repo.save() return jsonify({ diff --git a/static/css/quay.css b/static/css/quay.css index 9f5001fc4..54f6a431c 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -2,6 +2,13 @@ font-family: 'Droid Sans', sans-serif; } +.namespace-selector-dropdown .namespace { + padding: 6px; + padding-left: 10px; + cursor: pointer; + font-size: 14px; +} + .user-notification { background: red; } diff --git a/static/directives/namespace-selector.html b/static/directives/namespace-selector.html new file mode 100644 index 000000000..de208f7c7 --- /dev/null +++ b/static/directives/namespace-selector.html @@ -0,0 +1,25 @@ + + {{user.username}} + +
+ + +
+
diff --git a/static/js/app.js b/static/js/app.js index 8510fcc40..24aa421af 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -231,6 +231,36 @@ quayApp.directive('repoCircle', function () { }); +quayApp.directive('namespaceSelector', function () { + var directiveDefinitionObject = { + priority: 0, + templateUrl: '/static/directives/namespace-selector.html', + replace: false, + transclude: false, + restrict: 'C', + scope: { + 'user': '=user', + 'namespace': '=namespace' + }, + controller: function($scope, $element) { + $scope.setNamespace = function(namespaceObj) { + if (!namespaceObj) { + namespaceObj = {'name': '', 'gravatar': ''}; + } + $scope.namespaceObj = namespaceObj; + $scope.namespace = namespaceObj.name || namespaceObj.username; + }; + $scope.setNamespace($scope.user); + + $scope.$watch('user', function(user) { + $scope.setNamespace(user); + }); + } + }; + return directiveDefinitionObject; +}); + + quayApp.directive('buildStatus', function () { var directiveDefinitionObject = { priority: 0, diff --git a/static/js/controllers.js b/static/js/controllers.js index 365c1dbca..2db06a8ef 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -1078,6 +1078,7 @@ function NewRepoCtrl($scope, $location, $http, UserService, Restangular, PlanSer $scope.creating = true; var repo = $scope.repo; var data = { + 'namespace': repo.namespace, 'repository': repo.name, 'visibility': repo.is_public == '1' ? 'public' : 'private', 'description': repo.description diff --git a/static/partials/new-repo.html b/static/partials/new-repo.html index 30cdd2316..1e6d938ec 100644 --- a/static/partials/new-repo.html +++ b/static/partials/new-repo.html @@ -28,8 +28,12 @@
- - {{user.username}} / + + + / + + +