From patchwork Mon Aug 23 18:28:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raxel Gutierrez X-Patchwork-Id: 1519909 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=sIRbWXWE; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gtgk46Zzqz9sWX for ; Tue, 24 Aug 2021 04:29:00 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Gtgk42lpqz2xtf for ; Tue, 24 Aug 2021 04:29:00 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=sIRbWXWE; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=flex--raxel.bounces.google.com (client-ip=2607:f8b0:4864:20::b4a; helo=mail-yb1-xb4a.google.com; envelope-from=32ugjyqukcus4naryt11tyr.p1z2n6pu914xyv565.1cyno5.14t@flex--raxel.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=sIRbWXWE; dkim-atps=neutral Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Gtgjp5PT5z2xfJ for ; Tue, 24 Aug 2021 04:28:44 +1000 (AEST) Received: by mail-yb1-xb4a.google.com with SMTP id z2-20020a5b0b02000000b005982be23a34so10745080ybp.19 for ; Mon, 23 Aug 2021 11:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=rhGYgQ+1dbN4kD15eGE1td8rLlejAxVft0uKOsvl3o8=; b=sIRbWXWECzyscFD7McEgO7B7TVM/wODdaeX0B35TJZyFJooPgQX7osvMEK76cF4P9I enIE5iFjDxDMa1wzBGoMDmsso8/PwodJmBBmlXy52YJjQFVN3xZ+T8qUKrc0EidNVtIU hVcLAx2AESCPaio9wkwAFAhpnfYTHrGxW+j27KLy58fBOFeVTOq1svrIlYPkt/V4T72P lqNuRT/bOk1oLsvkZJjozUc3jlnFrLRNzrSOdQS1dT9d5ShRWPSNp7WoBK5htgMZ9ock GWPOkJd/+fAPNlxJFm7YyvVQFc20Mi3/54mmhfoKUeQyaajOmVf0RvVV+if/NKk9XUMa qdBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=rhGYgQ+1dbN4kD15eGE1td8rLlejAxVft0uKOsvl3o8=; b=s/I6dyAOxlTa/A55tNPecPfn8SuSgewWG3d54ndoFoxMCTAeV1vlye4kQmysZ2pvXd 42PqK91aCTBT01ljUTOj7Nd/Lxn+HoGZ3aV/s45nJmXVMgnmA3HZEZmZ61RI4iqv7Cqb h7jfBlEerI2GHFNXWTChP+HYwB41c23rDvNqpJ8d+cKoGFKuQ+CQFu80+gp26w6ZgXev bRpqltymIkWXSzvU9DuWnGU+BknxsGT8wWVp9njGtPNziFBCtUWAXRi3gzVTyiKEBdIl d7rZuEjNDhvsws71ABpc9UV93T4gZ0n9V92Xz3jKrKUQI3JSOJAi6Ij9FpU8hDkC5fq6 K4Xw== X-Gm-Message-State: AOAM533uwHRpPj65giPiq5sfZBa4BPySKUvtuWW2IYXE8EymmMJPDYYk 3ktmaQdkYHaIlI16Y2R/sWLFgvrXEJqVX9ODhAIB1DDqXCw5fC3KUmSB/GXZNTEXuFvJdyei+MH A4vDJs11ywcQ/RRVhh8JXUo1eWm8vXdCVm09VIyDEvEf3AVeQV0VK1mto6PJC25rs X-Google-Smtp-Source: ABdhPJwNEScLvB7gkOLLz7rQlDyqFVZJq1T0D79AjjUI7AdwlRUrxNBdHVCZ5ySaMJLUL3lw3aPuj13zSw== X-Received: from raxel-pw.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2fda]) (user=raxel job=sendgmr) by 2002:a25:818a:: with SMTP id p10mr43864493ybk.363.1629743322080; Mon, 23 Aug 2021 11:28:42 -0700 (PDT) Date: Mon, 23 Aug 2021 18:28:29 +0000 In-Reply-To: <20210823182833.3976100-1-raxel@google.com> Message-Id: <20210823182833.3976100-2-raxel@google.com> Mime-Version: 1.0 References: <20210823182833.3976100-1-raxel@google.com> X-Mailer: git-send-email 2.33.0.rc2.250.ged5fa647cd-goog Subject: [PATCH v4 1/5] patch-list: clean up patch-list page From: Raxel Gutierrez To: patchwork@lists.ozlabs.org X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Add ids to table cells, and rename selectors using hyphen delimited strings to clean up and improve readability of patch-list.html. Also, create a partial template errors.html for errors that render with form submission.These changes make the code healthier, ready for change, and overall more readable. No user-visible change should be noticed. Signed-off-by: Raxel Gutierrez --- htdocs/css/style.css | 16 ++-- htdocs/js/bundle.js | 12 +-- .../patchwork/partials/patch-list.html | 84 +++++++++---------- patchwork/templates/patchwork/submission.html | 6 +- patchwork/tests/views/test_bundles.py | 20 ++--- patchwork/tests/views/test_patch.py | 6 +- patchwork/views/__init__.py | 4 +- patchwork/views/bundle.py | 2 +- 8 files changed, 75 insertions(+), 75 deletions(-) diff --git a/htdocs/css/style.css b/htdocs/css/style.css index 9156aa6e..4ad503da 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -134,25 +134,25 @@ table.pw-list > thead { background-color: white; } -a.colinactive, a.colactive { +a.col-inactive, a.col-active { color: black; text-decoration: none; } -a.colinactive:hover { +a.col-inactive:hover { color: red; } div.filters { } -div.patchforms { +div.patch-forms { margin-top: 1em; } /* list order manipulation */ -table.patchlist tr.draghover { +table.patch-list tr.draghover { background: #e8e8e8 !important; } @@ -228,7 +228,7 @@ table.patch-meta tr th, table.patch-meta tr td { } /* checks forms */ -/* TODO(stephenfin): Merge this with 'div.patchform' rules */ +/* TODO(stephenfin): Merge this with 'div.patch-form' rules */ .checks { border: 1px solid gray; margin: 0.5em 1em; @@ -406,7 +406,7 @@ table.bundlelist td } /* forms that appear for a patch */ -div.patchform { +div.patch-form { border: thin solid #080808; padding-left: 0.6em; padding-right: 0.6em; @@ -414,7 +414,7 @@ div.patchform { margin: 0.5em 5em 0.5em 10px; } -div.patchform h3 { +div.patch-form h3 { margin-top: 0em; margin-left: -0.6em; margin-right: -0.6em; @@ -424,7 +424,7 @@ div.patchform h3 { font-size: 100%; } -div.patchform ul { +div.patch-form ul { list-style-type: none; padding-left: 0.2em; margin-top: 0em; diff --git a/htdocs/js/bundle.js b/htdocs/js/bundle.js index c969d0be..2a721d0d 100644 --- a/htdocs/js/bundle.js +++ b/htdocs/js/bundle.js @@ -6,8 +6,8 @@ function order_button_click(node) { var rows, form; - form = $("#reorderform"); - rows = $("#patchlist").get(0).tBodies[0].rows; + form = $("#reorder-form"); + rows = $("#patch-list").get(0).tBodies[0].rows; if (rows.length < 1) return; @@ -35,18 +35,18 @@ function order_button_click(node) $("#reorder\\-cancel").css("display", "inline"); /* show help text */ - $("#reorderhelp").text('Drag & drop rows to reorder'); + $("#reorder-help").text('Drag & drop rows to reorder'); /* enable drag & drop on the patches list */ - $("#patchlist").tableDnD({ + $("#patch-list").tableDnD({ onDragClass: 'dragging', onDragStart: function() { dragging = true; }, onDrop: function() { dragging = false; } }); /* replace zebra striping with hover */ - $("#patchlist tbody tr").css("background", "inherit"); - $("#patchlist tbody tr").hover(drag_hover_in, drag_hover_out); + $("#patch-list tbody tr").css("background", "inherit"); + $("#patch-list tbody tr").hover(drag_hover_in, drag_hover_out); } editing_order = !editing_order; diff --git a/patchwork/templates/patchwork/partials/patch-list.html b/patchwork/templates/patchwork/partials/patch-list.html index 02d6dff8..80ae6908 100644 --- a/patchwork/templates/patchwork/partials/patch-list.html +++ b/patchwork/templates/patchwork/partials/patch-list.html @@ -9,14 +9,14 @@ {% include "patchwork/partials/pagination.html" %} {% if order.editable %} - +
-
-
+
+ {% csrf_token %} - + - + - + @@ -52,9 +52,9 @@ $(document).ready(function() { {% csrf_token %} - + - @@ -72,23 +72,23 @@ $(document).ready(function() { @@ -174,9 +174,9 @@ $(document).ready(function() { {% for patch in page.object_list %} - + {% if user.is_authenticated %} - {% endif %} @@ -188,24 +188,24 @@ $(document).ready(function() { {% endif %} - - - - - - - - + + + + + + {% empty %} @@ -218,10 +218,10 @@ $(document).ready(function() { {% if page.paginator.count %} {% include "patchwork/partials/pagination.html" %} -
+
{% if patchform %} -
+

Properties

{% if order.name == "name" %} - + - + Patch {% else %} {% if not order.editable %} - Patch + Patch {% else %} - Patch + Patch {% endif %} {% endif %} - Series + Series @@ -101,70 +101,70 @@ $(document).ready(function() { {% if order.name == "date" %} - + - + Date {% else %} {% if not order.editable %} - Date + Date {% else %} - Date + Date {% endif %} {% endif %} {% if order.name == "submitter" %} - + - + Submitter {% else %} {% if not order.editable %} - + Submitter {% else %} - Submitter + Submitter {% endif %} {% endif %} {% if order.name == "delegate" %} - + - + Delegate {% else %} {% if not order.editable %} - Delegate + Delegate {% else %} - Delegate + Delegate {% endif %} {% endif %} {% if order.name == "state" %} - + - + State {% else %} {% if not order.editable %} - State + State {% else %} - State + State {% endif %} {% endif %}
+ + {{ patch.name|default:"[no subject]"|truncatechars:100 }} + {% if patch.series %} {{ patch.series|truncatechars:100 }} {% endif %} {{ patch|patch_tags }}{{ patch|patch_checks }}{{ patch.date|date:"Y-m-d" }}{{ patch.submitter|personify:project }}{{ patch.delegate.username }}{{ patch.state }}{{ patch|patch_tags }}{{ patch|patch_checks }}{{ patch.date|date:"Y-m-d" }}{{ patch.submitter|personify:project }}{{ patch.delegate.username }}{{ patch.state }}
@@ -257,7 +257,7 @@ $(document).ready(function() { {% endif %} {% if user.is_authenticated %} -
+

Bundling

diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html index 2238e82e..b617d366 100644 --- a/patchwork/templates/patchwork/submission.html +++ b/patchwork/templates/patchwork/submission.html @@ -135,9 +135,9 @@ {% endif %}
-
+
{% if patchform %} -
+

Patch Properties

{% csrf_token %} @@ -175,7 +175,7 @@ {% endif %} {% if createbundleform %} -
+

Bundling

diff --git a/patchwork/tests/views/test_bundles.py b/patchwork/tests/views/test_bundles.py index 6a744093..e265eb69 100644 --- a/patchwork/tests/views/test_bundles.py +++ b/patchwork/tests/views/test_bundles.py @@ -353,7 +353,7 @@ class BundleCreateFromListTest(BundleTestBase): def test_create_empty_bundle(self): newbundlename = 'testbundle-new' - params = {'form': 'patchlistform', + params = {'form': 'patch-list-form', 'bundle_name': newbundlename, 'action': 'Create', 'project': self.project.id} @@ -369,7 +369,7 @@ class BundleCreateFromListTest(BundleTestBase): newbundlename = 'testbundle-new' patch = self.patches[0] - params = {'form': 'patchlistform', + params = {'form': 'patch-list-form', 'bundle_name': newbundlename, 'action': 'Create', 'project': self.project.id, @@ -393,7 +393,7 @@ class BundleCreateFromListTest(BundleTestBase): n_bundles = Bundle.objects.count() - params = {'form': 'patchlistform', + params = {'form': 'patch-list-form', 'bundle_name': '', 'action': 'Create', 'project': self.project.id, @@ -414,7 +414,7 @@ class BundleCreateFromListTest(BundleTestBase): newbundlename = 'testbundle-dup' patch = self.patches[0] - params = {'form': 'patchlistform', + params = {'form': 'patch-list-form', 'bundle_name': newbundlename, 'action': 'Create', 'project': self.project.id, @@ -489,7 +489,7 @@ class BundleAddFromListTest(BundleTestBase): def test_add_to_empty_bundle(self): patch = self.patches[0] - params = {'form': 'patchlistform', + params = {'form': 'patch-list-form', 'action': 'Add', 'project': self.project.id, 'bundle_id': self.bundle.id, @@ -509,7 +509,7 @@ class BundleAddFromListTest(BundleTestBase): def test_add_to_non_empty_bundle(self): self.bundle.append_patch(self.patches[0]) patch = self.patches[1] - params = {'form': 'patchlistform', + params = {'form': 'patch-list-form', 'action': 'Add', 'project': self.project.id, 'bundle_id': self.bundle.id, @@ -538,7 +538,7 @@ class BundleAddFromListTest(BundleTestBase): count = self.bundle.patches.count() patch = self.patches[0] - params = {'form': 'patchlistform', + params = {'form': 'patch-list-form', 'action': 'Add', 'project': self.project.id, 'bundle_id': self.bundle.id, @@ -559,7 +559,7 @@ class BundleAddFromListTest(BundleTestBase): count = self.bundle.patches.count() patch = self.patches[0] - params = {'form': 'patchlistform', + params = {'form': 'patch-list-form', 'action': 'Add', 'project': self.project.id, 'bundle_id': self.bundle.id, @@ -650,7 +650,7 @@ class BundleInitialOrderTest(BundleTestBase): newbundlename = 'testbundle-new' # need to define our querystring explicity to enforce ordering - params = {'form': 'patchlistform', + params = {'form': 'patch-list-form', 'bundle_name': newbundlename, 'action': 'Create', 'project': self.project.id, @@ -704,7 +704,7 @@ class BundleReorderTest(BundleTestBase): patch=self.patches[start]).patch slice_ids = neworder_ids[start:end] - params = {'form': 'reorderform', + params = {'form': 'reorder-form', 'order_start': firstpatch.id, 'neworder': slice_ids} diff --git a/patchwork/tests/views/test_patch.py b/patchwork/tests/views/test_patch.py index 1a1243cf..22ee0c19 100644 --- a/patchwork/tests/views/test_patch.py +++ b/patchwork/tests/views/test_patch.py @@ -71,7 +71,7 @@ class PatchListOrderingTest(TestCase): date=date) def _extract_patch_ids(self, response): - id_re = re.compile(r'