Quellcode durchsuchen

[magic] frappe.emit_js

version-14
Rushabh Mehta vor 9 Jahren
Ursprung
Commit
5a35548c6a
6 geänderte Dateien mit 43 neuen und 9 gelöschten Zeilen
  1. +6
    -0
      frappe/__init__.py
  2. +7
    -6
      frappe/public/css/form.css
  3. +15
    -0
      frappe/public/js/frappe/form/dashboard.js
  4. +4
    -0
      frappe/public/js/frappe/socketio_client.js
  5. +1
    -1
      frappe/public/js/frappe/ui/messages.js
  6. +10
    -2
      frappe/public/less/form.less

+ 6
- 0
frappe/__init__.py Datei anzeigen

@@ -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).




+ 7
- 6
frappe/public/css/form.css Datei anzeigen

@@ -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;


+ 15
- 0
frappe/public/js/frappe/form/dashboard.js Datei anzeigen

@@ -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";


+ 4
- 0
frappe/public/js/frappe/socketio_client.js Datei anzeigen

@@ -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();




+ 1
- 1
frappe/public/js/frappe/ui/messages.js Datei anzeigen

@@ -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;
} }




+ 10
- 2
frappe/public/less/form.less Datei anzeigen

@@ -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 {


Laden…
Abbrechen
Speichern