(js) Insert unseen msgs count in window's title

pull/221/head
Francis Lachapelle 2016-09-12 16:11:35 -04:00
parent 195d477149
commit 4c23f21ae1
3 changed files with 13 additions and 4 deletions

1
NEWS
View File

@ -8,6 +8,7 @@ Enhancements
- [web] don't allow a recurrence rule to end before the first occurrence
- [web] updated Angular Material to version 1.1.0
- [web] show user's name upon successful login
- [web] inserted unseen messages count and mailbox name in browser's window title
Bug fixes
- [eas] properly generate the BusyStatus for normal events

View File

@ -12,9 +12,7 @@
<var:if condition="hideFrame" const:negate="YES">
<html const:xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" const:lang="en">
<head>
<title>
<var:string value="title" />
</title>
<title var:sg-default="title"><var:string value="title"/></title>
<meta name="hideFrame" var:content="hideFrame" />
<meta name="description" content="SOGo Web Interface" />
<meta name="author" content="Inverse inc." />

View File

@ -8,7 +8,8 @@
*/
MailboxController.$inject = ['$window', '$scope', '$timeout', '$q', '$state', '$mdDialog', '$mdToast', 'stateAccounts', 'stateAccount', 'stateMailbox', 'encodeUriFilter', 'sgFocus', 'Dialog', 'Account', 'Mailbox'];
function MailboxController($window, $scope, $timeout, $q, $state, $mdDialog, $mdToast, stateAccounts, stateAccount, stateMailbox, encodeUriFilter, focus, Dialog, Account, Mailbox) {
var vm = this, messageDialog = null;
var vm = this, messageDialog = null,
defaultWindowTitle = angular.element($window.document).find('title').attr('sg-default') || "SOGo";
// Expose controller for eventual popup windows
$window.$mailboxController = vm;
@ -42,6 +43,15 @@
angular.element($window).off('beforeunload', _compactBeforeUnload);
});
// Update window's title with unseen messages count of selected mailbox
$scope.$watch(function() { return vm.selectedFolder.unseenCount; }, function(unseenCount) {
var title = defaultWindowTitle + ' - ';
if (unseenCount)
title += '(' + unseenCount + ') ';
title += vm.selectedFolder.name;
$window.document.title = title;
});
function _compactBeforeUnload(event) {
return vm.selectedFolder.$compact();
}