diff --git a/sao/CHANGELOG b/sao/CHANGELOG index b9c5383e03..7842f33714 100644 --- a/sao/CHANGELOG +++ b/sao/CHANGELOG @@ -1,3 +1,4 @@ +* Move the logout entry and add a help entry to the notification menu * Add visual hint on widget of modified field * Add support for Python 3.14 * Remove support for Python 3.9 diff --git a/sao/index.html b/sao/index.html index e2dd05de2f..1d7025b726 100644 --- a/sao/index.html +++ b/sao/index.html @@ -58,18 +58,6 @@ this repository contains the full copyright notices and license terms. --> diff --git a/sao/src/notification.js b/sao/src/notification.js index dd094fc351..74e7bf16bf 100644 --- a/sao/src/notification.js +++ b/sao/src/notification.js @@ -116,27 +116,47 @@ 'role': 'separator', 'class': 'divider', })); - let preferences_img = jQuery('', { - 'class': 'icon', - }); - let preferences = jQuery('
  • ', { - 'class': 'notification-item', - 'role': 'presentation', - }).append( - jQuery('', { - 'role': 'menuitem', - 'href': '#', + let items = [ + { 'text': Sao.i18n.gettext("Preferences..."), - }).prepend(preferences_img - ).click((evt) => { - evt.preventDefault(); - Sao.preferences(); - })); - Sao.common.ICONFACTORY.get_icon_url('tryton-launch') - .then(url => { - preferences_img.attr('src', url); + 'icon': 'tryton-launch', + 'action': () => Sao.preferences(), + }, + { + 'text': Sao.i18n.gettext("Help..."), + 'icon': 'tryton-question', + 'action': () => Sao.help_dialog(), + }, + { + 'text': Sao.i18n.gettext("Logout"), + 'icon': 'tryton-exit', + 'action': () => Sao.logout(), + }, + ]; + + items.forEach((item) => { + let item_img = jQuery('', { + 'class': 'icon', }); - this.el.append(preferences); + Sao.common.ICONFACTORY.get_icon_url(item.icon) + .then(url => { + item_img.attr('src', url); + }); + let item_li = jQuery('
  • ', { + 'class': 'notification-item', + 'role': 'presentation', + }).append( + jQuery('', { + 'role': 'menuitem', + 'href': '#', + 'text': item.text, + }).prepend(item_img + ).click((evt) => { + evt.preventDefault(); + item.action(); + })); + this.el.append(item_li); + }); }); } diff --git a/sao/src/sao.js b/sao/src/sao.js index 4efe7878a5..cfc42e264e 100644 --- a/sao/src/sao.js +++ b/sao/src/sao.js @@ -785,13 +785,6 @@ var Sao = { })); } user.prepend(Sao.NotificationMenu.indicator); - var title = Sao.i18n.gettext("Logout"); - jQuery('#user-logout > a') - .attr('title', title) - .attr('aria-label', title) - .off() - .click(Sao.logout) - .find('span:not(.icon)').text(title); }; Sao.main_menu_row_activate = function() { @@ -1194,7 +1187,7 @@ var Sao = { shortcut: 'f1', label: Sao.i18n.gettext('Show this help'), callback: function() { - help_dialog(); + Sao.help_dialog(); }, }, { shortcut: 'ctrl+f1', @@ -1272,7 +1265,7 @@ var Sao = { var _help_dialog = null; - function help_dialog() { + Sao.help_dialog = function() { Mousetrap.pause(); var dialog; if (!_help_dialog) {