This commit is contained in:
Jimmy 2021-03-11 21:28:17 -08:00
commit 11d4255c67
75 changed files with 529 additions and 502 deletions

View file

@ -13,11 +13,13 @@ $(function () {
$("#conference-start-datepicker").datetimepicker({
useCurrent: false,
format: "YYYY-MM-DD"
ignoreReadonly: true,
format: "YYYY-MM-DD",
});
$("#conference-end-datepicker").datetimepicker({
useCurrent: false,
ignoreReadonly: true,
format: "YYYY-MM-DD"
});

View file

@ -147,6 +147,15 @@ function word_count(text, divId, maxcount) {
});
};
function fill_if_empty(text_area, filler) {
let area = $('#' + text_area);
if (!area.val()) {
area.val(filler);
area.trigger('change');
}
}
/* Wait for the DOM to be ready before attaching events to the elements */
$( document ).ready(function() {
/* Set the minimum and maximum proposal abstract and submission text word length */
@ -155,15 +164,15 @@ $( document ).ready(function() {
var max = $selected.data("max-words");
var min = $selected.data("min-words");
// Set the filler text for the submission text
fill_if_empty('event_submission_text', $selected.data("help"));
$("#abstract-maximum-word-count").text(max);
$("#submission-maximum-word-count").text(max);
$("#abstract-minimum-word-count").text(min);
$("#submission-minimum-word-count").text(min);
word_count($('#event_abstract').get(0), 'abstract-count', max);
word_count($('#event_submission_text').get(0), 'submission-count', max);
// Set the placeholder text for the abstract
$('#event_submission_text').attr("placeholder", $selected.data("help"));
})
.trigger('change');
@ -180,6 +189,18 @@ $( document ).ready(function() {
var max = $selected.data("max-words");
word_count(this, 'submission-count', max);
});
/* Listen for reset template button, wait for confirm, and reset. */
$('#sub_text_reset').click((e) => {
let $selected = $("#event_event_type_id option:selected");
let $this = $(e.target);
let affirm = confirm($this.data('confirm'));
if (affirm) {
let sub_text = $('#event_submission_text');
sub_text.val($selected.data('help'));
sub_text.trigger('change');
}
});
});
/* Commodity function for modal windows */