From: Thierry Parmentelat Date: Thu, 11 Jul 2013 15:00:11 +0000 (+0200) Subject: improve rendering of popup error/warning messages X-Git-Tag: myslice-0.2-1~93 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=e43a74a15c125306412f66b5696043864c6e4aca improve rendering of popup error/warning messages --- diff --git a/manifold/core/result_value.py b/manifold/core/result_value.py index 9eb7a937..7728e8a9 100644 --- a/manifold/core/result_value.py +++ b/manifold/core/result_value.py @@ -1,6 +1,7 @@ # Inspired from GENI error codes import time +import pprint class ResultValue(dict): @@ -94,6 +95,10 @@ class ResultValue(dict): def ok_value(self): return self['value'] + @staticmethod + def to_html (raw_dict): + return pprint.pformat (raw_dict).replace("\\n","
") + # 67 # 68 9 # 69 diff --git a/manifold/manifoldproxy.py b/manifold/manifoldproxy.py index 984531e9..9d322ca7 100644 --- a/manifold/manifoldproxy.py +++ b/manifold/manifoldproxy.py @@ -5,6 +5,7 @@ from django.http import HttpResponse, HttpResponseForbidden #from manifold.manifoldquery import ManifoldQuery from manifold.core.query import Query +from manifold.core.result_value import ResultValue from manifold.manifoldapi import ManifoldAPI from manifold.manifoldresult import ManifoldException @@ -89,11 +90,7 @@ with the query passed using POST""" result = manifold_api.forward(manifold_query.to_dict()) # XXX TEMP HACK - import pprint - htmlLines = [] - for textLine in pprint.pformat(result['description']).splitlines(): - htmlLines.append('
%s' % textLine) # or something even nicer - result['description'] = ('\n'.join(htmlLines)).replace(' ', ' ') + result [ 'description' ] = [ ResultValue.to_html (x) for x in result['description'] ] json_answer=json.dumps(result) # if in debug mode we save this so we can use offline mode later diff --git a/third-party/jquery-notify/ui.notify.css b/third-party/jquery-notify/ui.notify.css index 8ace2163..7d88a607 100644 --- a/third-party/jquery-notify/ui.notify.css +++ b/third-party/jquery-notify/ui.notify.css @@ -1,4 +1,4 @@ -.ui-notify { width:350px; position:fixed; top: 67px; right:10px; z-index: 999;} +.ui-notify { width:500px; position:fixed; top: 67px; right:10px; z-index: 999;} /* .ui-notify { width:350px; position:fixed; top:10px; right:10px; } */ .ui-notify-message { padding:10px; margin-bottom:15px; -moz-border-radius:8px; -webkit-border-radius:8px; border-radius:8px; /* jordan */ max-height: 600px; } .ui-notify-message h1 { font-size:14px; margin:0; padding:0 } @@ -6,9 +6,15 @@ .ui-notify-message:last-child { margin-bottom:0 } .ui-notify-message-style { background:#000; background:rgba(0,0,0,0.8); -moz-box-shadow: 0 0 6px #000; -webkit-box-shadow: 0 0 6px #000; box-shadow: 0 0 6px #000; } .ui-notify-message-style h1 { color:#fff; font-weight:bold } -.ui-notify-message-style p { color:#fff; /* jordan */ max-height: 500px; overflow: auto; } .ui-notify-close { color:#fff; text-decoration:underline } .ui-notify-click { cursor:pointer } .ui-notify-cross { margin-top:-4px; float:right; cursor:pointer; text-decoration:none; font-size:12px; font-weight:bold; text-shadow:0 1px 1px #fff; padding:2px } .ui-notify-cross:hover { color:#ffffab } .ui-notify-cross:active { position:relative; top:1px } +/* jordan */ +.ui-notify-message-style p,.ui-notify-message-style pre { + font: normal 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; + background-color:#111; + color:#eee; + max-height: 500px; + overflow: auto; } diff --git a/views/templates/messages.html b/views/templates/messages.html index b6843361..06ac2ef4 100644 --- a/views/templates/messages.html +++ b/views/templates/messages.html @@ -9,7 +9,7 @@
x

#{title}

-

#{text}

+
#{text}