diff options
-rw-r--r-- | public/js/modules/event-edit.js | 19 | ||||
-rw-r--r-- | public/js/modules/new.js | 5 | ||||
-rwxr-xr-x | views/partials/eventForm.handlebars | 2 |
3 files changed, 18 insertions, 8 deletions
diff --git a/public/js/modules/event-edit.js b/public/js/modules/event-edit.js index 6d2c216..313e8f2 100644 --- a/public/js/modules/event-edit.js +++ b/public/js/modules/event-edit.js @@ -18,13 +18,13 @@ $(document).ready(function () { }); $('#editModal').on('shown.bs.modal', function (e) { - console.log('hii'); - const ta = document.querySelector("#editModal textarea"); - ta.style.display = 'none'; - autosize(ta); - ta.style.display = ''; - // Call the update method to recalculate the size: - autosize.update(ta); + console.log('hii'); + const ta = document.querySelector("#editModal textarea"); + ta.style.display = 'none'; + autosize(ta); + ta.style.display = ''; + // Call the update method to recalculate the size: + autosize.update(ta); }); function editEventForm() { @@ -65,6 +65,11 @@ function editEventForm() { window.eventData.maxAttendees !== null; this.data.publicCheckbox = window.eventData.showOnPublicList; }, + updateEventEnd() { + if (this.data.eventEnd === "" || this.data.eventEnd < this.data.eventStart) { + this.data.eventEnd = this.data.eventStart; + } + }, async submitForm() { this.submitting = true; this.errors = []; diff --git a/public/js/modules/new.js b/public/js/modules/new.js index 7915b59..70df641 100644 --- a/public/js/modules/new.js +++ b/public/js/modules/new.js @@ -68,6 +68,11 @@ function newEventForm() { this.data.maxAttendeesCheckbox = false; this.data.publicCheckbox = false; }, + updateEventEnd() { + if (this.data.eventEnd === "" || this.data.eventEnd < this.data.eventStart) { + this.data.eventEnd = this.data.eventStart; + } + }, async submitForm() { this.submitting = true; this.errors = []; diff --git a/views/partials/eventForm.handlebars b/views/partials/eventForm.handlebars index 6fbbbf0..93e8e84 100755 --- a/views/partials/eventForm.handlebars +++ b/views/partials/eventForm.handlebars @@ -14,7 +14,7 @@ <div class="form-group"> <label for="eventStart" >Starts</label> <div class="form-group"> - <input type="datetime-local" class="form-control" id="eventStart" name="eventStart" x-model="data.eventStart"> + <input type="datetime-local" class="form-control" id="eventStart" name="eventStart" x-model="data.eventStart" x-on:blur="updateEventEnd"> </div> </div> <div class="form-group"> |