[IMP] web_calendar: calendar dimension/scroll/resize
The calendar has now a minimum height so that it appears bigger in mobile. In mobile the height cannot be computed to maximum because the webclient has not 100% fixed height. The height has been set so that in appears maximum on a 720p android mobile on chrome at the time of this commit. The calendar is now also resizing itself correctly after a window resize. Before this commit, it was impossible to scroll the calendar horizontally if needed. Notice that the solution breaks the full calendar layout and require JS scrolling so that the events are still positionned correctly.
This commit is contained in:
@@ -288,7 +288,16 @@ var CalendarView = View.extend({
|
||||
var title = self.title + ' (' + ((mode === "week")? _t("Week ") : "") + view.title + ")";
|
||||
self.set({'title': title});
|
||||
|
||||
self.$calendar.fullCalendar('option', 'height', parseInt(self.$('.o_calendar_view').height()));
|
||||
self.$calendar.fullCalendar('option', 'height', Math.max(290, parseInt(self.$('.o_calendar_view').height())));
|
||||
|
||||
setTimeout(function() {
|
||||
var $fc_view = self.$calendar.find('.fc-view');
|
||||
var width = $fc_view.find('> table').width();
|
||||
$fc_view.find('> div').css('width', (width > $fc_view.width())? width : '100%'); // 100% = fullCalendar default
|
||||
}, 0);
|
||||
},
|
||||
windowResize: function() {
|
||||
self.$calendar.fullCalendar('render');
|
||||
},
|
||||
eventDrop: function (event, _day_delta, _minute_delta, _all_day, _revertFunc) {
|
||||
var data = self.get_event_data(event);
|
||||
@@ -416,7 +425,11 @@ var CalendarView = View.extend({
|
||||
});
|
||||
self.$calendar.fullCalendar('updateEvent', event_obj);
|
||||
} else { // New event object to create
|
||||
var $fc_view = self.$calendar.find('.fc-view');
|
||||
var scrollPosition = $fc_view.scrollLeft();
|
||||
$fc_view.scrollLeft(0);
|
||||
self.$calendar.fullCalendar('renderEvent', new_event);
|
||||
$fc_view.scrollLeft(scrollPosition);
|
||||
// By forcing attribution of this event to this source, we
|
||||
// make sure that the event will be removed when the source
|
||||
// will be removed (which occurs at each do_search)
|
||||
|
||||
@@ -45,6 +45,9 @@
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
.fc-view {
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user