common: captioned alert messages
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 30 Mar 2017 14:24:21 +0000 (16:24 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 24 Apr 2017 18:25:53 +0000 (20:25 +0200)
Split message in 1st argument to title and optional details paragraphs.

base.css
common.inc.plp

index 95721e015a5221ffd8388eaf46eea20244e704dc..8ab767c1b2450b4c2a5d25f84286e394f529c771 100644 (file)
--- a/base.css
+++ b/base.css
@@ -85,6 +85,12 @@ p.footer {
        margin: 2ex auto;
        clear: both;
 }
+.error > * {
+       margin-bottom: 1ex;
+}
+.error > *:last-child {
+       margin-bottom: 0;
+}
 
 ul {
        margin: 0;
index e4cc5f99f5635a4920d007ddb5433878c13c991c..cd218efe2436d4e6dbc36ec67e196992a5196ccd 100644 (file)
@@ -11,9 +11,13 @@ use HTTP::Date;
 use Encode qw( decode_utf8 );
 
 sub Alert {
-       my ($title, $debug) = @_;
-       $title .= ": <em>$debug</em>" if $Dev and defined $debug;
-       say "<p class=error>$title</p>\n";
+       my ($html, $debug) = @_;
+       ref $html eq 'ARRAY' or $html = [$html];
+       my ($title, @lines) = @{$html};
+       $body = "<h2>$title</h2>";
+       $body .= "\n<p>$_</p>" for @lines;
+       $body .= "\n<pre>$debug</pre>" if $Dev and $debug;
+       say "<div class=error>$body</div>\n";
 }
 
 $PLP::ERROR = sub {