Klaus Demo klaus / 62592d1
Repos list: Add order by last updated link Jonas Haag 2 months ago
2 changed file(s) with 8 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
66 <h2>
77 Repositories
88 <span>
9 (<a href="?by-name=yep">order by name</a>)
9 {% if order_by == 'name' %}
10 (<a href="?">order by last updated</a>)
11 {% else %}
12 (<a href="?by-name=yep">order by name</a>)
13 {% endif %}
1014 </span>
1115 </h2>
1216 <ul class=repolist>
3232 def repo_list():
3333 """Show a list of all repos and can be sorted by last update."""
3434 if 'by-name' in request.args:
35 order_by = 'name'
3536 sort_key = lambda repo: repo.name
3637 else:
38 order_by = 'last_updated'
3739 sort_key = lambda repo: (-(repo.fast_get_last_updated_at() or -1), repo.name)
3840 repos = sorted([repo.freeze() for repo in current_app.valid_repos.values()],
3941 key=sort_key)
4042 invalid_repos = sorted(current_app.invalid_repos.values(), key=lambda repo: repo.name)
4143 return render_template('repo_list.html', repos=repos, invalid_repos=invalid_repos,
42 base_href=None)
44 order_by=order_by, base_href=None)
4345
4446
4547