diff --git a/frappe/desk/notifications.py b/frappe/desk/notifications.py index 1218ff7a98..d01de3fdeb 100644 --- a/frappe/desk/notifications.py +++ b/frappe/desk/notifications.py @@ -189,6 +189,10 @@ def get_open_count(doctype, name): out = [] for d in items: + if d in links.get('internal_links', {}): + # internal link + continue + filters = get_filters_for(d) fieldname = links.get('non_standard_fieldnames', {}).get(d, links.fieldname) data = {'name': d} diff --git a/frappe/public/css/form.css b/frappe/public/css/form.css index 0c9f75e87c..6b7d1989eb 100644 --- a/frappe/public/css/form.css +++ b/frappe/public/css/form.css @@ -71,11 +71,21 @@ display: none; } } +.form-dashboard { + background-color: #fafbfc; + border-bottom: 1px solid #d1d8dd; +} +.form-documents h6 { + margin-top: 15px; +} .form-dashboard-section { padding: 15px 30px; margin: 0px; border-bottom: 1px solid #EBEFF2; } +.form-dashboard-section:last-child { + border-bottom: none; +} .form-heatmap { padding-top: 30px; } @@ -137,24 +147,23 @@ margin-left: 5px; margin-right: 5px; } +h6.uppercase, +.h6.uppercase { + font-size: 11px; + font-weight: normal; + letter-spacing: 0.4px; + text-transform: uppercase; + color: #8D99A6; +} .form-section { margin: 0px; padding: 15px; } -.form-section h6, -.form-section .h6 { - font-size: 11px; - letter-spacing: 0.4px; -} .form-section .form-section-heading { margin: 10px 0px; - text-transform: uppercase; - color: #8D99A6; } .form-section .section-head { margin: 0px 0px 15px 15px; - text-transform: uppercase; - color: #8D99A6; cursor: pointer; } .form-section .section-head .collapse-indicator { diff --git a/frappe/public/css/list.css b/frappe/public/css/list.css index 26e8b312f2..6581f7c640 100644 --- a/frappe/public/css/list.css +++ b/frappe/public/css/list.css @@ -83,7 +83,10 @@ } .list-row:hover, .grid-row:hover { - background: #F7FAFC; + background-color: #F7FAFC; +} +.no-hover:hover { + background-color: transparent !important; } .list-row:last-child { border-bottom: 0px; @@ -205,14 +208,21 @@ padding-bottom: 5px; padding-top: 5px; } +.image-view-col a { + text-decoration: none !important; +} table.field-info { opacity: 0; bottom: -20px; font-size: 8pt; color: white; - background-color: #000000; + background-color: #36414C; position: absolute; padding-bottom: 0px !important; + border: 0px; +} +table.field-info tr td { + border: none !important; } .zoom-view { top: 10px !important; @@ -221,18 +231,18 @@ table.field-info { height: 36px; opacity: 0; font-size: 16px; - color: black; + color: #36414C; position: absolute; padding: 0px !important; - border-radius: 20px; + border-radius: 5px; border: 0px; } .image-field { position: relative; } .image-field:hover .field-info { - opacity: 0.9; + opacity: 0.7; } .image-field:hover .zoom-view { - opacity: 1; + opacity: 0.6; } diff --git a/frappe/public/js/frappe/form/dashboard.js b/frappe/public/js/frappe/form/dashboard.js index bb611342b9..225d2c05a4 100644 --- a/frappe/public/js/frappe/form/dashboard.js +++ b/frappe/public/js/frappe/form/dashboard.js @@ -179,21 +179,28 @@ frappe.ui.form.Dashboard = Class.extend({ // bind links this.transactions_area.find(".badge-link").on('click', function() { - me.open_document_list($(this).parent().attr('data-doctype')); + me.open_document_list($(this).parent()); }); // bind open notifications this.transactions_area.find('.open-notification').on('click', function() { - me.open_document_list($(this).parent().attr('data-doctype'), true); + me.open_document_list($(this).parent(), true); }); this.data_rendered = true; }, - open_document_list: function(doctype, show_open) { + open_document_list: function($link, show_open) { // show document list with filters - frappe.route_options = this.get_document_filter(doctype); - if(show_open) { - $.extend(frappe.route_options, frappe.ui.notifications.get_filters(doctype)); + var doctype = $link.attr('data-doctype'), + names = $link.attr('data-names') + + if(names) { + frappe.route_options = {'name': ['in', names]}; + } else { + frappe.route_options = this.get_document_filter(doctype); + if(show_open) { + $.extend(frappe.route_options, frappe.ui.notifications.get_filters(doctype)); + } } frappe.set_route("List", doctype); @@ -234,16 +241,32 @@ frappe.ui.form.Dashboard = Class.extend({ if(r.message.timeline_data) { me.update_heatmap(r.message.timeline_data); } + + // update badges $.each(r.message.count, function(i, d) { me.frm.dashboard.set_badge_count(d.name, cint(d.open_count), cint(d.count)); }); + + // update from internal links + $.each(me.data.internal_links || {}, function(doctype, link) { + var table_fieldname = link[0], link_fieldname = link[1]; + var names = []; + (me.frm.doc[table_fieldname] || []).forEach(function(d) { + var value = d[link_fieldname]; + if(names.indexOf(value)===-1) { + names.push(value); + } + }); + me.frm.dashboard.set_badge_count(doctype, 0, names.length, names); + }); + me.frm.dashboard_data = r.message; me.frm.trigger('dashboard_update'); } }); }, - set_badge_count: function(doctype, open_count, count) { + set_badge_count: function(doctype, open_count, count, names) { var $link = $(this.transactions_area) .find('.document-link[data-doctype="'+doctype+'"]'); @@ -259,6 +282,7 @@ frappe.ui.form.Dashboard = Class.extend({ .html((count > 9) ? '9+' : count); } + $link.attr('data-names', names ? names.join(',') : ''); }, update_heatmap: function(data) { diff --git a/frappe/public/js/frappe/form/layout.js b/frappe/public/js/frappe/form/layout.js index 817eca7494..5fc8d8d2fe 100644 --- a/frappe/public/js/frappe/form/layout.js +++ b/frappe/public/js/frappe/form/layout.js @@ -400,7 +400,7 @@ frappe.ui.form.Layout = Class.extend({ if (!doc && this.get_values) { var doc = this.get_values(true); } - + if (!doc) { return; } @@ -471,11 +471,11 @@ frappe.ui.form.Section = Class.extend({ make_head: function() { var me = this; if(!this.df.collapsible) { - $('
' + $('
' + __(this.df.label) + '
') .appendTo(this.wrapper); } else { - this.head = $('
' + this.head = $('').appendTo(this.wrapper); // show / hide based on status diff --git a/frappe/public/js/frappe/form/templates/form_dashboard.html b/frappe/public/js/frappe/form/templates/form_dashboard.html index 0ec3f35f7f..11fc8c4782 100644 --- a/frappe/public/js/frappe/form/templates/form_dashboard.html +++ b/frappe/public/js/frappe/form/templates/form_dashboard.html @@ -1,4 +1,4 @@ -