Skip to content

Commit 0fe3f5c

Browse files
committed
Add next button to navigate within a patch series
1 parent f37bd86 commit 0fe3f5c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

patchwork/templates/patchwork/submission.html

+9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
<h1>{{ submission.name }}</h1>
2121
</div>
2222

23+
{% if next_submission %}
24+
<div class="btn-group pull-right">
25+
<a class="btn btn-default"
26+
href="{% url 'patch-detail' project_id=project.linkname msgid=next_submission.encoded_msgid %}">
27+
next
28+
</a>
29+
</div>
30+
{% endif %}
31+
2332
<table id="patch-meta" class="patch-meta" data-submission-type={{submission|verbose_name_plural|lower}} data-submission-id={{submission.id}}>
2433
<tr>
2534
<th>Message ID</th>

patchwork/views/patch.py

+7
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ def patch_detail(request, project_id, msgid):
136136
related_same_project = []
137137
related_different_project = []
138138

139+
context['next_submission'] = None
140+
patch_series = patch.series.patches.all()
141+
num_patches = patch.series.patches.count()
142+
for idx in range(num_patches - 1):
143+
if patch.id == patch_series[idx].id:
144+
context['next_submission'] = patch_series[idx + 1]
145+
139146
context['comments'] = comments
140147
context['checks'] = Patch.filter_unique_checks(
141148
patch.check_set.all().select_related('user'),

0 commit comments

Comments
 (0)