@@ -189,6 +189,10 @@ def get_open_count(doctype, name): | |||||
out = [] | out = [] | ||||
for d in items: | for d in items: | ||||
if d in links.get('internal_links', {}): | |||||
# internal link | |||||
continue | |||||
filters = get_filters_for(d) | filters = get_filters_for(d) | ||||
fieldname = links.get('non_standard_fieldnames', {}).get(d, links.fieldname) | fieldname = links.get('non_standard_fieldnames', {}).get(d, links.fieldname) | ||||
data = {'name': d} | data = {'name': d} | ||||
@@ -71,11 +71,21 @@ | |||||
display: none; | display: none; | ||||
} | } | ||||
} | } | ||||
.form-dashboard { | |||||
background-color: #fafbfc; | |||||
border-bottom: 1px solid #d1d8dd; | |||||
} | |||||
.form-documents h6 { | |||||
margin-top: 15px; | |||||
} | |||||
.form-dashboard-section { | .form-dashboard-section { | ||||
padding: 15px 30px; | padding: 15px 30px; | ||||
margin: 0px; | margin: 0px; | ||||
border-bottom: 1px solid #EBEFF2; | border-bottom: 1px solid #EBEFF2; | ||||
} | } | ||||
.form-dashboard-section:last-child { | |||||
border-bottom: none; | |||||
} | |||||
.form-heatmap { | .form-heatmap { | ||||
padding-top: 30px; | padding-top: 30px; | ||||
} | } | ||||
@@ -137,24 +147,23 @@ | |||||
margin-left: 5px; | margin-left: 5px; | ||||
margin-right: 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 { | .form-section { | ||||
margin: 0px; | margin: 0px; | ||||
padding: 15px; | padding: 15px; | ||||
} | } | ||||
.form-section h6, | |||||
.form-section .h6 { | |||||
font-size: 11px; | |||||
letter-spacing: 0.4px; | |||||
} | |||||
.form-section .form-section-heading { | .form-section .form-section-heading { | ||||
margin: 10px 0px; | margin: 10px 0px; | ||||
text-transform: uppercase; | |||||
color: #8D99A6; | |||||
} | } | ||||
.form-section .section-head { | .form-section .section-head { | ||||
margin: 0px 0px 15px 15px; | margin: 0px 0px 15px 15px; | ||||
text-transform: uppercase; | |||||
color: #8D99A6; | |||||
cursor: pointer; | cursor: pointer; | ||||
} | } | ||||
.form-section .section-head .collapse-indicator { | .form-section .section-head .collapse-indicator { | ||||
@@ -83,7 +83,10 @@ | |||||
} | } | ||||
.list-row:hover, | .list-row:hover, | ||||
.grid-row:hover { | .grid-row:hover { | ||||
background: #F7FAFC; | |||||
background-color: #F7FAFC; | |||||
} | |||||
.no-hover:hover { | |||||
background-color: transparent !important; | |||||
} | } | ||||
.list-row:last-child { | .list-row:last-child { | ||||
border-bottom: 0px; | border-bottom: 0px; | ||||
@@ -205,14 +208,21 @@ | |||||
padding-bottom: 5px; | padding-bottom: 5px; | ||||
padding-top: 5px; | padding-top: 5px; | ||||
} | } | ||||
.image-view-col a { | |||||
text-decoration: none !important; | |||||
} | |||||
table.field-info { | table.field-info { | ||||
opacity: 0; | opacity: 0; | ||||
bottom: -20px; | bottom: -20px; | ||||
font-size: 8pt; | font-size: 8pt; | ||||
color: white; | color: white; | ||||
background-color: #000000; | |||||
background-color: #36414C; | |||||
position: absolute; | position: absolute; | ||||
padding-bottom: 0px !important; | padding-bottom: 0px !important; | ||||
border: 0px; | |||||
} | |||||
table.field-info tr td { | |||||
border: none !important; | |||||
} | } | ||||
.zoom-view { | .zoom-view { | ||||
top: 10px !important; | top: 10px !important; | ||||
@@ -221,18 +231,18 @@ table.field-info { | |||||
height: 36px; | height: 36px; | ||||
opacity: 0; | opacity: 0; | ||||
font-size: 16px; | font-size: 16px; | ||||
color: black; | |||||
color: #36414C; | |||||
position: absolute; | position: absolute; | ||||
padding: 0px !important; | padding: 0px !important; | ||||
border-radius: 20px; | |||||
border-radius: 5px; | |||||
border: 0px; | border: 0px; | ||||
} | } | ||||
.image-field { | .image-field { | ||||
position: relative; | position: relative; | ||||
} | } | ||||
.image-field:hover .field-info { | .image-field:hover .field-info { | ||||
opacity: 0.9; | |||||
opacity: 0.7; | |||||
} | } | ||||
.image-field:hover .zoom-view { | .image-field:hover .zoom-view { | ||||
opacity: 1; | |||||
opacity: 0.6; | |||||
} | } |
@@ -179,21 +179,28 @@ frappe.ui.form.Dashboard = Class.extend({ | |||||
// bind links | // bind links | ||||
this.transactions_area.find(".badge-link").on('click', function() { | 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 | // bind open notifications | ||||
this.transactions_area.find('.open-notification').on('click', function() { | 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; | this.data_rendered = true; | ||||
}, | }, | ||||
open_document_list: function(doctype, show_open) { | |||||
open_document_list: function($link, show_open) { | |||||
// show document list with filters | // 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); | frappe.set_route("List", doctype); | ||||
@@ -234,16 +241,32 @@ frappe.ui.form.Dashboard = Class.extend({ | |||||
if(r.message.timeline_data) { | if(r.message.timeline_data) { | ||||
me.update_heatmap(r.message.timeline_data); | me.update_heatmap(r.message.timeline_data); | ||||
} | } | ||||
// update badges | |||||
$.each(r.message.count, function(i, d) { | $.each(r.message.count, function(i, d) { | ||||
me.frm.dashboard.set_badge_count(d.name, cint(d.open_count), cint(d.count)); | 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.dashboard_data = r.message; | ||||
me.frm.trigger('dashboard_update'); | 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) | var $link = $(this.transactions_area) | ||||
.find('.document-link[data-doctype="'+doctype+'"]'); | .find('.document-link[data-doctype="'+doctype+'"]'); | ||||
@@ -259,6 +282,7 @@ frappe.ui.form.Dashboard = Class.extend({ | |||||
.html((count > 9) ? '9+' : count); | .html((count > 9) ? '9+' : count); | ||||
} | } | ||||
$link.attr('data-names', names ? names.join(',') : ''); | |||||
}, | }, | ||||
update_heatmap: function(data) { | update_heatmap: function(data) { | ||||
@@ -400,7 +400,7 @@ frappe.ui.form.Layout = Class.extend({ | |||||
if (!doc && this.get_values) { | if (!doc && this.get_values) { | ||||
var doc = this.get_values(true); | var doc = this.get_values(true); | ||||
} | } | ||||
if (!doc) { | if (!doc) { | ||||
return; | return; | ||||
} | } | ||||
@@ -471,11 +471,11 @@ frappe.ui.form.Section = Class.extend({ | |||||
make_head: function() { | make_head: function() { | ||||
var me = this; | var me = this; | ||||
if(!this.df.collapsible) { | if(!this.df.collapsible) { | ||||
$('<div class="col-sm-12"><h6 class="form-section-heading">' | |||||
$('<div class="col-sm-12"><h6 class="form-section-heading uppercase">' | |||||
+ __(this.df.label) + '</h6></div>') | + __(this.df.label) + '</h6></div>') | ||||
.appendTo(this.wrapper); | .appendTo(this.wrapper); | ||||
} else { | } else { | ||||
this.head = $('<div class="section-head"><a class="h6">' | |||||
this.head = $('<div class="section-head"><a class="h6 uppercase">' | |||||
+__(this.df.label)+'</a><span class="octicon octicon-chevron-down collapse-indicator"></span></div>').appendTo(this.wrapper); | +__(this.df.label)+'</a><span class="octicon octicon-chevron-down collapse-indicator"></span></div>').appendTo(this.wrapper); | ||||
// show / hide based on status | // show / hide based on status | ||||
@@ -1,4 +1,4 @@ | |||||
<div class="form-dashboard shaded-section hidden"> | |||||
<div class="form-dashboard hidden"> | |||||
<h4 class="form-headline hidden form-dashboard-section"> | <h4 class="form-headline hidden form-dashboard-section"> | ||||
</h4> | </h4> | ||||
<div class="progress-area hidden form-dashboard-section"> | <div class="progress-area hidden form-dashboard-section"> | ||||
@@ -2,7 +2,7 @@ | |||||
{% for (var i=0; i < transactions.length; i++) { %} | {% for (var i=0; i < transactions.length; i++) { %} | ||||
{% if((i % 2)===0) { %}<div class="row">{% } %} | {% if((i % 2)===0) { %}<div class="row">{% } %} | ||||
<div class="col-xs-6"> | <div class="col-xs-6"> | ||||
<h5 style="margin-top: 15px;">{{ transactions[i].label }}</h5> | |||||
<h6 class="uppercase">{{ transactions[i].label }}</h5> | |||||
{% for (var j=0; j < transactions[i].items.length; j++) { | {% for (var j=0; j < transactions[i].items.length; j++) { | ||||
var doctype = transactions[i].items[j]; %} | var doctype = transactions[i].items[j]; %} | ||||
<div class="document-link" | <div class="document-link" | ||||
@@ -20,7 +20,7 @@ | |||||
<a>{%= __("Assigned To Me") %}</a> | <a>{%= __("Assigned To Me") %}</a> | ||||
</li> | </li> | ||||
<li class="hide switch-list-view"> | <li class="hide switch-list-view"> | ||||
<a>{%= __("Image View") %}</a> | |||||
<a>{%= __("Show Images") %}</a> | |||||
</li> | </li> | ||||
{% if(frappe.help.has_help(doctype)) { %} | {% if(frappe.help.has_help(doctype)) { %} | ||||
<li><a class="help-link" data-doctype="{{ doctype }}">{{ __("Help") }}</a></li> | <li><a class="help-link" data-doctype="{{ doctype }}">{{ __("Help") }}</a></li> | ||||
@@ -83,12 +83,12 @@ frappe.views.ListSidebar = Class.extend({ | |||||
if(this.doclistview.meta.image_field) { | if(this.doclistview.meta.image_field) { | ||||
this.page.sidebar.find(".switch-list-view").removeClass("hide"); | this.page.sidebar.find(".switch-list-view").removeClass("hide"); | ||||
var label = this.doclistview.meta.image_view ? "List View": "Image View"; | |||||
var label = this.doclistview.meta.image_view ? __("Show List"): __("Show Images"); | |||||
this.page.sidebar.find(".switch-list-view a").html(label) | this.page.sidebar.find(".switch-list-view a").html(label) | ||||
var switch_list_view = function(view) { | var switch_list_view = function(view) { | ||||
var image_view = 0 | var image_view = 0 | ||||
if(view == "Image View") | |||||
if(view == __("Show Images")) | |||||
image_view = 1 | image_view = 1 | ||||
me.doclistview.meta.image_view = image_view; | me.doclistview.meta.image_view = image_view; | ||||
@@ -320,6 +320,7 @@ frappe.ui.Listing = Class.extend({ | |||||
while (cols.length) { | while (cols.length) { | ||||
row = this.add_row(cols[0]); | row = this.add_row(cols[0]); | ||||
$("<div class='row image-view-marker'></div>").appendTo(row); | $("<div class='row image-view-marker'></div>").appendTo(row); | ||||
$(row).addClass('no-hover'); | |||||
this.render_image_view_row(row, cols.splice(0, 4), this, i); | this.render_image_view_row(row, cols.splice(0, 4), this, i); | ||||
} | } | ||||
@@ -101,7 +101,12 @@ | |||||
} | } | ||||
.form-dashboard { | .form-dashboard { | ||||
//border-bottom: 1px solid @light-border-color; | |||||
background-color: @light-bg; | |||||
border-bottom: 1px solid @border-color; | |||||
} | |||||
.form-documents h6 { | |||||
margin-top: 15px; | |||||
} | } | ||||
.form-dashboard-section { | .form-dashboard-section { | ||||
@@ -111,7 +116,7 @@ | |||||
} | } | ||||
.form-dashboard-section:last-child { | .form-dashboard-section:last-child { | ||||
// border-bottom: none; | |||||
border-bottom: none; | |||||
} | } | ||||
.form-heatmap { | .form-heatmap { | ||||
@@ -189,25 +194,25 @@ | |||||
} | } | ||||
} | } | ||||
h6.uppercase, .h6.uppercase { | |||||
font-size: 11px; | |||||
font-weight: normal; | |||||
letter-spacing: 0.4px; | |||||
text-transform: uppercase; | |||||
color: @text-muted; | |||||
} | |||||
.form-section { | .form-section { | ||||
margin: 0px; | margin: 0px; | ||||
padding: 15px; | padding: 15px; | ||||
h6, .h6 { | |||||
font-size: 11px; | |||||
letter-spacing: 0.4px; | |||||
} | |||||
.form-section-heading { | .form-section-heading { | ||||
margin: 10px 0px; | margin: 10px 0px; | ||||
text-transform: uppercase; | |||||
color: @text-muted; | |||||
} | } | ||||
.section-head { | .section-head { | ||||
margin: 0px 0px 15px 15px; | margin: 0px 0px 15px 15px; | ||||
text-transform: uppercase; | |||||
color: @text-muted; | |||||
cursor: pointer; | cursor: pointer; | ||||
.collapse-indicator { | .collapse-indicator { | ||||
@@ -106,7 +106,11 @@ | |||||
} | } | ||||
.list-row:hover, .grid-row:hover { | .list-row:hover, .grid-row:hover { | ||||
background: @panel-bg; | |||||
background-color: @panel-bg; | |||||
} | |||||
.no-hover:hover { | |||||
background-color: transparent !important; | |||||
} | } | ||||
.list-row:last-child { | .list-row:last-child { | ||||
@@ -261,6 +265,10 @@ | |||||
.image-view-col { | .image-view-col { | ||||
padding-bottom: 5px; | padding-bottom: 5px; | ||||
padding-top: 5px; | padding-top: 5px; | ||||
a { | |||||
text-decoration: none !important; | |||||
} | |||||
} | } | ||||
table.field-info { | table.field-info { | ||||
@@ -268,9 +276,14 @@ table.field-info { | |||||
bottom: -20px; | bottom: -20px; | ||||
font-size: 8pt; | font-size: 8pt; | ||||
color: white; | color: white; | ||||
background-color: #000000; | |||||
background-color: @text-color; | |||||
position: absolute; | position: absolute; | ||||
padding-bottom: 0px !important; | padding-bottom: 0px !important; | ||||
border: 0px; | |||||
} | |||||
table.field-info tr td { | |||||
border: none !important; | |||||
} | } | ||||
.zoom-view { | .zoom-view { | ||||
@@ -280,10 +293,10 @@ table.field-info { | |||||
height: 36px; | height: 36px; | ||||
opacity: 0; | opacity: 0; | ||||
font-size: 16px; | font-size: 16px; | ||||
color: black; | |||||
color: @text-color; | |||||
position: absolute; | position: absolute; | ||||
padding: 0px !important; | padding: 0px !important; | ||||
border-radius: 20px; | |||||
border-radius: 5px; | |||||
border: 0px; | border: 0px; | ||||
} | } | ||||
@@ -292,9 +305,9 @@ table.field-info { | |||||
} | } | ||||
.image-field:hover .field-info { | .image-field:hover .field-info { | ||||
opacity: 0.9; | |||||
opacity: 0.7; | |||||
} | } | ||||
.image-field:hover .zoom-view { | .image-field:hover .zoom-view { | ||||
opacity: 1; | |||||
opacity: 0.6; | |||||
} | } |