Skip to content

Commit

Permalink
views: add series navigation buttons for patch-detail view
Browse files Browse the repository at this point in the history
Signed-off-by: andrepapoti <[email protected]>
  • Loading branch information
andrepapoti committed Apr 23, 2024
1 parent 235a186 commit ede319f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
16 changes: 16 additions & 0 deletions patchwork/templates/patchwork/submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@
<h1>{{ submission.name }}</h1>
</div>

<div class="btn-group pull-right">
<a class="btn btn-default {% if not next_submission %} disabled {% endif %}"
{% if next_submission %} href="{% url 'patch-detail' project_id=project.linkname msgid=next_submission.encoded_msgid %}" {% endif %}>
next
</a>
</div>

<div class="btn-group pull-right">
<a
class="btn btn-default {% if not previous_submission %} disabled {% endif %}"
{% if previous_submission %} href="{% url 'patch-detail' project_id=project.linkname msgid=previous_submission.encoded_msgid %}" {% endif %}
>
previous
</a>
</div>

<table id="patch-meta" class="patch-meta" data-submission-type={{submission|verbose_name_plural|lower}} data-submission-id={{submission.id}}>
<tr>
<th>Message ID</th>
Expand Down
14 changes: 14 additions & 0 deletions patchwork/views/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,20 @@ def patch_detail(request, project_id, msgid):
context['related_same_project'] = related_same_project
context['related_different_project'] = related_different_project

try:
context['previous_submission'] = Patch.objects.get(
series=patch.series, number=patch.number - 1
)
except Patch.DoesNotExist:
context['previous_submission'] = None

try:
context['next_submission'] = Patch.objects.get(
series=patch.series, number=patch.number + 1
)
except Patch.DoesNotExist:
context['next_submission'] = None

return render(request, 'patchwork/submission.html', context)


Expand Down

0 comments on commit ede319f

Please sign in to comment.