mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-15 05:14:53 +00:00
(js) Restore user's last Calendar view
Also reviewed the handling of Angular modules dependencies.
This commit is contained in:
@@ -4,6 +4,17 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('SOGo.Common', ['ngMaterial'])
|
||||
.constant('sgSettings', {
|
||||
baseURL: ApplicationBaseURL,
|
||||
activeUser: {
|
||||
login: UserLogin,
|
||||
identification: UserIdentification,
|
||||
language: UserLanguage,
|
||||
folderURL: UserFolderURL,
|
||||
isSuperUser: IsSuperUser
|
||||
}
|
||||
})
|
||||
|
||||
// md break-points values are hard-coded in angular-material/src/core/util/constant.js
|
||||
// $mdMedia has a built-in support for those values but can also evaluate others
|
||||
// For some reasons, angular-material's break-points don't match the specs
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('SOGo.Common', []);
|
||||
|
||||
angular.module('SOGo.ContactsUI', ['ngSanitize', 'ui.router', 'SOGo.Common'])
|
||||
angular.module('SOGo.ContactsUI', ['ngSanitize', 'ui.router', 'SOGo.Common', 'SOGo.PreferencesUI'])
|
||||
|
||||
.constant('sgSettings', {
|
||||
baseURL: ApplicationBaseURL,
|
||||
|
||||
@@ -47,7 +47,16 @@
|
||||
return AddressBook; // return constructor
|
||||
}];
|
||||
|
||||
/* Factory registration in Angular module */
|
||||
/**
|
||||
* @module SOGo.ContactsUI
|
||||
* @desc Factory registration of AddressBook in Angular module.
|
||||
*/
|
||||
try {
|
||||
angular.module('SOGo.ContactsUI');
|
||||
}
|
||||
catch(e) {
|
||||
angular.module('SOGo.ContactsUI', ['SOGo.Common']);
|
||||
}
|
||||
angular.module('SOGo.ContactsUI')
|
||||
.factory('AddressBook', AddressBook.$factory);
|
||||
|
||||
|
||||
@@ -53,6 +53,12 @@
|
||||
* @module SOGo.ContactsUI
|
||||
* @desc Factory registration of Card in Angular module.
|
||||
*/
|
||||
try {
|
||||
angular.module('SOGo.ContactsUI');
|
||||
}
|
||||
catch(e) {
|
||||
angular.module('SOGo.ContactsUI', ['SOGo.Common']);
|
||||
}
|
||||
angular.module('SOGo.ContactsUI')
|
||||
.factory('Card', Card.$factory);
|
||||
|
||||
@@ -403,15 +409,15 @@
|
||||
* @param {string} email
|
||||
* @param {Card} card
|
||||
*/
|
||||
Card.prototype.$updateMember = function(index, email, card) {
|
||||
var ref = {
|
||||
email: email,
|
||||
emails: [{value: email}],
|
||||
reference: card.c_name,
|
||||
c_cn: card.$fullname()
|
||||
};
|
||||
this.refs[index] = new Card(ref);
|
||||
};
|
||||
// Card.prototype.$updateMember = function(index, email, card) {
|
||||
// var ref = {
|
||||
// email: email,
|
||||
// emails: [{value: email}],
|
||||
// reference: card.c_name,
|
||||
// c_cn: card.$fullname()
|
||||
// };
|
||||
// this.refs[index] = new Card(ref);
|
||||
// };
|
||||
|
||||
/**
|
||||
* @function $unwrap
|
||||
|
||||
@@ -4,22 +4,7 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('SOGo.ContactsUI', []);
|
||||
angular.module('SOGo.PreferencesUI', []);
|
||||
|
||||
angular.module('SOGo.MailerUI', ['ngSanitize', 'ui.router', 'ck', 'angularFileUpload', 'SOGo.Common', 'SOGo.ContactsUI', 'ngAnimate', 'SOGo.PreferencesUI'])
|
||||
|
||||
.constant('sgSettings', {
|
||||
baseURL: ApplicationBaseURL,
|
||||
activeUser: {
|
||||
login: UserLogin,
|
||||
identification: UserIdentification,
|
||||
language: UserLanguage,
|
||||
folderURL: UserFolderURL,
|
||||
isSuperUser: IsSuperUser
|
||||
}
|
||||
})
|
||||
|
||||
.config(configure)
|
||||
.run(runBlock);
|
||||
|
||||
@@ -229,8 +214,8 @@
|
||||
runBlock.$inject = ['$rootScope'];
|
||||
function runBlock($rootScope) {
|
||||
$rootScope.$on('$routeChangeError', function(event, current, previous, rejection) {
|
||||
console.error(event, current, previous, rejection)
|
||||
})
|
||||
console.error(event, current, previous, rejection);
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
@@ -44,7 +44,16 @@
|
||||
return Account; // return constructor
|
||||
}];
|
||||
|
||||
/* Factory registration in Angular module */
|
||||
/**
|
||||
* @module SOGo.MailerUI
|
||||
* @desc Factory registration of Account in Angular module.
|
||||
*/
|
||||
try {
|
||||
angular.module('SOGo.MailerUI');
|
||||
}
|
||||
catch(e) {
|
||||
angular.module('SOGo.MailerUI', ['SOGo.Common']);
|
||||
}
|
||||
angular.module('SOGo.MailerUI')
|
||||
.factory('Account', Account.$factory);
|
||||
|
||||
|
||||
@@ -57,15 +57,19 @@
|
||||
|
||||
/**
|
||||
* @module SOGo.MailerUI
|
||||
* @desc Factory registration of Card in Angular module.
|
||||
* @desc Factory registration of Mailbox in Angular module.
|
||||
*/
|
||||
try {
|
||||
angular.module('SOGo.MailerUI');
|
||||
}
|
||||
catch(e) {
|
||||
angular.module('SOGo.MailerUI', ['SOGo.Common']);
|
||||
}
|
||||
angular.module('SOGo.MailerUI')
|
||||
/* Factory constants */
|
||||
.constant('sgMailbox_PRELOAD', {
|
||||
LOOKAHEAD: 50,
|
||||
SIZE: 100
|
||||
})
|
||||
/* Factory registration in Angular module */
|
||||
.factory('Mailbox', Mailbox.$factory);
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,22 +4,7 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('SOGo.ContactsUI', []);
|
||||
angular.module('SOGo.MailerUI', []);
|
||||
angular.module('SOGo.PreferencesUI', []);
|
||||
|
||||
angular.module('SOGo.SchedulerUI', ['ngSanitize', 'ui.router', 'SOGo.Common', 'SOGo.ContactsUI', 'SOGo.MailerUI', 'SOGo.PreferencesUI'])
|
||||
|
||||
.constant('sgSettings', {
|
||||
baseURL: ApplicationBaseURL,
|
||||
activeUser: {
|
||||
login: UserLogin,
|
||||
identification: UserIdentification,
|
||||
language: UserLanguage,
|
||||
folderURL: UserFolderURL,
|
||||
isSuperUser: IsSuperUser
|
||||
}
|
||||
})
|
||||
angular.module('SOGo.SchedulerUI', ['ngSanitize', 'ui.router', 'SOGo.Common', 'SOGo.PreferencesUI', 'SOGo.ContactsUI', 'SOGo.MailerUI'])
|
||||
.config(configure)
|
||||
.run(runBlock);
|
||||
|
||||
@@ -67,19 +52,20 @@
|
||||
// If no date is specified, show today
|
||||
var now = new Date();
|
||||
return '/calendar/day/' + now.getDayString();
|
||||
})
|
||||
});
|
||||
$urlRouterProvider.when('/calendar/week', function() {
|
||||
// If no date is specified, show today's week
|
||||
var now = new Date();
|
||||
return '/calendar/week/' + now.getDayString();
|
||||
})
|
||||
});
|
||||
$urlRouterProvider.when('/calendar/month', function() {
|
||||
// If no date is specified, show today's month
|
||||
var now = new Date();
|
||||
return '/calendar/month/' + now.getDayString();
|
||||
});
|
||||
|
||||
// if none of the above states are matched, use this as the fallback
|
||||
// If none of the above states are matched, use this as the fallback.
|
||||
// runBlock will also act as a fallback by looking at user's settings
|
||||
$urlRouterProvider.otherwise('/calendar');
|
||||
}
|
||||
|
||||
@@ -102,11 +88,20 @@
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
runBlock.$inject = ['$rootScope'];
|
||||
function runBlock($rootScope) {
|
||||
runBlock.$inject = ['$rootScope', '$location', 'Preferences'];
|
||||
function runBlock($rootScope, $location, Preferences) {
|
||||
$rootScope.$on('$routeChangeError', function(event, current, previous, rejection) {
|
||||
console.error(event, current, previous, rejection);
|
||||
});
|
||||
if ($location.url().length === 0) {
|
||||
// Restore user's last view
|
||||
Preferences.ready().then(function() {
|
||||
var view = /(.+)view/.exec(Preferences.settings.Calendar.View);
|
||||
if (view) {
|
||||
$location.replace().url('/calendar/' + view[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
@@ -40,7 +40,16 @@
|
||||
return Calendar; // return constructor
|
||||
}];
|
||||
|
||||
/* Factory registration in Angular module */
|
||||
/**
|
||||
* @module SOGo.SchedulerUI
|
||||
* @desc Factory registration of Calendar in Angular module.
|
||||
*/
|
||||
try {
|
||||
angular.module('SOGo.SchedulerUI');
|
||||
}
|
||||
catch(e) {
|
||||
angular.module('SOGo.SchedulerUI', ['SOGo.Common']);
|
||||
}
|
||||
angular.module('SOGo.SchedulerUI')
|
||||
.factory('Calendar', Calendar.$factory);
|
||||
|
||||
|
||||
@@ -122,6 +122,6 @@
|
||||
}
|
||||
|
||||
angular
|
||||
.module('SOGo.SchedulerUI')
|
||||
.module('SOGo.SchedulerUI')
|
||||
.controller('CalendarListController', CalendarListController);
|
||||
})();
|
||||
|
||||
@@ -63,6 +63,12 @@
|
||||
* @module SOGo.SchedulerUI
|
||||
* @desc Factory registration of Component in Angular module.
|
||||
*/
|
||||
try {
|
||||
angular.module('SOGo.SchedulerUI');
|
||||
}
|
||||
catch(e) {
|
||||
angular.module('SOGo.SchedulerUI', ['SOGo.Common']);
|
||||
}
|
||||
angular.module('SOGo.SchedulerUI')
|
||||
.factory('Component', Component.$factory);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user