From ce97980c32bd4c4f927ab5d2abb00cec9cd19dac Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 7 Dec 2020 15:30:35 +0530 Subject: [PATCH] feat: add tooltips icon --- frappe/public/js/frappe/form/toolbar.js | 6 ++-- .../frappe/ui/notifications/notifications.js | 33 +++++++++++-------- frappe/public/js/frappe/ui/page.js | 1 + 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/frappe/public/js/frappe/form/toolbar.js b/frappe/public/js/frappe/form/toolbar.js index 6c5bef380b..28cc9bb28b 100644 --- a/frappe/public/js/frappe/form/toolbar.js +++ b/frappe/public/js/frappe/form/toolbar.js @@ -211,10 +211,10 @@ frappe.ui.form.Toolbar = Class.extend({ if (!this.frm.is_new() && !issingle) { this.page.add_action_icon("left", function() { me.frm.navigate_records(1); - }, 'prev-doc'); + }, 'prev-doc', __("Previous Document")); this.page.add_action_icon("right", function() { me.frm.navigate_records(0); - }, 'next-doc'); + }, 'next-doc', __("Next Document")); } // Print @@ -227,7 +227,7 @@ frappe.ui.form.Toolbar = Class.extend({ }, true); this.print_icon = this.page.add_action_icon("printer", function() { me.frm.print_doc(); - }); + },'', __("Print")); } } diff --git a/frappe/public/js/frappe/ui/notifications/notifications.js b/frappe/public/js/frappe/ui/notifications/notifications.js index 010f6b3f9b..afdb40118a 100644 --- a/frappe/public/js/frappe/ui/notifications/notifications.js +++ b/frappe/public/js/frappe/ui/notifications/notifications.js @@ -44,13 +44,17 @@ frappe.ui.Notifications = class Notifications { e.stopImmediatePropagation(); this.dropdown.dropdown('hide'); frappe.set_route('Form', 'Notification Settings', frappe.session.user); - }).appendTo(this.header_actions); + }).appendTo(this.header_actions) + .attr('title', __("Notification Settings")) + .tooltip(); $(` ${frappe.utils.icon('mark-as-read')} `) .on('click', (e) => this.mark_all_as_read(e)) - .appendTo(this.header_actions); + .appendTo(this.header_actions) + .attr('title', __("Mark all as read")) + .tooltip(); this.categories = [ { @@ -193,6 +197,7 @@ class BaseNotificaitonsView { class NotificationsView extends BaseNotificaitonsView { make() { this.notifications_icon = this.parent.find('.notifications-icon'); + this.notifications_icon.attr("title", __('Notifications')).tooltip(); this.setup_notification_listeners(); this.get_notifications_list(this.max_length).then(list => { @@ -277,23 +282,23 @@ class NotificationsView extends BaseNotificaitonsView { ${user_avatar} ${message_html} -
+
`); - item_html.find('.mark-as-read').on('click', (e) => { - e.preventDefault(); - e.stopImmediatePropagation(); - if (!field.read) { + if (!field.read) { + let mark_btn = item_html.find(".mark-as-read") + mark_btn.tooltip(); + mark_btn.on('click', (e) => { + e.preventDefault(); + e.stopImmediatePropagation(); this.mark_as_read(field.name, item_html); - } - }); - - item_html.on('click', (e) => { - if (!field.read) { + }); + + item_html.on('click', (e) => { this.mark_as_read(field.name, item_html); - } - }); + }); + } return item_html; } diff --git a/frappe/public/js/frappe/ui/page.js b/frappe/public/js/frappe/ui/page.js index 8873d13d18..d3184ecca2 100644 --- a/frappe/public/js/frappe/ui/page.js +++ b/frappe/public/js/frappe/ui/page.js @@ -158,6 +158,7 @@ frappe.ui.Page = Class.extend({ setup_sidebar_toggle() { let sidebar_toggle = $('.page-head').find('.sidebar-toggle-btn'); let sidebar_wrapper = this.wrapper.find('.layout-side-section'); + sidebar_toggle.attr("title", __("Toggle Sidebar")).tooltip(); if (sidebar_wrapper.length) { sidebar_toggle.click(() => sidebar_wrapper.toggle()); } else {