Skip to content
Snippets Groups Projects

Resolve "Save calendar default date in session"

Open Murtaza Sultani requested to merge issue-13 into master
4 files
+ 59
15
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -6,9 +6,18 @@ STUDIP.ready(function () {
jQuery('#werlehrtwo_date').datepicker();
if (STUDIP.Werlehrtwo.calendar == null) {
let date_str = $('#werlehrtwo_date').val();
//date_str is in the form dd.mm.yyyy. It needs to be converted first:
let date_parts = date_str.split('.');
let iso_date = date_parts[2] + '-' + date_parts[1] + '-' + date_parts[0];
let config = {
defaultDate: iso_date
};
STUDIP.loadChunk('fullcalendar').then(() => {
let calendar_node = jQuery('[data-werlehrtwo-calendar="1"]')[0];
STUDIP.Werlehrtwo.calendar = STUDIP.Fullcalendar.createFromNode(calendar_node);
STUDIP.Werlehrtwo.calendar = STUDIP.Fullcalendar.createFromNode(calendar_node, config);
});
}
@@ -20,12 +29,15 @@ STUDIP.ready(function () {
});
jQuery(document).on('change', '#werlehrtwo_date', function(event) {
if (STUDIP.Werlehrtwo.calendar) {
let date_str = event.target.value;
//date_str is in the form dd.mm.yyyy. It needs to be converted first:
let date_parts = date_str.split('.');
let iso_date = date_parts[2] + '-' + date_parts[1] + '-' + date_parts[0];
STUDIP.Werlehrtwo.calendar.gotoDate(iso_date);
$('#WerLehrtWo_update_default_date').submit();
}
});
});
Loading