summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2018-02-28 11:00:13 +0100
committerAaron Bohy <aab@odoo.com>2018-03-01 15:31:16 +0100
commit3ad3e450e468f3ad37c627cf7a0d5f92aa4777b8 (patch)
tree7fcac9e8638e12f3fc629dbe9837547c6c2a2c45 /addons/web/static/src/js
parentf4bca155201f0491ef68612443aaaa94b3dd09e0 (diff)
[FIX] web: Calendar: only highlight today
Before this rev., in week and month modes, when navigating through weeks or months, the weekday/monthday of today was still highlighted in other weeks and months than the current ones. This rev. ensures to only highlight today in the main calendar view (this doesn't impact the mini calendar).
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/views/calendar/calendar_controller.js2
-rw-r--r--addons/web/static/src/js/views/calendar/calendar_model.js8
-rw-r--r--addons/web/static/src/js/views/calendar/calendar_renderer.js5
3 files changed, 3 insertions, 12 deletions
diff --git a/addons/web/static/src/js/views/calendar/calendar_controller.js b/addons/web/static/src/js/views/calendar/calendar_controller.js
index 2b17710935c..d79f26ffcd2 100644
--- a/addons/web/static/src/js/views/calendar/calendar_controller.js
+++ b/addons/web/static/src/js/views/calendar/calendar_controller.js
@@ -129,7 +129,7 @@ var CalendarController = AbstractController.extend({
// When clicking on a random day of a random other week, switch to week view
this.model.setScale('week');
}
- this.model.setDate(event.data.date, true);
+ this.model.setDate(event.data.date);
this.reload();
},
/**
diff --git a/addons/web/static/src/js/views/calendar/calendar_model.js b/addons/web/static/src/js/views/calendar/calendar_model.js
index fac6845a31f..23c0aea3094 100644
--- a/addons/web/static/src/js/views/calendar/calendar_model.js
+++ b/addons/web/static/src/js/views/calendar/calendar_model.js
@@ -216,9 +216,9 @@ return AbstractModel.extend({
filters: params.filters,
};
+ this.setDate(params.initialDate);
// Use mode attribute in xml file to specify zoom timeline (day,week,month)
// by default month.
- this.setDate(params.initialDate, true);
this.setScale(params.mode);
_.each(this.data.filters, function (filter) {
@@ -251,9 +251,8 @@ return AbstractModel.extend({
},
/**
* @param {Moment} start
- * @param {boolean} highlight
*/
- setDate: function (start, highlight) {
+ setDate: function (start) {
this.data.start_date = this.data.end_date = this.data.target_date = this.data.highlight_date = start;
this.data.start_date.utc().add(this.getSession().getTZOffset(this.data.start_date), 'minutes');
@@ -270,9 +269,6 @@ return AbstractModel.extend({
this.data.start_date = this.data.start_date.clone().startOf('day');
this.data.end_date = this.data.end_date.clone().endOf('day');
}
- if (highlight) {
- this.data.highlight_date = this.data.target_date;
- }
},
setScale: function (scale) {
if (!_.contains(scales, scale)) {
diff --git a/addons/web/static/src/js/views/calendar/calendar_renderer.js b/addons/web/static/src/js/views/calendar/calendar_renderer.js
index 6283a3539f3..e5f29cdca67 100644
--- a/addons/web/static/src/js/views/calendar/calendar_renderer.js
+++ b/addons/web/static/src/js/views/calendar/calendar_renderer.js
@@ -422,11 +422,6 @@ return AbstractRenderer.extend({
this.target_date = this.state.target_date.toString();
}
- var highlightDate = moment(this.state.highlight_date).format('YYYY-MM-DD');
- $calendar.find('.o_target_date').removeClass('o_target_date');
- $calendar.find('.fc-bg .fc-day[data-date="'+highlightDate+'"]')
- .addClass('o_target_date');
-
this.$small_calendar.datepicker("setDate", this.state.highlight_date.toDate())
.find('.o_selected_range')
.removeClass('o_color o_selected_range');