[1/4] ui, templates: Combine series and related row
diff mbox series

Message ID 20191207164621.24234-2-metepolat2000@gmail.com
State Accepted
Headers show
Series
  • Add submission relations
Related show

Commit Message

Mete Polat Dec. 7, 2019, 4:46 p.m. UTC
Move the series patch list from row 'Related' to 'Series'. This allows
us to use the 'Related' row for actually showing submission relations
instead.

Signed-off-by: Mete Polat <metepolat2000@gmail.com>
---
 htdocs/css/style.css                          |  2 +-
 patchwork/templates/patchwork/submission.html | 69 +++++++++----------
 2 files changed, 33 insertions(+), 38 deletions(-)

Comments

Stephen Finucane Dec. 27, 2019, 5:27 p.m. UTC | #1
On Sat, 2019-12-07 at 17:46 +0100, Mete Polat wrote:
> Move the series patch list from row 'Related' to 'Series'. This allows
> us to use the 'Related' row for actually showing submission relations
> instead.
> 
> Signed-off-by: Mete Polat <metepolat2000@gmail.com>

Like patch 3, this one stands on its own so I've gone ahead and applied
it. Thanks :)

Reviewed-by: Stephen Finucane <stephen@that.guru>

Stephen

> ---
>  htdocs/css/style.css                          |  2 +-
>  patchwork/templates/patchwork/submission.html | 69 +++++++++----------
>  2 files changed, 33 insertions(+), 38 deletions(-)
> 
> diff --git a/htdocs/css/style.css b/htdocs/css/style.css
> index b9fb9eb302f9..243caa0d968a 100644
> --- a/htdocs/css/style.css
> +++ b/htdocs/css/style.css
> @@ -192,7 +192,7 @@ table.patchmeta tr th, table.patchmeta tr td {
>      vertical-align: top;
>  }
>  
> -.patchrelations ul {
> +.submissionlist ul {
>      list-style-type: none;
>      padding: 0;
>      margin: 0;
> diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html
> index 2706a5535605..77a2711ab5b4 100644
> --- a/patchwork/templates/patchwork/submission.html
> +++ b/patchwork/templates/patchwork/submission.html
> @@ -9,7 +9,7 @@
>  
>  {% block body %}
>  <script>
> -function toggle_div(link_id, headers_id)
> +function toggle_div(link_id, headers_id, label_show, label_hide)
>  {
>      var link = document.getElementById(link_id)
>      var headers = document.getElementById(headers_id)
> @@ -17,10 +17,10 @@ function toggle_div(link_id, headers_id)
>      var hidden = headers.style['display'] == 'none';
>  
>      if (hidden) {
> -        link.innerHTML = 'hide';
> +        link.innerHTML = label_hide || 'hide';
>          headers.style['display'] = 'block';
>      } else {
> -        link.innerHTML = 'show';
> +        link.innerHTML = label_show || 'show';
>          headers.style['display'] = 'none';
>      }
>  
> @@ -74,42 +74,37 @@ function toggle_div(link_id, headers_id)
>    <th>Series</th>
>    <td>
>     <a href="{% url 'patch-list' project_id=project.linkname %}?series={{ submission.series.id }}">
> -    {{ submission.series }}
> -   </a>
> -  </td>
> - </tr>
> - <tr>
> -  <th>Related</th>
> -  <td>
> -   <a id="togglepatchrelations"
> -      href="javascript:toggle_div('togglepatchrelations', 'patchrelations')"
> -   >show</a>
> -   <div id="patchrelations" class="patchrelations" style="display:none;">
> +    {{ 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;">
>      <ul>
> -    {% with submission.series.cover_letter as cover %}
> -     <li>
> -     {% if cover %}
> -      {% if cover == submission %}
> -       {{ cover.name|default:"[no subject]"|truncatechars:100 }}
> -      {% else %}
> -      <a href="{% url 'cover-detail' project_id=project.linkname msgid=cover.url_msgid %}">
> -       {{ cover.name|default:"[no subject]"|truncatechars:100 }}
> -      </a>
> -      {% endif %}
> -     {% endif %}
> -     </li>
> -    {% endwith %}
> -    {% for sibling in submission.series.patches.all %}
> -     <li>
> -      {% if sibling == submission %}
> -       {{ sibling.name|default:"[no subject]"|truncatechars:100 }}
> -      {% else %}
> -      <a href="{% url 'patch-detail' project_id=project.linkname msgid=sibling.url_msgid %}">
> -       {{ sibling.name|default:"[no subject]"|truncatechars:100 }}
> -      </a>
> +     {% with submission.series.cover_letter as cover %}
> +      <li>
> +      {% if cover %}
> +       {% if cover == submission %}
> +        {{ cover.name|default:"[no subject]"|truncatechars:100 }}
> +       {% else %}
> +       <a href="{% url 'cover-detail' project_id=project.linkname msgid=cover.url_msgid %}">
> +        {{ cover.name|default:"[no subject]"|truncatechars:100 }}
> +       </a>
> +       {% endif %}
>        {% endif %}
> -     </li>
> -    {% endfor %}
> +      </li>
> +     {% endwith %}
> +     {% for sibling in submission.series.patches.all %}
> +      <li>
> +       {% if sibling == submission %}
> +        {{ sibling.name|default:"[no subject]"|truncatechars:100 }}
> +       {% else %}
> +       <a href="{% url 'patch-detail' project_id=project.linkname msgid=sibling.url_msgid %}">
> +        {{ sibling.name|default:"[no subject]"|truncatechars:100 }}
> +       </a>
> +       {% endif %}
> +      </li>
> +     {% endfor %}
>      </ul>
>     </div>
>    </td>

Patch
diff mbox series

diff --git a/htdocs/css/style.css b/htdocs/css/style.css
index b9fb9eb302f9..243caa0d968a 100644
--- a/htdocs/css/style.css
+++ b/htdocs/css/style.css
@@ -192,7 +192,7 @@  table.patchmeta tr th, table.patchmeta tr td {
     vertical-align: top;
 }
 
-.patchrelations ul {
+.submissionlist ul {
     list-style-type: none;
     padding: 0;
     margin: 0;
diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html
index 2706a5535605..77a2711ab5b4 100644
--- a/patchwork/templates/patchwork/submission.html
+++ b/patchwork/templates/patchwork/submission.html
@@ -9,7 +9,7 @@ 
 
 {% block body %}
 <script>
-function toggle_div(link_id, headers_id)
+function toggle_div(link_id, headers_id, label_show, label_hide)
 {
     var link = document.getElementById(link_id)
     var headers = document.getElementById(headers_id)
@@ -17,10 +17,10 @@  function toggle_div(link_id, headers_id)
     var hidden = headers.style['display'] == 'none';
 
     if (hidden) {
-        link.innerHTML = 'hide';
+        link.innerHTML = label_hide || 'hide';
         headers.style['display'] = 'block';
     } else {
-        link.innerHTML = 'show';
+        link.innerHTML = label_show || 'show';
         headers.style['display'] = 'none';
     }
 
@@ -74,42 +74,37 @@  function toggle_div(link_id, headers_id)
   <th>Series</th>
   <td>
    <a href="{% url 'patch-list' project_id=project.linkname %}?series={{ submission.series.id }}">
-    {{ submission.series }}
-   </a>
-  </td>
- </tr>
- <tr>
-  <th>Related</th>
-  <td>
-   <a id="togglepatchrelations"
-      href="javascript:toggle_div('togglepatchrelations', 'patchrelations')"
-   >show</a>
-   <div id="patchrelations" class="patchrelations" style="display:none;">
+    {{ 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;">
     <ul>
-    {% with submission.series.cover_letter as cover %}
-     <li>
-     {% if cover %}
-      {% if cover == submission %}
-       {{ cover.name|default:"[no subject]"|truncatechars:100 }}
-      {% else %}
-      <a href="{% url 'cover-detail' project_id=project.linkname msgid=cover.url_msgid %}">
-       {{ cover.name|default:"[no subject]"|truncatechars:100 }}
-      </a>
-      {% endif %}
-     {% endif %}
-     </li>
-    {% endwith %}
-    {% for sibling in submission.series.patches.all %}
-     <li>
-      {% if sibling == submission %}
-       {{ sibling.name|default:"[no subject]"|truncatechars:100 }}
-      {% else %}
-      <a href="{% url 'patch-detail' project_id=project.linkname msgid=sibling.url_msgid %}">
-       {{ sibling.name|default:"[no subject]"|truncatechars:100 }}
-      </a>
+     {% with submission.series.cover_letter as cover %}
+      <li>
+      {% if cover %}
+       {% if cover == submission %}
+        {{ cover.name|default:"[no subject]"|truncatechars:100 }}
+       {% else %}
+       <a href="{% url 'cover-detail' project_id=project.linkname msgid=cover.url_msgid %}">
+        {{ cover.name|default:"[no subject]"|truncatechars:100 }}
+       </a>
+       {% endif %}
       {% endif %}
-     </li>
-    {% endfor %}
+      </li>
+     {% endwith %}
+     {% for sibling in submission.series.patches.all %}
+      <li>
+       {% if sibling == submission %}
+        {{ sibling.name|default:"[no subject]"|truncatechars:100 }}
+       {% else %}
+       <a href="{% url 'patch-detail' project_id=project.linkname msgid=sibling.url_msgid %}">
+        {{ sibling.name|default:"[no subject]"|truncatechars:100 }}
+       </a>
+       {% endif %}
+      </li>
+     {% endfor %}
     </ul>
    </div>
   </td>