feat(templates/tickets): replace role checks with is_admin for admin UI
Replaces `role != 'member'` checks with `is_admin` to correctly target admin users and simplify conditional rendering.
This commit is contained in:
1 file changed
+6
-6
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if request.user.role != 'member' %}
|
||||
{% if request.user.is_admin %}
|
||||
<div class="dk-card divide-y divide-gray-200 dark:divide-gray-600 mb-6">
|
||||
<div class="px-6 py-4"><h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100">Add New Priority</h3><p class="text-xs text-gray-500 mt-0.5">Create a new ticket priority level</p></div>
|
||||
<div class="px-6 py-5">
|
||||
@@ -52,7 +52,7 @@
|
||||
<tr class="border-b border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800">
|
||||
<th class="text-left px-4 py-3 font-semibold text-xs text-gray-500 dark:text-gray-400">Color</th>
|
||||
<th class="text-left px-4 py-3 font-semibold text-xs text-gray-500 dark:text-gray-400">Name</th>
|
||||
{% if request.user.role != 'member' %}
|
||||
{% if request.user.is_admin %}
|
||||
<th class="text-right px-4 py-3 font-semibold text-xs text-gray-500 dark:text-gray-400">Actions</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
@@ -63,7 +63,7 @@
|
||||
<td class="px-4 py-3">
|
||||
<div class="flex items-center gap-2">
|
||||
<div x-show="!editing" class="w-6 h-6 rounded-full border border-gray-200" style="background-color: {{ p.color }}"></div>
|
||||
{% if request.user.role != 'member' %}
|
||||
{% if request.user.is_admin %}
|
||||
<div x-show="editing" class="relative">
|
||||
<toolcool-color-picker popup-position="left" :color="color" @change="color = $event.detail.hex"></toolcool-color-picker>
|
||||
<input type="hidden" name="color" :value="color" form="edit-form-{{ p.id }}">
|
||||
@@ -73,12 +73,12 @@
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<span x-show="!editing" class="font-medium" x-text="name"></span>
|
||||
{% if request.user.role != 'member' %}
|
||||
{% if request.user.is_admin %}
|
||||
<input x-show="editing" type="text" x-model="name" name="name" form="edit-form-{{ p.id }}" required
|
||||
class="w-full text-sm border border-gray-200 dark:border-gray-600 rounded-lg px-2 py-1 bg-white dark:bg-gray-950 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
{% endif %}
|
||||
</td>
|
||||
{% if request.user.role != 'member' %}
|
||||
{% if request.user.is_admin %}
|
||||
<td class="px-4 py-3 text-right">
|
||||
<div x-show="!editing" class="flex justify-end gap-1">
|
||||
<button @click="editing = true" class="inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-900 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shadow-sm">
|
||||
@@ -106,7 +106,7 @@
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="{% if request.user.role != 'member' %}3{% else %}2{% endif %}" class="text-center py-12 text-gray-400">No priorities defined yet</td></tr>
|
||||
<tr><td colspan="{% if request.user.is_admin %}3{% else %}2{% endif %}" class="text-center py-12 text-gray-400">No priorities defined yet</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in new issue
Block a user