diff options
author | Sem <sembrestels@riseup.net> | 2012-08-30 06:17:57 +0200 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2012-08-30 06:17:57 +0200 |
commit | 07e78b106e33c09dd46e874aca04c739e0140851 (patch) | |
tree | 8c9142a4dba25c5bc90067c2227cd33074a00d07 /views/default/js/event_calendar | |
parent | 2374f4ca4b0b064118cd6cc33f8315a60715c3d4 (diff) | |
download | elgg-07e78b106e33c09dd46e874aca04c739e0140851.tar.gz elgg-07e78b106e33c09dd46e874aca04c739e0140851.tar.bz2 |
Linked initial date and end date in edit form
Diffstat (limited to 'views/default/js/event_calendar')
-rw-r--r-- | views/default/js/event_calendar/event_calendar.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/views/default/js/event_calendar/event_calendar.php b/views/default/js/event_calendar/event_calendar.php index 360f39f6c..f9e3d63c2 100644 --- a/views/default/js/event_calendar/event_calendar.php +++ b/views/default/js/event_calendar/event_calendar.php @@ -21,6 +21,11 @@ elgg.event_calendar.init = function () { $('#event-calendar-end-time-wrapper').attr('disabled','disabled'); } all_day_field.change(elgg.event_calendar.handleAllDayField); + + $('.elgg-input-date[name="start_date"], .elgg-input-date[name="end_date"]').datepicker({ + numberOfMonths: 3, + onSelect: elgg.event_calendar.handleDateRangeSelect, + }); } elgg.event_calendar.handleScheduleType = function(e) { @@ -61,6 +66,14 @@ elgg.event_calendar.handleAllDayField = function(e) { } } +elgg.event_calendar.handleDateRangeSelect = function(selectedDate) { + if (this.name == 'start_date') { + $('.elgg-input-date[name="end_date"]').datepicker("option", "minDate", selectedDate); + } else { + $('.elgg-input-date[name="start_date"]').datepicker("option", "maxDate", selectedDate); + } +} + elgg.event_calendar.handleEditFormSubmit = function(e) { if ($.trim($('[name="title"]').val()) == '') { alert(elgg.echo('event_calendar:edit_form:error:missing_title')); |