Calendar: Clicking #datecontrol_date gives datepicker to jump to date

This commit is contained in:
Bart Visscher 2012-06-13 09:05:35 +02:00
parent 4da6b3a391
commit 7a8e7f18db
1 changed files with 17 additions and 1 deletions

View File

@ -845,7 +845,7 @@ $(document).ready(function(){
dayNamesShort: dayNamesShort,
allDayText: allDayText,
viewDisplay: function(view) {
$('#datecontrol_date').val(view.title);
$('#datecontrol_date').val($('<p>').html(view.title).text());
if (view.name != defaultView) {
$.post(OC.filePath('calendar', 'ajax', 'changeview.php'), {v:view.name});
defaultView = view.name;
@ -884,6 +884,22 @@ $(document).ready(function(){
loading: Calendar.UI.loading,
eventSources: eventSources
});
$('#datecontrol_date').datepicker({
changeMonth: true,
changeYear: true,
showButtonPanel: true,
beforeShow: function(input, inst) {
var calendar_holder = $('#calendar_holder');
var date = calendar_holder.fullCalendar('getDate');
inst.input.datepicker('setDate', date);
inst.input.val(calendar_holder.fullCalendar('getView').title);
return inst;
},
onSelect: function(value, inst) {
var date = inst.input.datepicker('getDate');
$('#calendar_holder').fullCalendar('gotoDate', date);
}
});
fillWindow($('#content'));
OCCategories.changed = Calendar.UI.categoriesChanged;
OCCategories.app = 'calendar';