diff --git a/app/classes/messages.php b/app/classes/messages.php index 5f1c44e..99da945 100644 --- a/app/classes/messages.php +++ b/app/classes/messages.php @@ -124,19 +124,21 @@ class Messages { /** * Render message HTML */ - public static function render($category, $key, $customMessage = null, $dismissible = null) { + public static function render($category, $key, $customMessage = null, $dismissible = false, $small = false) { $config = self::get($category, $key); if (!$config) return ''; $message = $customMessage ?? $config['message']; $isDismissible = $dismissible ?? $config['dismissible']; $dismissClass = $isDismissible ? ' alert-dismissible fade show' : ''; - $dismissButton = $isDismissible ? '' : ''; + $dismissButton = $isDismissible ? '' : ''; + $smallClass = $small ? ' alert-sm' : ''; return sprintf( - '', + '', $config['type'], $dismissClass, + $smallClass, htmlspecialchars($message), $dismissButton ); @@ -145,7 +147,7 @@ class Messages { /** * Store message in session for display after redirect */ - public static function flash($category, $key, $customMessage = null, $dismissible = null) { + public static function flash($category, $key, $customMessage = null, $dismissible = false, $small = false) { if (!isset($_SESSION['flash_messages'])) { $_SESSION['flash_messages'] = []; } @@ -153,7 +155,8 @@ class Messages { 'category' => $category, 'key' => $key, 'custom_message' => $customMessage, - 'dismissible' => $dismissible + 'dismissible' => $dismissible, + 'small' => $small ]; } diff --git a/public_html/index.php b/public_html/index.php index f55e000..3d702dd 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -188,7 +188,7 @@ if ($page == 'logout') { $server_endpoint = '/health'; $server_status = $serverObject->getServerStatus($server_host, $server_port, $server_endpoint); if (!$server_status) { - echo Messages::render('ERROR', 'DEFAULT', 'The Jilo Server is not running. Some data may be old and incorrect.', false); + echo Messages::render('ERROR', 'DEFAULT', 'The Jilo Server is not running. Some data may be old and incorrect.', false, true); } } diff --git a/public_html/static/css/main.css b/public_html/static/css/main.css index 859f366..5505e0a 100644 --- a/public_html/static/css/main.css +++ b/public_html/static/css/main.css @@ -201,3 +201,17 @@ html, body { border: 1px solid gray; border-radius: 4px; } + +/* messages system */ +.alert-sm { + padding: 0.25rem 0.5rem; + font-size: 0.875rem; + line-height: 1.2; + margin-bottom: 0.5rem; +} + +.alert-sm .btn-close-sm { + padding: 0.25rem 0.25rem; + margin: -0.125rem -0.125rem -0.125rem auto; + font-size: 0.75rem; +}