From: Stephen Finucane Date: Mon, 9 Jan 2017 11:49:03 +0000 (+0000) Subject: templates: Add "download series" links X-Git-Tag: v2.0.0-rc1~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e5bbee9ec97a0f961a83307458d95e5f9ed8a30;p=thirdparty%2Fpatchwork.git templates: Add "download series" links This will allow users to download entire series including the current patch. Since a patch can belong to many series a dropdown is used. Signed-off-by: Stephen Finucane Reviewed-by: Daniel Axtens --- diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html index a5914d78..dd1b9e39 100644 --- a/patchwork/templates/patchwork/submission.html +++ b/patchwork/templates/patchwork/submission.html @@ -288,6 +288,22 @@ function toggle_div(link_id, headers_id) mbox + {% if submission.series.all|length == 1 %} + series + {% elif submission.series.all|length > 1 %} + + + {% endif %} diff --git a/patchwork/tests/test_detail.py b/patchwork/tests/test_detail.py index cf296919..ef93bbf0 100644 --- a/patchwork/tests/test_detail.py +++ b/patchwork/tests/test_detail.py @@ -25,6 +25,7 @@ from django.test import TestCase from patchwork.tests.utils import create_comment from patchwork.tests.utils import create_cover from patchwork.tests.utils import create_patch +from patchwork.tests.utils import create_series class CoverLetterViewTest(TestCase): @@ -50,6 +51,21 @@ class PatchViewTest(TestCase): response = self.client.get(requested_url) self.assertRedirects(response, redirect_url) + def test_series_dropdown(self): + patch = create_patch() + series = [create_series() for x in range(5)] + + for series_ in series: + series_.add_patch(patch, 1) + + response = self.client.get( + reverse('patch-detail', kwargs={'patch_id': patch.id})) + + for series_ in series: + self.assertContains( + response, + reverse('series-mbox', kwargs={'series_id': series_.id})) + class CommentRedirectTest(TestCase):