Skip to content

Commit

Permalink
Add next button to navigate within a patch series
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelsaura committed Jan 17, 2024
1 parent 0f6a2ba commit 5a395a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions patchwork/templates/patchwork/submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
<h1>{{ submission.name }}</h1>
</div>

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

<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
7 changes: 7 additions & 0 deletions patchwork/views/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ def patch_detail(request, project_id, msgid):
related_same_project = []
related_different_project = []

context['next_submission'] = None
patch_series = patch.series.patches.all()
num_patches = patch.series.patches.count()
for idx in range(num_patches - 1):
if patch.id == patch_series[idx].id:
context['next_submission'] = patch_series[idx + 1]

context['comments'] = comments
context['checks'] = Patch.filter_unique_checks(
patch.check_set.all().select_related('user'),
Expand Down

0 comments on commit 5a395a7

Please sign in to comment.