diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index 175defb6..33af8d52 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -491,7 +491,8 @@ LIST_SENDAT: 'SendedAt', LIST_SELECT: 'Select', INFO_SEND_TO: 'send to', - INFO_SEND_AT: 'at' + INFO_SEND_AT: 'at', + NEW_MSG: 'New messages' }, MESSAGE_TYPE_USER: 'User message', MESSAGE_TYPE_SYSTEM: 'System message', diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index e7c4c97a..41e1033e 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -491,7 +491,8 @@ LIST_SENDAT: '发送时间', LIST_SELECT: '选择', INFO_SEND_TO: '发送给', - INFO_SEND_AT: '于' + INFO_SEND_AT: '于', + NEW_MSG: '条未读消息' }, MESSAGE_TYPE_USER: '用户消息', MESSAGE_TYPE_SYSTEM: '系统消息', diff --git a/modules/core/client/controllers/header.client.controller.js b/modules/core/client/controllers/header.client.controller.js index 8865ec84..5c24bea8 100644 --- a/modules/core/client/controllers/header.client.controller.js +++ b/modules/core/client/controllers/header.client.controller.js @@ -6,10 +6,10 @@ .controller('HeaderController', HeaderController); HeaderController.$inject = ['$scope', '$state', '$stateParams', '$translate', 'Authentication', 'menuService', 'MeanTorrentConfig', 'localStorageService', - 'ScoreLevelService', 'InvitationsService']; + 'ScoreLevelService', 'InvitationsService', '$interval', 'MessagesService']; function HeaderController($scope, $state, $stateParams, $translate, Authentication, menuService, MeanTorrentConfig, localStorageService, ScoreLevelService, - InvitationsService) { + InvitationsService, $interval, MessagesService) { var vm = this; vm.user = Authentication.user; vm.language = MeanTorrentConfig.meanTorrentConfig.language; @@ -42,6 +42,13 @@ vm.getInvitationsCount(); }); + /** + * user-unread-count-changed + */ + $scope.$on('user-unread-count-changed', function (event, args) { + vm.getCountUnread(); + }); + /** * getInvitationsCount */ @@ -57,11 +64,32 @@ } }; + /** + * checkMessageUnread + */ + vm.checkMessageUnread = function () { + $interval(vm.getCountUnread, 120000); + }; + + vm.getCountUnread = function () { + MessagesService.countUnread(function (data) { + console.log(data); + vm.unreadCount = data.countFrom + data.countTo; + }); + }; + + /** + * stateChangeSuccess + */ function stateChangeSuccess() { // Collapsing the menu after navigation vm.isCollapsed = false; } + /** + * changeLanguage + * @param langKey + */ vm.changeLanguage = function (langKey) { var lang = localStorageService.get('storage_user_lang'); if (lang !== langKey) { diff --git a/modules/core/client/less/mt.less b/modules/core/client/less/mt.less index b589bce1..cfaaff05 100644 --- a/modules/core/client/less/mt.less +++ b/modules/core/client/less/mt.less @@ -189,11 +189,7 @@ body { top: 3px; } -.menu-score-parent { - position: relative; -} - -.menu-invitation-parent { +.menu-parent { position: relative; } diff --git a/modules/core/client/views/header.client.view.html b/modules/core/client/views/header.client.view.html index d39a14d0..b0719ad0 100644 --- a/modules/core/client/views/header.client.view.html +++ b/modules/core/client/views/header.client.view.html @@ -1,4 +1,4 @@ -
+