From 09613eb541a59d9fd64f0e34908a86b9e037f8dd Mon Sep 17 00:00:00 2001 From: Raxel Gutierrez Date: Mon, 23 Aug 2021 18:28:29 +0000 Subject: [PATCH] views: Clean up patch-list page 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 Signed-off-by: Stephen Finucane [stephenfin: Addressed merge conflicts and renamed some Python variables in snake_case also] --- htdocs/css/style.css | 16 +-- htdocs/js/bundle.js | 12 +- .../patchwork/partials/patch-list.html | 108 +++++++++--------- patchwork/templates/patchwork/submission.html | 32 +++--- patchwork/tests/views/test_bundles.py | 22 ++-- patchwork/tests/views/test_patch.py | 10 +- patchwork/views/__init__.py | 6 +- patchwork/views/bundle.py | 2 +- patchwork/views/patch.py | 16 +-- 9 files changed, 112 insertions(+), 112 deletions(-) diff --git a/htdocs/css/style.css b/htdocs/css/style.css index c4025c05..57c52e05 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -162,25 +162,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; } @@ -256,7 +256,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; @@ -434,7 +434,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; @@ -442,7 +442,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; @@ -452,7 +452,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 efefce91..48b81f3d 100644 --- a/patchwork/templates/patchwork/partials/patch-list.html +++ b/patchwork/templates/patchwork/partials/patch-list.html @@ -8,14 +8,14 @@ {% include "patchwork/partials/pagination.html" %} {% if order.editable %} - +
-
-
+
+ {% csrf_token %} - + - + @@ -26,7 +26,7 @@ {% if page.paginator.long_page and user.is_authenticated %} @@ -34,15 +34,15 @@