(js) Add automatic refresh of calendar view
We were only refreshing the selected component list, we now also refresh the calendar view.pull/222/merge
parent
e20d2281db
commit
c50c3763b1
1
NEWS
1
NEWS
|
@ -6,6 +6,7 @@ Enhancements
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
- [web] fixed tasks list when some weekdays are disabled
|
- [web] fixed tasks list when some weekdays are disabled
|
||||||
|
- [web] fixed automatic refresh of calendar view
|
||||||
|
|
||||||
|
|
||||||
3.2.0 (2016-10-03)
|
3.2.0 (2016-10-03)
|
||||||
|
|
|
@ -111,6 +111,12 @@
|
||||||
changeDate($event, date);
|
changeDate($event, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format a date according to the current view.
|
||||||
|
* - Day/Multicolumn: name of weekday
|
||||||
|
* - Week: week number
|
||||||
|
* - Month: name of month
|
||||||
|
*/
|
||||||
function _formatDate(date) {
|
function _formatDate(date) {
|
||||||
if ($stateParams.view == 'month') {
|
if ($stateParams.view == 'month') {
|
||||||
date.setDate(1);
|
date.setDate(1);
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
vm.selectedList = 1;
|
vm.selectedList = 1;
|
||||||
type = 'tasks';
|
type = 'tasks';
|
||||||
}
|
}
|
||||||
selectComponentType(type, { reload: true });
|
selectComponentType(type, { reload: true }); // fetch events/tasks lists
|
||||||
});
|
});
|
||||||
|
|
||||||
// Refresh current list when the list of calendars is modified
|
// Refresh current list when the list of calendars is modified
|
||||||
|
|
|
@ -31,12 +31,13 @@
|
||||||
* @desc The factory we'll use to register with Angular
|
* @desc The factory we'll use to register with Angular
|
||||||
* @returns the Component constructor
|
* @returns the Component constructor
|
||||||
*/
|
*/
|
||||||
Component.$factory = ['$q', '$timeout', '$log', 'sgSettings', 'sgComponent_STATUS', 'Preferences', 'Card', 'Gravatar', 'Resource', function($q, $timeout, $log, Settings, Component_STATUS, Preferences, Card, Gravatar, Resource) {
|
Component.$factory = ['$q', '$timeout', '$log', '$rootScope', 'sgSettings', 'sgComponent_STATUS', 'Preferences', 'Card', 'Gravatar', 'Resource', function($q, $timeout, $log, $rootScope, Settings, Component_STATUS, Preferences, Card, Gravatar, Resource) {
|
||||||
angular.extend(Component, {
|
angular.extend(Component, {
|
||||||
STATUS: Component_STATUS,
|
STATUS: Component_STATUS,
|
||||||
$q: $q,
|
$q: $q,
|
||||||
$timeout: $timeout,
|
$timeout: $timeout,
|
||||||
$log: $log,
|
$log: $log,
|
||||||
|
$rootScope: $rootScope,
|
||||||
$Preferences: Preferences,
|
$Preferences: Preferences,
|
||||||
$Card: Card,
|
$Card: Card,
|
||||||
$gravatar: Gravatar,
|
$gravatar: Gravatar,
|
||||||
|
@ -119,7 +120,8 @@
|
||||||
/**
|
/**
|
||||||
* @function $startRefreshTimeout
|
* @function $startRefreshTimeout
|
||||||
* @memberof Component
|
* @memberof Component
|
||||||
* @desc Starts the refresh timeout for the current selected component type, for all calendars
|
* @desc Starts the refresh timeout for the current selected list (events or tasks) and
|
||||||
|
* current view.
|
||||||
*/
|
*/
|
||||||
Component.$startRefreshTimeout = function(type) {
|
Component.$startRefreshTimeout = function(type) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
@ -131,7 +133,7 @@
|
||||||
// Restart the refresh timer, if needed
|
// Restart the refresh timer, if needed
|
||||||
var refreshViewCheck = Component.$Preferences.defaults.SOGoRefreshViewCheck;
|
var refreshViewCheck = Component.$Preferences.defaults.SOGoRefreshViewCheck;
|
||||||
if (refreshViewCheck && refreshViewCheck != 'manually') {
|
if (refreshViewCheck && refreshViewCheck != 'manually') {
|
||||||
var f = angular.bind(_this, Component.$filter, type);
|
var f = angular.bind(Component.$rootScope, Component.$rootScope.$emit, 'calendars:list');
|
||||||
Component.$refreshTimeout = Component.$timeout(f, refreshViewCheck.timeInterval()*1000);
|
Component.$refreshTimeout = Component.$timeout(f, refreshViewCheck.timeInterval()*1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -194,8 +196,8 @@
|
||||||
angular.extend(_this[queryKey], _this.$query));
|
angular.extend(_this[queryKey], _this.$query));
|
||||||
|
|
||||||
// Invalidate cached results of other type if $query has changed
|
// Invalidate cached results of other type if $query has changed
|
||||||
otherType = (type == 'tasks')? '$events' : '$tasks';
|
|
||||||
if (dirty) {
|
if (dirty) {
|
||||||
|
otherType = (type == 'tasks')? '$events' : '$tasks';
|
||||||
delete Component[otherType];
|
delete Component[otherType];
|
||||||
Component.$log.debug('force reload of ' + otherType);
|
Component.$log.debug('force reload of ' + otherType);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue