diff --git a/dictionaries/en.dictionary.itop.ui.php b/dictionaries/en.dictionary.itop.ui.php index 973304074..0a7533900 100644 --- a/dictionaries/en.dictionary.itop.ui.php +++ b/dictionaries/en.dictionary.itop.ui.php @@ -1595,6 +1595,7 @@ Dict::Add('EN US', 'English', 'English', array( // Dict::Add('EN US', 'English', 'English', array( 'UI:Newsroom:NoNewMessage' => 'No new message', + 'UI:Newsroom:XNewMessage' => '%1$s new message(s)', 'UI:Newsroom:MarkAllAsRead' => 'Mark all messages as read', 'UI:Newsroom:ViewAllMessages' => 'View all messages', 'UI:Newsroom:Preferences' => 'Newsroom preferences', diff --git a/js/components/newsroom-menu.js b/js/components/newsroom-menu.js index 2b82ad486..e716a4ed3 100644 --- a/js/components/newsroom-menu.js +++ b/js/components/newsroom-menu.js @@ -13,9 +13,10 @@ $(function() placeholder_image_icon: '', providers: [], labels: { - 'no_message': 'No new message', - 'mark_all_as_read': 'Mark all as read', - 'view_all': 'View all messages' + no_notification: 'UI:Newsroom:NoNewMessage', + x_notifications: 'UI:Newsroom:XNewMessage', + mark_all_as_read: 'UI:Newsroom:MarkAllAsRead', + view_all: 'UI:Newsroom:ViewAllMessages' } }, css_classes: @@ -26,6 +27,7 @@ $(function() js_selectors: { menu_toggler: '[data-role="ibo-navigation-menu--notifications-toggler"]', + menu_toggler_message: '[data-role="ibo-navigation-menu--user-notifications--toggler--message"]', }, // the constructor @@ -170,12 +172,22 @@ $(function() if (oDate1 < oDate2) return 1; return 1; }); - + this._refreshTogglerMessage(aAllMessages.length); this._buildMenu(aAllMessages); }, + _refreshTogglerMessage : function(iItemCount){ + var sMessage = this.options.labels.no_notification; + if(iItemCount > 0){ + sMessage = Dict.Format(this.options.labels.x_notifications, iItemCount); + } + $(this.js_selectors.menu_toggler_message).html(sMessage); + $(this.js_selectors.menu_toggler).attr('data-tooltip-content', sMessage); + CombodoTooltip.InitTooltipFromMarkup($(this.js_selectors.menu_toggler), true); + }, _buildDismissAllSection: function() { - return '
' + this.options.labels.mark_all_as_read + '
'; + return '
' + Dict.S(this.options.labels.mark_all_as_read) + '
'; }, _buildMessageSection: function () { return '
'; @@ -200,12 +212,12 @@ $(function() }, _buildNoMessageItem: function() { - return '
' + this.options.labels.no_message + + return '
' + Dict.S(this.options.labels.no_notification) + '
' + this.options.no_message_icon + '
'; }, _buildSingleShowAllMessagesItem: function() { - return '' + this.options.labels.view_all + ''; + return '' + Dict.S(this.options.labels.view_all) + ''; }, _buildMultipleShowAllMessagesItem: function(aUnreadMessagesByProvider) { @@ -219,7 +231,7 @@ $(function() } sUnreadMessages += '' + sNewMessageIndicator + this.options.providers[k].label + sExtraMessages + ''; } - return ''+this.options.labels.view_all+'' + + return ''+Dict.S(this.options.labels.view_all)+'' + '
'+sUnreadMessages+'
'; }, _buildMenu: function(aAllMessages) diff --git a/sources/application/UI/Base/Component/PopoverMenu/NewsroomMenu/NewsroomMenuFactory.php b/sources/application/UI/Base/Component/PopoverMenu/NewsroomMenu/NewsroomMenuFactory.php index a2deffb3e..376432b15 100644 --- a/sources/application/UI/Base/Component/PopoverMenu/NewsroomMenu/NewsroomMenuFactory.php +++ b/sources/application/UI/Base/Component/PopoverMenu/NewsroomMenu/NewsroomMenuFactory.php @@ -93,9 +93,10 @@ class NewsroomMenuFactory 'providers' => $aProviderParams, 'display_limit' => (int)appUserPreferences::GetPref('newsroom_display_size', 7), 'labels' => array( - 'no_message' => Dict::S('UI:Newsroom:NoNewMessage'), - 'mark_all_as_read' => Dict::S('UI:Newsroom:MarkAllAsRead'), - 'view_all' => Dict::S('UI:Newsroom:ViewAllMessages'), + 'no_notification' => 'UI:Newsroom:NoNewMessage', + 'x_notifications' => 'UI:Newsroom:XNewMessage', + 'mark_all_as_read' => 'UI:Newsroom:MarkAllAsRead', + 'view_all' => 'UI:Newsroom:ViewAllMessages' ), ); return $aParams; diff --git a/sources/application/WebPage/iTopWebPage.php b/sources/application/WebPage/iTopWebPage.php index b3a6aeb53..d4fcf2a67 100644 --- a/sources/application/WebPage/iTopWebPage.php +++ b/sources/application/WebPage/iTopWebPage.php @@ -156,6 +156,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage $this->add_dict_entry('UI:UndefinedObject'); $this->add_dict_entries('Enum:Undefined'); $this->add_dict_entry('UI:Datatables:Language:Processing'); + $this->add_dict_entries('UI:Newsroom'); } diff --git a/templates/base/layouts/navigation-menu/layout.html.twig b/templates/base/layouts/navigation-menu/layout.html.twig index 3e34d2517..7f7e96991 100644 --- a/templates/base/layouts/navigation-menu/layout.html.twig +++ b/templates/base/layouts/navigation-menu/layout.html.twig @@ -33,7 +33,7 @@
{% if oUIBlock.IsNewsroomEnabled() == true %}
- +
@@ -69,7 +69,9 @@ {% if oUIBlock.IsNewsroomEnabled() == true %}