better representiation of delete/edit notes
This commit is contained in:
parent
477f5a06d0
commit
b1fcdea493
|
@ -73,7 +73,6 @@ class AddNoteView(View):
|
||||||
class UpdateNoteView(UpdateView):
|
class UpdateNoteView(UpdateView):
|
||||||
model = Note
|
model = Note
|
||||||
fields = ['description']
|
fields = ['description']
|
||||||
template_name = "blank.html"
|
|
||||||
pk_url_kwarg = 'pk'
|
pk_url_kwarg = 'pk'
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
|
|
@ -27,15 +27,19 @@
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
{{ note.date|timesince }} {% trans "ago" %}
|
{{ note.date|timesince }} {% trans "ago" %}
|
||||||
</small>
|
</small>
|
||||||
</div>
|
|
||||||
{% if user == note.user or user.is_admin %}
|
{% if user == note.user or user.is_admin %}
|
||||||
|
<span class="badge bg-warning text-dark ms-2">{% trans "Editable" %}</span>
|
||||||
|
</div>
|
||||||
<blockquote
|
<blockquote
|
||||||
class="blockquote mt-2 p-2 bg-light fst-italic"
|
class="blockquote mt-2 p-2 bg-light fst-italic"
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
style="font-size: 1em!important"
|
style="font-size: 1em!important"
|
||||||
data-note-id="{{ note.id }}"
|
data-note-id="{{ note.id }}"
|
||||||
|
title="{% trans 'Click to edit this note' %}"
|
||||||
oninput="toggleSaveLink(this)">
|
oninput="toggleSaveLink(this)">
|
||||||
{% else %}
|
{% else %}
|
||||||
|
</div>
|
||||||
<blockquote style="font-size: 1em!important" class="blockquote mt-2 p-2 fst-italic">
|
<blockquote style="font-size: 1em!important" class="blockquote mt-2 p-2 fst-italic">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p data-note-id="{{ note.id }}">
|
<p data-note-id="{{ note.id }}">
|
||||||
|
@ -69,18 +73,25 @@
|
||||||
<i class="fas fa-save"></i>
|
<i class="fas fa-save"></i>
|
||||||
</a>
|
</a>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- delete note button -->
|
<!-- delete note button -->
|
||||||
<button type="button" class="btn btn-link btn-outline-danger btn-sm text-danger" id="deleteIcon{{ note.id }}" title="{% trans 'Delete note' %}" data-bs-toggle="collapse" data-bs-target="#confirmDelete{{ note.id }}">
|
<button type="button" class="btn btn-link btn-outline-danger btn-sm text-danger" id="deleteIcon{{ note.id }}" title="{% trans 'Delete note' %}" data-bs-toggle="collapse" data-bs-target="#confirmDelete{{ note.id }}">
|
||||||
<i class="bi bi-trash"></i>
|
<i class="bi bi-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form class="d-inline" method="post" action="{% url 'action:delete_note' note.id %}">
|
<form class="d-inline" method="post" action="{% url 'action:delete_note' note.id %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="collapse mt-2 text-end" id="confirmDelete{{ note.id }}">
|
<div class="collapse mt-2" id="confirmDelete{{ note.id }}">
|
||||||
<a href="#" class="btn btn-sm btn-outline-danger" onclick="submitDeleteForm({{ note.id }}); return false;">
|
<div class="card card-body border border-danger text-center">
|
||||||
{% trans 'Confirm delete' %}
|
<p class="mb-2">{% trans 'Are you sure you want to delete this note?' %}</p>
|
||||||
</a>
|
<a
|
||||||
|
href="#"
|
||||||
|
class="btn btn-sm btn-outline-danger"
|
||||||
|
onclick="submitDeleteForm({{ note.id }}); return false;"
|
||||||
|
>
|
||||||
|
{% trans 'Confirm delete' %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue