Improve slot editing

Fix placement of form to allow submit button to work again.
Display information about slot on the edit popup.
This commit is contained in:
Joel Addison 2020-01-05 14:07:34 +10:00
parent bc2187e280
commit 5b93b39f67
2 changed files with 31 additions and 18 deletions

View file

@ -1,22 +1,34 @@
{% load i18n bootstrap %} {% load i18n bootstrap %}
<div class="modal-dialog modal-dialog-centered" role="document"> <form class="form-horizontal" id="slotEditForm" class="modal-form" method="POST" action="{% url "schedule_slot_edit" slug slot.pk %}">
<div class="modal-content"> <div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-header"> <div class="modal-content">
<h5 class="modal-title">{% trans "Edit Slot" %}</h5> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <h5 class="modal-title">{% trans "Edit Slot" %}</h5>
<span aria-hidden="true">&times;</span> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
</button> <span aria-hidden="true">&times;</span>
</div> </button>
</div>
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal" id="slotEditForm" class="modal-form" method="POST" action="{% url "schedule_slot_edit" slug slot.pk %}">
{% csrf_token %} {% csrf_token %}
{{ form|bootstrap }} <div class="mb-3">
</form> <h5>Slot Details</h5>
</div> <ul>
<li>Name: {{ slot.name }}</li>
<li>Kind: {{ slot.kind.label }}</li>
<li>Date: {{ slot.day.date }}</li>
<li>Start: {{ slot.start }}</li>
<li>End: {{ slot.end }}</li>
<li>Room(s): {{ slot.rooms|join:", " }}</li>
</ul>
</div>
<div class="modal-footer"> {{ form|bootstrap }}
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div>
<button type="submit" class="btn btn-primary">Save changes</button>
</div> <div class="modal-footer">
</div> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
</div>
</form>

View file

@ -46,6 +46,7 @@ class SlotEditForm(forms.Form):
"label": "Content", "label": "Content",
"required": False, "required": False,
"initial": self.slot.content_override, "initial": self.slot.content_override,
"widget": forms.Textarea,
} }
return forms.CharField(**kwargs) return forms.CharField(**kwargs)