From b2fdfee46a0b4a1fa68218a6a77595f850657eed Mon Sep 17 00:00:00 2001 From: prssanna Date: Mon, 16 Sep 2019 23:58:08 +0530 Subject: [PATCH] fix: formatting --- .../notification_log/notification_log.js | 3 +- .../frappe/ui/notifications/notifications.js | 32 +++++++++++++------ frappe/public/less/notifications.less | 2 ++ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/frappe/core/doctype/notification_log/notification_log.js b/frappe/core/doctype/notification_log/notification_log.js index 8f6c2bb564..43cea8ddd5 100644 --- a/frappe/core/doctype/notification_log/notification_log.js +++ b/frappe/core/doctype/notification_log/notification_log.js @@ -5,6 +5,7 @@ frappe.ui.form.on('Notification Log', { refresh: function(frm) { let dt = frm.doc.reference_doctype; let dn = frm.doc.reference_name; - frm.fields_dict.reference_name.$input_wrapper.find('.control-value').wrapInner(``); + frm.fields_dict.reference_name.$input_wrapper.find('.control-value') + .wrapInner(``); } }); diff --git a/frappe/public/js/frappe/ui/notifications/notifications.js b/frappe/public/js/frappe/ui/notifications/notifications.js index 2c6e8f1812..a643c7a53f 100644 --- a/frappe/public/js/frappe/ui/notifications/notifications.js +++ b/frappe/public/js/frappe/ui/notifications/notifications.js @@ -37,6 +37,7 @@ frappe.ui.Notifications = class Notifications { let hide = $(e.currentTarget).next().hasClass("in"); if (!hide) { let today = frappe.datetime.now_date(); + frappe.xcall('frappe.desk.doctype.event.event.get_events', { start: today, end: frappe.datetime.add_days(today, 3) @@ -64,7 +65,8 @@ frappe.ui.Notifications = class Notifications { html = `
  • ${__('No Upcoming Events')}
  • `; - } + } + this.$upcoming_events.html(html); } @@ -112,7 +114,7 @@ frappe.ui.Notifications = class Notifications { keys.map(key => { let doc_dt = (map.doctypes) ? map.doctypes[key] : undefined; if (map[key] > 0 || target) { - this.add_notification(key, map[key], doc_dt, target); + this.add_notification_html(key, map[key], doc_dt, target); empty_map = 0; } }); @@ -122,19 +124,24 @@ frappe.ui.Notifications = class Notifications { } } - add_notification(name, value, doc_dt, target = false) { - let label = this.open_docs_config[name] ? this.open_docs_config[name].label : name; + add_notification_html(name, value, doc_dt, target = false) { + let label = this.open_docs_config[name] ? + this.open_docs_config[name].label : + name; let title = target ? `title="Your Target"` : ''; let $list_item = !target ? $(`
  • ${__(label)} ${value}
  • `) - : $(`
  • ${__(label)} -
    -
    -
    + : $(`
  • + ${__(label)} +
    +
    +
    +
    +
  • `); this.$open_docs.append($list_item); @@ -154,6 +161,7 @@ frappe.ui.Notifications = class Notifications { setup_open_docs_route() { let me = this; + this.$open_docs.on('click', 'li a', function() { let doctype = $(this).attr('data-doctype'); let doc = $(this).attr('data-doc'); @@ -180,6 +188,7 @@ frappe.ui.Notifications = class Notifications { this.$dropdown_list.find('.recent-notification').last().remove(); this.dropdown_items.pop(); } + this.insert_into_dropdown(); }); } @@ -227,6 +236,7 @@ frappe.ui.Notifications = class Notifications { ${__('No activity')} `; } + let dropdown_html = body_html + view_full_log_html; this.$notifications.append(dropdown_html); } @@ -272,6 +282,7 @@ frappe.ui.Notifications = class Notifications {
    `; + if (category_id !== 'notifications') { html += `
    ${__("Loading...")} @@ -286,12 +297,13 @@ frappe.ui.Notifications = class Notifications { } bind_events() { + let me = this; + frappe.realtime.on('notification', () => { this.$dropdown.find('.notifications-indicator').show(); this.update_dropdown(); }); - let me = this; this.$dropdown.on('hide.bs.dropdown', function() { me.$notification_indicator.hide(); let hide = $(this).data('closable'); diff --git a/frappe/public/less/notifications.less b/frappe/public/less/notifications.less index d2500b0700..b6768952ae 100644 --- a/frappe/public/less/notifications.less +++ b/frappe/public/less/notifications.less @@ -107,6 +107,7 @@ } @media (max-width: 767px) { + .dropdown-notifications { .notifications-list { max-height: 100vh; @@ -121,4 +122,5 @@ margin: 5px 0 0px 44px; } } + } \ No newline at end of file