[PATCH 1/1] templates: Add label for patch ID checkbox
Petr Vorel
petr.vorel at gmail.com
Fri Jun 15 23:56:56 AEST 2018
This helps checkboxes to be easily clickable (UX improvement).
Signed-off-by: Petr Vorel <petr.vorel at gmail.com>
---
Posted some time ago as pull request
https://github.com/getpatchwork/patchwork/pull/175
---
patchwork/templates/patchwork/patch-list.html | 36 +++++++++++--------
1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/patchwork/templates/patchwork/patch-list.html b/patchwork/templates/patchwork/patch-list.html
index 71c1ba9..2889e60 100644
--- a/patchwork/templates/patchwork/patch-list.html
+++ b/patchwork/templates/patchwork/patch-list.html
@@ -176,38 +176,44 @@ $(document).ready(function() {
{% for patch in page.object_list %}
<tr id="patch_row:{{patch.id}}">
{% if user.is_authenticated %}
+ {% with label_start='<label for="patch_id_{{patch.id}}">' label_end="</label>" %}
+ {% else %}
+ {% with label_start="" label_end="" %}
+ {% endif %}
+ {% if user.is_authenticated %}
<td style="text-align: center;">
- <input type="checkbox" name="patch_id:{{patch.id}}"/>
+ <input type="checkbox" name="patch_id:{{patch.id}}" id="patch_id_{{patch.id}}" />
</td>
- {% endif %}
- {% if user.is_authenticated and user.profile.show_ids %}
+ {% endif %}
+ {% if user.is_authenticated and user.profile.show_ids %}
<td>
<button type="button" class="btn btn-xs btn-copy"
data-clipboard-text="{{ patch.id }}" title="Copy to Clipboard">
{{ patch.id }}
</button>
</td>
- {% endif %}
+ {% endif %}
<td>
<a href="{% url 'patch-detail' patch_id=patch.id %}">
{{ patch.name|default:"[no subject]"|truncatechars:100 }}
</a>
</td>
<td>
- {% with patch.series.all.0 as series %}
- {% if series %}
+ {% with patch.series.all.0 as series %}
+ {% if series %}
<a href="?series={{series.id}}">
- {{ series|truncatechars:100 }}
+ {{ series|truncatechars:100 }}
</a>
- {% endif %}
- {% endwith %}
+ {% endif %}
+ {% endwith %}
</td>
- <td class="text-nowrap">{{ patch|patch_tags }}</td>
- <td class="text-nowrap">{{ patch|patch_checks }}</td>
- <td class="text-nowrap">{{ patch.date|date:"Y-m-d" }}</td>
- <td>{{ patch.submitter|personify:project }}</td>
- <td>{{ patch.delegate.username }}</td>
- <td>{{ patch.state }}</td>
+ {{ label_start }}<td class="text-nowrap">{{ patch|patch_tags }}</td>{{ label_end }}
+ {{ label_start }}<td class="text-nowrap">{{ patch|patch_checks }}</td>{{ label_end }}
+ {{ label_start }}<td class="text-nowrap">{{ patch.date|date:"Y-m-d" }}</td>{{ label_end }}
+ {{ label_start }}<td>{{ patch.submitter|personify:project }}</td>{{ label_end }}
+ {{ label_start }}<td>{{ patch.delegate.username }}</td>{{ label_end }}
+ {{ label_start }}<td>{{ patch.state }}</td>{{ label_end }}
+ {% endwith %}
</tr>
{% empty %}
<tr>
--
2.17.1
More information about the Patchwork
mailing list