Prepare for having the queues in series list format.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
www/templates/series-list.html | 14 ++++++++++----
www/views.py | 19 ++++++++++++++-----
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/www/templates/series-list.html b/www/templates/series-list.html
index 27c0d9c..2e5b06e 100644
--- a/www/templates/series-list.html
+++ b/www/templates/series-list.html
@@ -11,14 +11,20 @@
<div class="col-lg-12">
<h2>
{% block title %}
- {% if is_search %}Search results{% else %}All series{% endif %}
- {% if project is not None %}for {{ project }}{% endif %}
+ {{ title }}
{% endblock %}
</h2>
-{% if not is_search %}
-<p><a href="{% url "project_detail" project=project %}">More information about {{ project }}...</a></p>
+
+{% if link_text %}
+<div class="status">
+<div class="status-content">
+ {% if link_icon %} <span class="fa-lg {{ link_icon }}"></span>{% endif %}
+ <div><a href="{{ link_url }}">{{ link_text }}</a></div>
+</div>
+</div>
{% endif %}
+
{% if series %}
<table class="table table-condensed table-striped">
<tr>
diff --git a/www/views.py b/www/views.py
index d328b43..5ce44f3 100644
--- a/www/views.py
+++ b/www/views.py
@@ -173,7 +173,9 @@ def prepare_navigate_list(cur, *path):
return r
-def render_series_list_page(request, query, search=None, project=None, keywords=[]):
+def render_series_list_page(request, query, search=None, project=None,
+ title='Search results', link_icon=None,
+ link_url=None, link_text=None, keywords=[]):
sort = request.GET.get("sort")
if sort == "replied":
query = query.order_by(F('last_reply_date').desc(nulls_last=True), '-date')
@@ -191,7 +193,6 @@ def render_series_list_page(request, query, search=None, project=None, keywords=
if sort:
params += "&" + urllib.parse.urlencode({"sort": sort})
if search is not None:
- is_search = True
params += "&" + urllib.parse.urlencode({"q": search})
cur = 'search "%s"' % search
if project:
@@ -201,18 +202,22 @@ def render_series_list_page(request, query, search=None, project=None, keywords=
else:
nav_path = prepare_navigate_list(cur)
else:
- is_search = False
search = "project:%s" % project
nav_path = prepare_navigate_list(project)
page_links = gen_page_links(query.count(), cur_page, PAGE_SIZE, params)
+ if project:
+ title += ' for ' + project
return render_page(
request,
"series-list.html",
series=prepare_series_list(request, series),
page_links=page_links,
search=search,
+ title=title,
project=project,
- is_search=is_search,
+ link_icon=link_icon,
+ link_url=link_url,
+ link_text=link_text,
keywords=keywords,
order_by_reply=order_by_reply,
navigate_links=nav_path,
@@ -269,7 +274,11 @@ def view_series_list(request, project):
if not prj:
raise Http404("Project not found")
query = api.models.Message.objects.series_heads(prj.id)
- return render_series_list_page(request, query, project=project)
+ return render_series_list_page(request, query, project=project,
+ title='All series',
+ link_icon='fa fa-list',
+ link_url=reverse("project_detail", kwargs={"project": project}),
+ link_text='More information about ' + project + '...')
def view_mbox(request, project, message_id):
--
2.34.1
_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel
© 2016 - 2024 Red Hat, Inc.