mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
Avoid calendar change event and directly update state. Avoids double state change.
This commit is contained in:
parent
3439bac8cf
commit
e5810f793a
@ -2849,24 +2849,29 @@ app.classes.calendar = AppJS.extend(
|
|||||||
.on('click', '.ui-datepicker-week-col', function() {
|
.on('click', '.ui-datepicker-week-col', function() {
|
||||||
var view = app.calendar.state.view;
|
var view = app.calendar.state.view;
|
||||||
var days = app.calendar.state.days;
|
var days = app.calendar.state.days;
|
||||||
|
|
||||||
// Fake a click event on the first day to get the updated date
|
// Avoid a full state update, we just want the calendar to update
|
||||||
$j(this).next().click();
|
// Directly update to avoid change event from the sidebox calendar
|
||||||
|
var date = new Date(this.nextSibling.dataset.year,this.nextSibling.dataset.month,this.nextSibling.firstChild.textContent,0,0,0);
|
||||||
|
date.setUTCHours(0);
|
||||||
|
date.setUTCMinutes(0);
|
||||||
|
date = app.calendar.date.toString(date);
|
||||||
|
|
||||||
// Set to week view, if in one of the views where we change view
|
// Set to week view, if in one of the views where we change view
|
||||||
if(app.calendar.sidebox_changes_views.indexOf(view) >= 0)
|
if(app.calendar.sidebox_changes_views.indexOf(view) >= 0)
|
||||||
{
|
{
|
||||||
app.calendar.update_state({view: 'week', date: date_widget.getValue(), days: days});
|
app.calendar.update_state({view: 'week', date: date, days: days});
|
||||||
}
|
}
|
||||||
else if (view == 'planner')
|
else if (view == 'planner')
|
||||||
{
|
{
|
||||||
// Clicked a week, show just a week
|
// Clicked a week, show just a week
|
||||||
app.calendar.update_state({planner_days: 7});
|
app.calendar.update_state({date: date, planner_days: 7});
|
||||||
}
|
}
|
||||||
else if (view == 'listview')
|
else if (view == 'listview')
|
||||||
{
|
{
|
||||||
app.calendar.update_state({
|
app.calendar.update_state({
|
||||||
end_date: app.calendar.date.toString(app.classes.calendar.views.week.end_date({date:date_widget.getValue()})),
|
date: date,
|
||||||
|
end_date: app.calendar.date.toString(app.classes.calendar.views.week.end_date({date:date})),
|
||||||
filter: 'week'
|
filter: 'week'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user