[PATCH v6 8/8] templates: Integrate series view into patches
Stephen Finucane
stephen at that.guru
Sun Oct 16 23:50:54 AEDT 2016
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 at that.guru>
---
v4:
- List all series that a patch is part of
- Update to use newly added Series.name field
v1:
- Correct mistake in link back to series patches list
---
htdocs/css/style.css | 6 +++
patchwork/templates/patchwork/submission.html | 64 +++++++++++++++++++++++++--
2 files changed, 67 insertions(+), 3 deletions(-)
diff --git a/htdocs/css/style.css b/htdocs/css/style.css
index 0bf4b43..5218f6d 100644
--- a/htdocs/css/style.css
+++ b/htdocs/css/style.css
@@ -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;
diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html
index dc3d405..29df623 100644
--- a/patchwork/templates/patchwork/submission.html
+++ b/patchwork/templates/patchwork/submission.html
@@ -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.series %}
+ <tr>
+ <th>Series</th>
+ <td>
+ <div class="patchrelations">
+ <ul>
+ {% for series in submission.series_revisions.all %}
+ <li>
+ {% if series == submission.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.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.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>
--
2.7.4
More information about the Patchwork
mailing list