Redo the landing page to:
- Show the user's top repos if they have any - Show a link to the guide and the repos list if they do not - Add a getting starting guide - Redo the repos list to show the user's repos and the top 10 public repos separately
This commit is contained in:
parent
f12ed9859c
commit
927b280f1a
9 changed files with 220 additions and 23 deletions
|
@ -96,9 +96,11 @@ def get_token(code):
|
|||
return AccessToken.get(AccessToken.code == code)
|
||||
|
||||
|
||||
def get_visible_repositories(username=None):
|
||||
def get_visible_repositories(username=None, include_public=True, limit=None, sort=False):
|
||||
query = Repository.select().distinct().join(Visibility)
|
||||
or_clauses = [(Visibility.name == 'public')]
|
||||
or_clauses = []
|
||||
if include_public:
|
||||
or_clauses.append((Visibility.name == 'public'));
|
||||
|
||||
if username:
|
||||
with_perms = query.switch(Repository).join(RepositoryPermission,
|
||||
|
@ -106,8 +108,15 @@ def get_visible_repositories(username=None):
|
|||
query = with_perms.join(User)
|
||||
or_clauses.append(User.username == username)
|
||||
|
||||
return query.where(reduce(operator.or_, or_clauses))
|
||||
if sort:
|
||||
with_images = query.switch(Repository).join(Image, JOIN_LEFT_OUTER)
|
||||
query = with_images.order_by(Image.created.desc())
|
||||
|
||||
query = query.where(reduce(operator.or_, or_clauses))
|
||||
if limit:
|
||||
query = query.limit(limit)
|
||||
|
||||
return query
|
||||
|
||||
def get_matching_repositories(repo_term, username=None):
|
||||
namespace_term = repo_term
|
||||
|
|
Reference in a new issue