From ccc4981ff62e695908a9855041b9669800a733ed Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 30 Mar 2017 16:24:21 +0200 Subject: [PATCH] common: captioned alert messages Split message in 1st argument to title and optional details paragraphs. --- base.css | 6 ++++++ common.inc.plp | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/base.css b/base.css index 95721e0..8ab767c 100644 --- 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; diff --git a/common.inc.plp b/common.inc.plp index e4cc5f9..cd218ef 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -11,9 +11,13 @@ use HTTP::Date; use Encode qw( decode_utf8 ); sub Alert { - my ($title, $debug) = @_; - $title .= ": $debug" if $Dev and defined $debug; - say "

$title

\n"; + my ($html, $debug) = @_; + ref $html eq 'ARRAY' or $html = [$html]; + my ($title, @lines) = @{$html}; + $body = "

$title

"; + $body .= "\n

$_

" for @lines; + $body .= "\n
$debug
" if $Dev and $debug; + say "
$body
\n"; } $PLP::ERROR = sub { -- 2.30.0