feat(templates/projects): replace view link with button and add note view modal
Switch from <a> tag to button with Alpine click handler and add a modal dialog for viewing note content, improving interactivity and user experience.
This commit is contained in:
1 file changed
+20
-1
@@ -516,7 +516,7 @@
|
||||
{% if "content" in notes_columns %}<td class="px-4 py-3 text-gray-500 dark:text-gray-400 max-w-xs truncate">{{ n.content|striptags|truncatewords:20|default:"-" }}</td>{% endif %}
|
||||
{% if "created_by" in notes_columns %}<td class="px-4 py-3 text-gray-500 dark:text-gray-400">{{ n.created_by.get_full_name|default:n.created_by.username }}</td>{% endif %}
|
||||
<td class="px-4 py-3">
|
||||
<a href="{% url 'note-detail' n.id %}" class="inline-flex items-center px-2 py-1 text-xs font-medium rounded border border-blue-200 dark:border-blue-800 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20">View</a>
|
||||
<button type="button" @click="$store.projectDetail.viewNoteData = {id: '{{ n.id }}', title: '{{ n.title|escapejs }}', content: '{{ n.content|escapejs }}'}; $store.projectDetail.viewNoteOpen = true" class="inline-flex items-center px-2 py-1 text-xs font-medium rounded border border-blue-200 dark:border-blue-800 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20">View</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
@@ -539,6 +539,23 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- View Note Modal -->
|
||||
<div x-cloak x-show="$store.projectDetail.viewNoteOpen" class="fixed inset-0 z-50 flex items-center justify-center">
|
||||
<div class="fixed inset-0 bg-black/50" @click="$store.projectDetail.viewNoteOpen = false"></div>
|
||||
<div class="relative bg-white dark:bg-gray-950 rounded-xl shadow-xl border border-gray-200 dark:border-gray-600 w-full max-w-4xl mx-auto my-auto max-h-[90vh] overflow-y-auto z-10 p-6 md:p-8">
|
||||
<div class="px-8 py-5 flex items-center justify-between border-b border-gray-100 dark:border-gray-700">
|
||||
<h3 class="text-xl font-bold text-gray-900 dark:text-white" x-text="$store.projectDetail.viewNoteData.title">Note</h3>
|
||||
<button @click="$store.projectDetail.viewNoteOpen = false" class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
|
||||
<i class="fas fa-times text-lg"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="px-8 py-6 prose prose-sm dark:prose-invert max-w-none" x-html="$store.projectDetail.viewNoteData.content"></div>
|
||||
<div class="px-8 py-5 flex justify-end gap-3 border-t border-gray-100 dark:border-gray-700">
|
||||
<button type="button" @click="$store.projectDetail.viewNoteOpen = false" class="px-4 py-2 text-sm 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">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "components/external_dashboard_modal.html" with show_state="$store.projectDetail.externalModalOpen" %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -552,6 +569,8 @@
|
||||
epicsSelectedIds: [],
|
||||
ticketsSelectedIds: [],
|
||||
notesSelectedIds: [],
|
||||
viewNoteOpen: false,
|
||||
viewNoteData: { id: '', title: '', content: '' },
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user