Make sure to show public repos on the user and orgs pages

This commit is contained in:
Joseph Schorr 2015-04-03 14:55:09 -04:00
parent 2d8237bd83
commit 4cb7921c3a
6 changed files with 23 additions and 8 deletions

View file

@ -832,7 +832,7 @@ def get_visible_repository_count(username=None, include_public=True,
def get_visible_repositories(username=None, include_public=True, page=None,
limit=None, sort=False, namespace=None):
limit=None, sort=False, namespace=None, namespace_only=False):
query = _visible_repository_query(username=username, include_public=include_public, page=page,
limit=limit, namespace=namespace,
select_models=[Repository, Namespace, Visibility])
@ -843,6 +843,9 @@ def get_visible_repositories(username=None, include_public=True, page=None,
if limit:
query = query.limit(limit)
if namespace and namespace_only:
query = query.where(Namespace.username == namespace)
return query

View file

@ -109,6 +109,8 @@ class RepositoryList(ApiResource):
@query_param('sort', 'Whether to sort the results.', type=truthy_bool, default=False)
@query_param('count', 'Whether to include a count of the total number of results available.',
type=truthy_bool, default=False)
@query_param('namespace_only', 'Whether to limit only to the given namespace.',
type=truthy_bool, default=False)
def get(self, args):
"""Fetch the list of repositories under a variety of situations."""
username = None
@ -129,7 +131,8 @@ class RepositoryList(ApiResource):
repo_query = model.get_visible_repositories(username, limit=args['limit'], page=args['page'],
include_public=args['public'], sort=args['sort'],
namespace=args['namespace'])
namespace=args['namespace'],
namespace_only=args['namespace_only'])
def repo_view(repo_obj):
repo = {
'namespace': repo_obj.namespace_user.username,

View file

@ -3,6 +3,10 @@
margin-left: 6px;
}
.user-view .user-repo-list {
padding: 20px;
}
.user-view h3 {
margin-bottom: 20px;
margin-top: 0px;

View file

@ -31,9 +31,7 @@
var loadRepositories = function() {
var options = {
'public': false,
'private': true,
'sort': true,
'namespace_only': true,
'namespace': orgname,
};

View file

@ -22,9 +22,8 @@
var loadRepositories = function() {
var options = {
'public': false,
'private': true,
'sort': true,
'namespace_only': true,
'namespace': username,
};

View file

@ -10,7 +10,15 @@
</span>
</div>
<div class="cor-tab-panel">
<div class="co-main-content-panel user-repo-list" ng-if="!user.is_me">
<div class="repo-list-grid"
repositories-resource="repositoriesResource"
starred="false"
namespace="namespace"
hide-title="true"></div>
</div>
<div class="cor-tab-panel" ng-if="user.is_me">
<div class="cor-tabs" quay-show="user.is_me">
<span class="cor-tab" tab-active="true" tab-title="Repositories" tab-target="#repos">
<i class="fa fa-hdd-o"></i>