Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide checkboxes in archived locations for observer role #3296

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion integreat_cms/cms/templates/pois/poi_list_archived.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ <h1 class="heading">
<thead>
<tr class="border-b border-gray-200">
<th class="py-3 pl-4 pr-2 min">
<input form="bulk-action-form" type="checkbox" id="bulk-select-all" />
{% if perms.cms.change_poi %}
<input form="bulk-action-form" type="checkbox" id="bulk-select-all" />
{% endif %}
</th>
<th class="text-sm text-left uppercase py-3 pr-2">
{% translate "Title in" %} {{ language.translated_name }}
Expand Down
14 changes: 8 additions & 6 deletions integreat_cms/cms/templates/pois/poi_list_archived_row.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
{% load rules %}
{% load content_filters %}
<tr class="border-t border-gray-200 hover:bg-gray-100 text-gray-800">
<td class="py-3 pl-4 pr-2">
<input type="checkbox"
name="selected_ids[]"
value="{{ poi.id }}"
form="bulk-action-form"
class="bulk-select-item" />
<td class="pr-2 pl-4{% if not perms.cms.change_poi %} py-5 pr-2 {% endif %}">
{% if perms.cms.change_poi %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has a small side effect: The rows loses the padding to the top and bottom, and shrinks a little bit (s. screenshot).

Screenshot from 2024-12-17 16-23-12

I'm sure there are better ways to do it, but I couldn't come up with one and wanted to share at least one idea, so here we go :)

I think I would move the permission check one hierarchy up.

Suggested change
{% if perms.cms.change_poi %}
{% if perms.cms.change_poi %}
<td class="py-3 pl-4 pr-2">

and then add to next element the classes in case you can't change the poi (s. below).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoeyStk thank you for your suggestion :) Unfortunately, if I put it above, the whole row moves on the left side, so I used instead the class option

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I somehow can't reproduce how it looks in the picture of @JoeyStk (Firefox/Chrome)

<input type="checkbox"
name="selected_ids[]"
value="{{ poi.id }}"
form="bulk-action-form"
class="bulk-select-item" />
{% endif %}
</td>
<td class="pr-2">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<td class="pr-2">
<td class="pr-2 {% if not perms.cms.change_poi %} py-3 pl-4 pr-2 {% endif %}">

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you chose to go with this suggestion, please don't forget to also apply this to the poi_list_archived.html template :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem was with the row... so i did not change here anything :)

<a title="{% if poi_translation %} {{ poi_translation.title }}{% endif %}"
Expand Down
Loading