[PATCH v3 7/7] templates: Integrate series view into patches
Stephen Finucane
stephenfinucane at hotmail.com
Tue Sep 13 07:53:33 AEST 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 <stephenfinucane at hotmail.com>
---
v1:
- Correct mistake in link back to series patches list
---
htdocs/css/style.css | 6 ++++
patchwork/templates/patchwork/submission.html | 50 +++++++++++++++++++++++++--
2 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/htdocs/css/style.css b/htdocs/css/style.css
index f7f7b6a..a75a7fd 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 088cceb..de74f0d 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)
@@ -60,13 +60,57 @@ 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>
+ <a href="{% url 'patch-list' project_id=project.linkname %}?series={{submission.series.id}}">
+ {{ submission.series.name }}
+ </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;">
+ <ul>
+ {% with submission.series.cover_letter as cover %}
+ {% 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 %}
+ {% 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">
@@ -226,7 +270,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