[fix] dashboard cleanup
This commit is contained in:
parent
355d57b6c9
commit
adb2e86a3d
12 changed files with 112 additions and 46 deletions
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
$('<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>')
|
||||
.appendTo(this.wrapper);
|
||||
} 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);
|
||||
|
||||
// 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>
|
||||
<div class="progress-area hidden form-dashboard-section">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
{% for (var i=0; i < transactions.length; i++) { %}
|
||||
{% if((i % 2)===0) { %}<div class="row">{% } %}
|
||||
<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++) {
|
||||
var doctype = transactions[i].items[j]; %}
|
||||
<div class="document-link"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<a>{%= __("Assigned To Me") %}</a>
|
||||
</li>
|
||||
<li class="hide switch-list-view">
|
||||
<a>{%= __("Image View") %}</a>
|
||||
<a>{%= __("Show Images") %}</a>
|
||||
</li>
|
||||
{% if(frappe.help.has_help(doctype)) { %}
|
||||
<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) {
|
||||
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)
|
||||
|
||||
var switch_list_view = function(view) {
|
||||
var image_view = 0
|
||||
if(view == "Image View")
|
||||
if(view == __("Show Images"))
|
||||
image_view = 1
|
||||
|
||||
me.doclistview.meta.image_view = image_view;
|
||||
|
|
|
|||
|
|
@ -320,6 +320,7 @@ frappe.ui.Listing = Class.extend({
|
|||
while (cols.length) {
|
||||
row = this.add_row(cols[0]);
|
||||
$("<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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,12 @@
|
|||
}
|
||||
|
||||
.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 {
|
||||
|
|
@ -111,7 +116,7 @@
|
|||
}
|
||||
|
||||
.form-dashboard-section:last-child {
|
||||
// border-bottom: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.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 {
|
||||
margin: 0px;
|
||||
padding: 15px;
|
||||
|
||||
h6, .h6 {
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
|
||||
.form-section-heading {
|
||||
margin: 10px 0px;
|
||||
text-transform: uppercase;
|
||||
color: @text-muted;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
margin: 0px 0px 15px 15px;
|
||||
text-transform: uppercase;
|
||||
color: @text-muted;
|
||||
cursor: pointer;
|
||||
|
||||
.collapse-indicator {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,11 @@
|
|||
}
|
||||
|
||||
.list-row:hover, .grid-row:hover {
|
||||
background: @panel-bg;
|
||||
background-color: @panel-bg;
|
||||
}
|
||||
|
||||
.no-hover:hover {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.list-row:last-child {
|
||||
|
|
@ -261,6 +265,10 @@
|
|||
.image-view-col {
|
||||
padding-bottom: 5px;
|
||||
padding-top: 5px;
|
||||
|
||||
a {
|
||||
text-decoration: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
table.field-info {
|
||||
|
|
@ -268,9 +276,14 @@ table.field-info {
|
|||
bottom: -20px;
|
||||
font-size: 8pt;
|
||||
color: white;
|
||||
background-color: #000000;
|
||||
background-color: @text-color;
|
||||
position: absolute;
|
||||
padding-bottom: 0px !important;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
table.field-info tr td {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.zoom-view {
|
||||
|
|
@ -280,10 +293,10 @@ table.field-info {
|
|||
height: 36px;
|
||||
opacity: 0;
|
||||
font-size: 16px;
|
||||
color: black;
|
||||
color: @text-color;
|
||||
position: absolute;
|
||||
padding: 0px !important;
|
||||
border-radius: 20px;
|
||||
border-radius: 5px;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
|
|
@ -292,9 +305,9 @@ table.field-info {
|
|||
}
|
||||
|
||||
.image-field:hover .field-info {
|
||||
opacity: 0.9;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.image-field:hover .zoom-view {
|
||||
opacity: 1;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue