[FIX] web_calendar: double scrollbar + hour format
* Change 12A -> 11A in 12am -> 11pm * Compute calendar height so that it fits the web client content height
This commit is contained in:
@@ -19,7 +19,6 @@ var _lt = core._lt;
|
||||
var QWeb = core.qweb;
|
||||
|
||||
function get_fc_defaultOptions() {
|
||||
var shortTimeformat = moment._locale._longDateFormat.LT;
|
||||
var dateFormat = time.strftime_to_moment_format(_t.database.parameters.date_format);
|
||||
|
||||
// adapt format for fullcalendar v1.
|
||||
@@ -38,13 +37,6 @@ function get_fc_defaultOptions() {
|
||||
dayNamesShort: moment.weekdaysShort(),
|
||||
firstDay: moment._locale._week.dow,
|
||||
weekNumbers: true,
|
||||
axisFormat : shortTimeformat.replace(/:mm/,'(:mm)'),
|
||||
timeFormat : {
|
||||
// for agendaWeek and agendaDay
|
||||
agenda: shortTimeformat + '{ - ' + shortTimeformat + '}', // 5:00 - 6:30
|
||||
// for all other views
|
||||
'': shortTimeformat.replace(/:mm/,'(:mm)') // 7pm
|
||||
},
|
||||
titleFormat: {
|
||||
month: 'MMMM yyyy',
|
||||
week: "W",
|
||||
@@ -56,7 +48,6 @@ function get_fc_defaultOptions() {
|
||||
day: 'dddd ' + dateFormat,
|
||||
},
|
||||
weekMode : 'liquid',
|
||||
aspectRatio: 1.8,
|
||||
snapMinutes: 15,
|
||||
};
|
||||
}
|
||||
@@ -276,8 +267,7 @@ var CalendarView = View.extend({
|
||||
get_fc_init_options: function () {
|
||||
//Documentation here : http://arshaw.com/fullcalendar/docs/
|
||||
var self = this;
|
||||
return $.extend({}, get_fc_defaultOptions(), {
|
||||
|
||||
return $.extend({}, get_fc_defaultOptions(), {
|
||||
defaultView: (this.mode == "month")? "month" : ((this.mode == "week")? "agendaWeek" : ((this.mode == "day")? "agendaDay" : "agendaWeek")),
|
||||
header: false,
|
||||
selectable: !this.options.read_only_mode && this.create_right,
|
||||
@@ -286,7 +276,6 @@ var CalendarView = View.extend({
|
||||
droppable: true,
|
||||
|
||||
// callbacks
|
||||
|
||||
viewRender: function(view) {
|
||||
var mode = (view.name == "month")? "month" : ((view.name == "agendaWeek") ? "week" : "day");
|
||||
if(self.$buttons !== undefined) {
|
||||
@@ -296,6 +285,8 @@ 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()));
|
||||
},
|
||||
eventDrop: function (event, _day_delta, _minute_delta, _all_day, _revertFunc) {
|
||||
var data = self.get_event_data(event);
|
||||
@@ -348,16 +339,14 @@ var CalendarView = View.extend({
|
||||
},
|
||||
|
||||
init_calendar: function() {
|
||||
var self = this;
|
||||
|
||||
if (!this.sidebar) {
|
||||
var translate = get_fc_defaultOptions();
|
||||
this.sidebar = new widgets.Sidebar(this);
|
||||
this.sidebar.appendTo(this.$('.o_calendar_sidebar_container'));
|
||||
|
||||
this.$small_calendar = self.$(".o_calendar_mini");
|
||||
this.$small_calendar = this.$(".o_calendar_mini");
|
||||
this.$small_calendar.datepicker({
|
||||
onSelect: self.calendarMiniChanged(self),
|
||||
onSelect: this.calendarMiniChanged(this),
|
||||
dayNamesMin : translate.dayNamesShort,
|
||||
monthNames: translate.monthNamesShort,
|
||||
firstDay: translate.firstDay,
|
||||
@@ -365,12 +354,11 @@ var CalendarView = View.extend({
|
||||
|
||||
this.extraSideBar();
|
||||
}
|
||||
self.$calendar.fullCalendar(self.get_fc_init_options());
|
||||
|
||||
this.$calendar.fullCalendar(this.get_fc_init_options());
|
||||
|
||||
return $.when();
|
||||
},
|
||||
extraSideBar: function() {
|
||||
},
|
||||
extraSideBar: function() {},
|
||||
|
||||
get_quick_create_class: function () {
|
||||
return widgets.QuickCreate;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@nb-calendar-colors: 24;
|
||||
|
||||
.o_calendar_container {
|
||||
height: 100%;
|
||||
padding: @o-calendar-div-padding (@odoo-horizontal-padding - @o-calendar-div-padding);
|
||||
|
||||
.calendar_color_loop(@index) when (@index < @nb-calendar-colors+1) {
|
||||
@@ -24,6 +25,7 @@
|
||||
.underline_color_loop(1);
|
||||
|
||||
.o_calendar_view {
|
||||
height: 100%;
|
||||
padding: @o-calendar-div-padding;
|
||||
|
||||
.o_calendar_widget {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<t t-name="CalendarView">
|
||||
<div class="row o_calendar_container">
|
||||
<div class="o_calendar_view col-sm-9">
|
||||
<div class="o_calendar_buttons"/>
|
||||
<div class="o_calendar_widget" />
|
||||
<div class="o_calendar_buttons"/>
|
||||
</div>
|
||||
<div class="o_calendar_sidebar_container col-sm-3 hidden-xs"/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user