@@ -283,6 +283,12 @@ def throw(msg, exc=ValidationError): | |||||
:param exc: Exception class. Default `frappe.ValidationError`""" | :param exc: Exception class. Default `frappe.ValidationError`""" | ||||
msgprint(msg, raise_exception=exc) | msgprint(msg, raise_exception=exc) | ||||
def emit_js(js, user=False, **kwargs): | |||||
from frappe.async import publish_realtime | |||||
if user == False: | |||||
user = session.user | |||||
publish_realtime('eval_js', js, user=user, **kwargs) | |||||
def create_folder(path, with_init=False): | def create_folder(path, with_init=False): | ||||
"""Create a folder in the given path and add an `__init__.py` file (optional). | """Create a folder in the given path and add an `__init__.py` file (optional). | ||||
@@ -71,17 +71,11 @@ | |||||
display: none; | display: none; | ||||
} | } | ||||
} | } | ||||
.form-dashboard { | |||||
border-bottom: 1px solid #EBEFF2; | |||||
} | |||||
.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; | ||||
} | } | ||||
@@ -427,11 +421,18 @@ select.form-control { | |||||
font-weight: bold; | font-weight: bold; | ||||
background-color: #fffdf4; | background-color: #fffdf4; | ||||
} | } | ||||
.form-headline { | |||||
padding: 0px 15px; | |||||
} | |||||
.form-headline .alert { | .form-headline .alert { | ||||
font-size: 12px; | font-size: 12px; | ||||
background-color: #fffce7; | background-color: #fffce7; | ||||
font-weight: normal !important; | |||||
border: 0px; | |||||
border-radius: 0px; | |||||
margin-bottom: 0px; | margin-bottom: 0px; | ||||
margin: 0px -15px; | margin: 0px -15px; | ||||
padding: 10px 30px; | |||||
} | } | ||||
.delivery-status-indicator { | .delivery-status-indicator { | ||||
display: inline-block; | display: inline-block; | ||||
@@ -42,6 +42,21 @@ frappe.ui.form.Dashboard = Class.extend({ | |||||
this.headline.empty().addClass('hidden'); | this.headline.empty().addClass('hidden'); | ||||
} | } | ||||
}, | }, | ||||
add_comment: function(text, permanent) { | |||||
var me = this; | |||||
this.set_headline_alert(text); | |||||
if(!permanent) { | |||||
setTimeout(function() { | |||||
me.clear_headline(); | |||||
}, 10000); | |||||
} | |||||
}, | |||||
clear_comment: function() { | |||||
this.clear_headline(); | |||||
}, | |||||
set_headline_alert: function(text, alert_class) { | set_headline_alert: function(text, alert_class) { | ||||
if(text) { | if(text) { | ||||
if(!alert_class) alert_class = "alert-warning"; | if(!alert_class) alert_class = "alert-warning"; | ||||
@@ -27,6 +27,10 @@ frappe.socket = { | |||||
frappe.msgprint(message); | frappe.msgprint(message); | ||||
}); | }); | ||||
frappe.socket.socket.on('eval_js', function(message) { | |||||
eval(message); | |||||
}); | |||||
frappe.socket.setup_listeners(); | frappe.socket.setup_listeners(); | ||||
frappe.socket.setup_reconnect(); | frappe.socket.setup_reconnect(); | ||||
@@ -230,7 +230,7 @@ frappe.show_alert = function(txt, seconds) { | |||||
return false; | return false; | ||||
}); | }); | ||||
div.delay(seconds ? seconds * 1000 : 3000).fadeOut(300); | |||||
div.delay(seconds ? seconds * 1000 : 7000).fadeOut(300); | |||||
return div; | return div; | ||||
} | } | ||||
@@ -101,7 +101,7 @@ | |||||
} | } | ||||
.form-dashboard { | .form-dashboard { | ||||
border-bottom: 1px solid @light-border-color; | |||||
//border-bottom: 1px solid @light-border-color; | |||||
} | } | ||||
.form-dashboard-section { | .form-dashboard-section { | ||||
@@ -111,7 +111,7 @@ | |||||
} | } | ||||
.form-dashboard-section:last-child { | .form-dashboard-section:last-child { | ||||
border-bottom: none; | |||||
// border-bottom: none; | |||||
} | } | ||||
.form-heatmap { | .form-heatmap { | ||||
@@ -540,11 +540,19 @@ select.form-control { | |||||
background-color: @extra-light-yellow; | background-color: @extra-light-yellow; | ||||
} | } | ||||
.form-headline { | |||||
padding: 0px 15px; | |||||
} | |||||
.form-headline .alert { | .form-headline .alert { | ||||
font-size: @text-medium; | font-size: @text-medium; | ||||
background-color: @light-yellow; | background-color: @light-yellow; | ||||
font-weight: normal !important; | |||||
border: 0px; | |||||
border-radius: 0px; | |||||
margin-bottom: 0px; | margin-bottom: 0px; | ||||
margin: 0px -15px; | margin: 0px -15px; | ||||
padding: 10px 30px; | |||||
} | } | ||||
.delivery-status-indicator { | .delivery-status-indicator { | ||||