浏览代码

[minor] msgprint as alert

version-14
Rushabh Mehta 9 年前
父节点
当前提交
f435aafb92
共有 2 个文件被更改,包括 9 次插入1 次删除
  1. +4
    -1
      frappe/__init__.py
  2. +5
    -0
      frappe/public/js/frappe/ui/messages.js

+ 4
- 1
frappe/__init__.py 查看文件

@@ -242,7 +242,7 @@ def log(msg):
from utils import cstr
debug_log.append(cstr(msg))

def msgprint(msg, title=None, raise_exception=0, as_table=False, indicator=None):
def msgprint(msg, title=None, raise_exception=0, as_table=False, indicator=None, alert=False):
"""Print a message to the user (via HTTP response).
Messages are sent in the `__server_messages` property in the
response JSON and shown in a pop-up / modal.
@@ -285,6 +285,9 @@ def msgprint(msg, title=None, raise_exception=0, as_table=False, indicator=None)
if indicator:
out.indicator = indicator

if alert:
out.alert = 1

message_log.append(json.dumps(out))
_raise_exception()



+ 5
- 0
frappe/public/js/frappe/ui/messages.js 查看文件

@@ -98,6 +98,11 @@ frappe.msgprint = function(msg, title) {
return;
}

if(data.alert) {
frappe.show_alert(data.message);
return;
}

if(!msg_dialog) {
msg_dialog = new frappe.ui.Dialog({
title: __("Message"),


正在加载...
取消
保存