[PATCH v3 02/10] patch-detail: clean up patch detail page template

Raxel Gutierrez raxel at google.com
Fri Aug 13 15:31:19 AEST 2021


Clean up submission.html to have hyphen-delimited id and class selectors
names for better readability and code health.

Signed-off-by: Raxel Gutierrez <raxel at google.com>
---
 htdocs/css/style.css                          |  6 ++--
 patchwork/templates/patchwork/submission.html | 31 +++++++------------
 templates/base.html                           |  2 +-
 3 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/htdocs/css/style.css b/htdocs/css/style.css
index 243caa0..46a91ee 100644
--- a/htdocs/css/style.css
+++ b/htdocs/css/style.css
@@ -182,17 +182,17 @@ input#reorder-change {
 }
 
 /* patch view */
-table.patchmeta th {
+table.patch-meta th {
     text-align: left;
 }
 
-table.patchmeta tr th, table.patchmeta tr td {
+table.patch-meta tr th, table.patch-meta tr td {
     text-align: left;
     padding: 1px 10px;
     vertical-align: top;
 }
 
-.submissionlist ul {
+.submission-list ul {
     list-style-type: none;
     padding: 0;
     margin: 0;
diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html
index 978559b..2e457cf 100644
--- a/patchwork/templates/patchwork/submission.html
+++ b/patchwork/templates/patchwork/submission.html
@@ -32,7 +32,7 @@ function toggle_div(link_id, headers_id, label_show, label_hide)
   <h1>{{ submission.name }}</h1>
 </div>
 
-<table class="patchmeta">
+<table class="patch-meta">
  <tr>
   <th>Message ID</th>
   {% if submission.list_archive_url %}
@@ -61,12 +61,11 @@ function toggle_div(link_id, headers_id, label_show, label_hide)
 {% endif %}
  <tr>
   <th>Headers</th>
-  <td><a id="togglepatchheaders"
-   href="javascript:toggle_div('togglepatchheaders', 'patchheaders')"
-   >show</a>
-   <div id="patchheaders" class="patchheaders" style="display:none;">
-    <pre>{{submission.headers}}</pre>
-   </div>
+  <td>
+    <a id="toggle-patch-headers">show</a>
+    <div id="patch-headers" class="patch-headers" style="display:none;">
+      <pre>{{submission.headers}}</pre>
+    </div>
   </td>
  </tr>
 {% if submission.series %}
@@ -76,10 +75,8 @@ function toggle_div(link_id, headers_id, label_show, label_hide)
    <a href="{% url 'patch-list' project_id=project.linkname %}?series={{ submission.series.id }}">
     {{ submission.series.name }}
    </a> |
-   <a id="togglepatchseries"
-      href="javascript:toggle_div('togglepatchseries', 'patchseries', 'expand', 'collapse')"
-   >expand</a>
-   <div id="patchseries" class="submissionlist" style="display:none;">
+   <a id="toggle-patch-series">expand</a>
+   <div id="patch-series" class="submission-list" style="display:none;">
     <ul>
      {% with submission.series.cover_letter as cover %}
       <li>
@@ -114,10 +111,8 @@ function toggle_div(link_id, headers_id, label_show, label_hide)
  <tr>
   <th>Related</th>
   <td>
-   <a id="togglerelated"
-      href="javascript:toggle_div('togglerelated', 'related')"
-   >show</a>
-   <div id="related" class="submissionlist" style="display:none;">
+   <a id="toggle-related">show</a>
+   <div id="related" class="submission-list" style="display:none;">
     <ul>
      {% for sibling in related_same_project %}
       <li>
@@ -129,10 +124,8 @@ function toggle_div(link_id, headers_id, label_show, label_hide)
       </li>
      {% endfor %}
      {% if related_different_project %}
-      <a id="togglerelatedoutside"
-         href="javascript:toggle_div('togglerelatedoutside', 'relatedoutside', 'show from other projects')"
-      >show from other projects</a>
-      <div id="relatedoutside" class="submissionlist" style="display:none;">
+      <a id="toggle-related-outside">show from other projects</a>
+      <div id="related-outside" class="submission-list" style="display:none;">
        {% for sibling in related_outside %}
         <li>
          <a href="{% url 'patch-detail' project_id=sibling.project.linkname msgid=sibling.url_msgid %}">
diff --git a/templates/base.html b/templates/base.html
index 8accb4c..a95a11b 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -113,7 +113,7 @@
   {% endfor %}
   </div>
 {% endif %}
-  <div class="container-fluid">
+  <div id="main-content" class="container-fluid">
 {% block body %}
 {% endblock %}
   </div>
-- 
2.33.0.rc1.237.g0d66db33f3-goog



More information about the Patchwork mailing list