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
  • Loading branch information
andrepapoti authored and victor-accarini committed Jan 27, 2025
1 parent ca73edf commit c7fb7df
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions patchwork/templates/patchwork/submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@
<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 @@ -133,6 +133,20 @@ def patch_detail(request, project_id, msgid):
if errors:
context['errors'] = errors

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 c7fb7df

Please sign in to comment.