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

Stephen Finucane stephen at that.guru
Fri Aug 13 19:03:38 AEST 2021


On Fri, 2021-08-13 at 05:31 +0000, Raxel Gutierrez wrote:
> Clean up submission.html to have hyphen-delimited id and class selectors
> names for better readability and code health.

So this is supposed to only change the name of some tokens...

> 
> 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;">

...but you're actually removing functionality here. I do realize you're going to
re-add it in a future change, but these lines should only be removed in this
future change where it's reimplemented. Otherwise we temporarily lose
functionality, which means you'd break bisect and I can't apply this change
without applying the other change.

Otherwise, the changes are fine. I'll wait and see if I can easily apply the
other patch that re-adds this functionality and, if so, move this manually. If
not, could you address this in a new revision?

Cheers,
Stephen

> +   <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>




More information about the Patchwork mailing list