[PATCH 1/1] templates: Add label for patch ID checkbox
Stephen Finucane
stephen at that.guru
Tue Jun 19 02:48:39 AEST 2018
On Fri, 2018-06-15 at 15:56 +0200, Petr Vorel wrote:
> This helps checkboxes to be easily clickable (UX improvement).
>
> Signed-off-by: Petr Vorel <petr.vorel at gmail.com>
Thanks for this and sorry for missing the pull request. Unfortunately
it seems this is incomplete as I see the following error when I apply
the patch.
TemplateSyntaxError at /project/patchwork/list/
Invalid block tag on line 180: 'else', expected 'endwith'. Did you
forget to register or load this tag?
Could you take a look and see what's up?
Cheers,
Stephen
> ---
> 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>
More information about the Patchwork
mailing list