]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
templates: Integrate series view into patches
authorStephen Finucane <stephen@that.guru>
Sat, 29 Oct 2016 13:13:40 +0000 (14:13 +0100)
committerStephen Finucane <stephen@that.guru>
Mon, 31 Oct 2016 16:37:17 +0000 (16:37 +0000)
Patches for related series are listed on the patch page - this
provides a way to quickly grok a given patches location in a
series hierarchy.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Tested-by: Russell Currey <ruscur@russell.cc>
htdocs/css/style.css
patchwork/templates/patchwork/submission.html

index 0bf4b430152584b7d2f315057fad1eb69a4b9c74..5218f6d7429a464389a2eaf96a55ac2cc81d20f0 100644 (file)
@@ -188,6 +188,12 @@ table.patchmeta tr th, table.patchmeta tr td {
        vertical-align: middle;
 }
 
+.patchrelations ul {
+       list-style-type: none;
+       padding: 0;
+       margin: 0;
+}
+
 .patchnav {
        padding-left: 1em;
        padding-top: 1em;
index dc3d4056a969e71c800ced50513a1b50f4df2183..a7b094810e4f551147365a0f9d9cf9fa5be9914d 100644 (file)
@@ -9,7 +9,7 @@
 
 {% block body %}
 <script type="text/javascript">
-function toggle_headers(link_id, headers_id)
+function toggle_div(link_id, headers_id)
 {
     var link = document.getElementById(link_id)
     var headers = document.getElementById(headers_id)
@@ -55,13 +55,71 @@ function toggle_headers(link_id, headers_id)
  <tr>
   <th>Headers</th>
   <td><a id="togglepatchheaders"
-   href="javascript:toggle_headers('togglepatchheaders', 'patchheaders')"
+   href="javascript:toggle_div('togglepatchheaders', 'patchheaders')"
    >show</a>
    <div id="patchheaders" class="patchheaders" style="display:none;">
     <pre>{{submission.headers}}</pre>
    </div>
   </td>
  </tr>
+{% if submission.latest_series %}
+ <tr>
+  <th>Series</th>
+  <td>
+   <div class="patchrelations">
+    <ul>
+     {% for series in submission.series.all %}
+     <li>
+      {% if series == submission.latest_series %}
+       {{ series }}
+      {% else %}
+       <a href="{% url 'patch-list' project_id=project.linkname %}?series={{ series.id }}">
+       {{ series }}
+       </a>
+      {% endif %}
+     </li>
+    {% endfor %}
+    </ul>
+   </div>
+  </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;">
+    <ul>
+    {% with submission.latest_series.cover_letter as cover %}
+     <li>
+     {% if cover %}
+      {% if cover == submission %}
+       {{ cover.name|default:"[no subject]"|truncatechars:100 }}
+      {% else %}
+      <a href="{% url 'cover-detail' cover_id=cover.id %}">
+       {{ cover.name|default:"[no subject]"|truncatechars:100 }}
+      </a>
+      {% endif %}
+     {% endif %}
+     </li>
+    {% endwith %}
+    {% for sibling in submission.latest_series.patches.all %}
+     <li>
+      {% if sibling == submission %}
+       {{ sibling.name|default:"[no subject]"|truncatechars:100 }}
+      {% else %}
+      <a href="{% url 'patch-detail' patch_id=sibling.id %}">
+       {{ sibling.name|default:"[no subject]"|truncatechars:100 }}
+      </a>
+      {% endif %}
+     </li>
+    {% endfor %}
+    </ul>
+   </div>
+  </td>
+ </tr>
+{% endif %}
 </table>
 
 <div class="patchforms">
@@ -221,7 +279,7 @@ function toggle_headers(link_id, headers_id)
 {% if submission.diff %}
 <h2>
  Patch
- <a href="javascript:toggle_headers('hide-patch', 'patch')" id="hide-patch">hide</a></span>
+ <a href="javascript:toggle_div('hide-patch', 'patch')" id="hide-patch">hide</a></span>
  <span>|</span>
  <a href="{% url 'patch-raw' patch_id=submission.id %}"
    >download patch</a>