Add notes form

This commit is contained in:
Mouse Reeve 2022-01-25 09:40:03 -08:00
parent 6009593b6b
commit 38ccc23cd5
1 changed files with 27 additions and 3 deletions

View File

@ -71,7 +71,7 @@
</div> </div>
{% endwith %} {% endwith %}
{% if item.note or item.user == request.user %} {% if item.notes %}
<div class="media notification"> <div class="media notification">
<figure class="media-left"> <figure class="media-left">
{% include "snippets/avatar.html" with user=item.user %} {% include "snippets/avatar.html" with user=item.user %}
@ -85,14 +85,14 @@
{% endblocktrans %} {% endblocktrans %}
</header> </header>
<p> <p>
{{ item.notes|to_markdown|safe }} {{ item.notes|to_markdown|safe }}
</p> </p>
</div> </div>
{% if item.user == request.user %} {% if item.user == request.user %}
<div> <div>
<details class="details-panel box"> <details class="details-panel box">
<summary> <summary>
{% trans "Edit:" %} {% trans "Edit notes:" %}
<span class="details-close icon icon-pencil" aria-hidden></span> <span class="details-close icon icon-pencil" aria-hidden></span>
</summary> </summary>
<form name="edit-notes-{{ item.id }}" method="POST" action="{% url 'list-item' list.id item.id %}"> <form name="edit-notes-{{ item.id }}" method="POST" action="{% url 'list-item' list.id item.id %}">
@ -115,6 +115,30 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% elif item.user == request.user %}
<div>
<details class="details-panel box">
<summary>
{% trans "Add notes:" %}
<span class="details-close icon icon-plus" aria-hidden></span>
</summary>
<form name="add-notes-{{ item.id }}" method="POST" action="{% url 'list-item' list.id item.id %}">
{% csrf_token %}
<div class="field">
<div class="control">
<textarea class="textarea" maxlength="300" name="notes">{{ item.notes|default:'' }}</textarea>
</div>
</div>
<div class="field">
<div class="control">
<button type="submit" class="button is-success">
{% trans "Save" %}
</button>
</div>
</div>
</form>
</details>
</div>
{% endif %} {% endif %}
</div> </div>
<div class="card-footer is-stacked-mobile has-background-white-bis is-align-items-stretch"> <div class="card-footer is-stacked-mobile has-background-white-bis is-align-items-stretch">