diff --git a/lang/de/lang.php b/lang/de/lang.php index b9d2fd4..2ba6eaf 100644 --- a/lang/de/lang.php +++ b/lang/de/lang.php @@ -13,3 +13,6 @@ $lang['lastmodified'] = 'Letzte Änderung'; $lang['openlocation'] = 'Ort öffnen'; $lang['error_nomatch'] = 'Keine Treffer'; $lang['error_outsidejail'] = 'Zugriff verweigert'; + +$lang['empty_files'] = 'Keine Dateien'; +$lang['empty_images'] = 'Keine Bilder'; diff --git a/lang/en/lang.php b/lang/en/lang.php index 918b671..74d58f6 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -13,3 +13,6 @@ $lang['lastmodified'] = 'Last modified'; $lang['openlocation'] = 'Open Location'; $lang['error_nomatch'] = 'No match'; $lang['error_outsidejail'] = 'Access denied'; + +$lang['empty_files'] = 'No Files'; +$lang['empty_images'] = 'No Images'; diff --git a/lang/nl/lang.php b/lang/nl/lang.php index 6d85d70..095f2b3 100644 --- a/lang/nl/lang.php +++ b/lang/nl/lang.php @@ -12,3 +12,6 @@ $lang['lastmodified'] = 'Laatst gewijzigd'; $lang['openlocation'] = 'Locatie openen'; $lang['error_nomatch'] = 'Niets gevonden'; $lang['error_outsidejail'] = 'Toegang geweigerd'; + +$lang['empty_files'] = 'Geen bestanden'; +$lang['empty_images'] = 'Geen afbeeldingen'; diff --git a/style.css b/style.css index ae378b6..6d6d175 100644 --- a/style.css +++ b/style.css @@ -29,3 +29,20 @@ div.filetools-plugin a.media.mediafile.mf_folder, div.filetools-plugin a.mediafile.mf_folder { background-image: url(../../images/fileicons/svg/folder.svg) !important; } + +/* Muted empty-state message when a listing has no results. */ +div.filetools-plugin .luxtools-empty { + opacity: 0.65; + font-style: italic; + padding: 0.25em 0; +} + +/* Image gallery spacing. */ +div.filetools-gallery { + padding-bottom: 0.5em; +} + +div.filetools-gallery a.media { + display: inline-block; + margin: 0 0.35em 0.35em 0; +} diff --git a/syntax/AbstractSyntax.php b/syntax/AbstractSyntax.php index 2d1e0c6..d3e9c8e 100644 --- a/syntax/AbstractSyntax.php +++ b/syntax/AbstractSyntax.php @@ -238,6 +238,25 @@ abstract class syntax_plugin_luxtools_abstract extends SyntaxPlugin $renderer->cdata('[n/a: ' . $this->getLang($langKey) . ']'); } + /** + * Render a muted empty-state message (used when a listing has no results). + * + * @param \Doku_Renderer $renderer + * @param string $langKey + * @return void + */ + protected function renderEmptyState(\Doku_Renderer $renderer, string $langKey): void + { + $text = (string)$this->getLang($langKey); + + if ($renderer instanceof \Doku_Renderer_xhtml) { + $renderer->doc .= '
' . hsc($text) . '
'; + return; + } + + $renderer->cdata($text); + } + /** * Separate a path into base directory and pattern. * diff --git a/syntax/directory.php b/syntax/directory.php index a448b7f..916f081 100644 --- a/syntax/directory.php +++ b/syntax/directory.php @@ -55,7 +55,7 @@ class syntax_plugin_luxtools_directory extends syntax_plugin_luxtools_abstract ); if ($items == []) { - $this->renderError($renderer, 'error_nomatch'); + $this->renderEmptyState($renderer, 'empty_files'); return true; } diff --git a/syntax/files.php b/syntax/files.php index e9bc104..bf12b2e 100644 --- a/syntax/files.php +++ b/syntax/files.php @@ -42,7 +42,7 @@ class syntax_plugin_luxtools_files extends syntax_plugin_luxtools_abstract ); if ($result == []) { - $this->renderError($renderer, 'error_nomatch'); + $this->renderEmptyState($renderer, 'empty_files'); return true; } diff --git a/syntax/images.php b/syntax/images.php index 02b66f9..5957b68 100644 --- a/syntax/images.php +++ b/syntax/images.php @@ -58,7 +58,7 @@ class syntax_plugin_luxtools_images extends syntax_plugin_luxtools_abstract $items = $this->filterImages($items); if ($items == []) { - $this->renderError($renderer, 'error_nomatch'); + $this->renderEmptyState($renderer, 'empty_images'); return true; }