소스 검색

[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"),


불러오는 중...
취소
저장