From 2d6e1a500412b75ba58b5b591894e279d4308139 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Thu, 28 Dec 2023 00:22:05 +0100 Subject: [PATCH] minor UX tweaks - page stats in editor - trim filename when renaming --- app/class/Modelmedia.php | 6 +- app/fn/fn.php | 2 +- app/view/templates/editrightbar.php | 115 ++++++++++++++++------------ app/view/templates/media.php | 4 +- assets/css/media.css | 6 ++ 5 files changed, 82 insertions(+), 51 deletions(-) diff --git a/app/class/Modelmedia.php b/app/class/Modelmedia.php index 70681115..8d83ef77 100644 --- a/app/class/Modelmedia.php +++ b/app/class/Modelmedia.php @@ -389,10 +389,14 @@ public function multimovefile(array $filedirlist, string $dir): bool */ public function rename(string $oldname, string $newname) { - if (empty(basename($newname))) { + $newbasename = trim(basename($newname)); + $newdirname = dirname($newname); + if (empty($newbasename)) { throw new Fileexception("new name of file cannot be empty"); } + $newname = "$newdirname/$newbasename"; + Fs::accessfile($oldname); Fs::accessfile($newname); diff --git a/app/fn/fn.php b/app/fn/fn.php index 9500a0e4..5ffe5092 100644 --- a/app/fn/fn.php +++ b/app/fn/fn.php @@ -2,7 +2,7 @@ function readablesize($bytes, $base = 2 ** 10) { - $format = ' %d %s'; + $format = '%d %s'; if ($base === 2 ** 10) { $i = 'i'; diff --git a/app/view/templates/editrightbar.php b/app/view/templates/editrightbar.php index 2c9f8319..6c77435c 100644 --- a/app/view/templates/editrightbar.php +++ b/app/view/templates/editrightbar.php @@ -12,70 +12,69 @@ class="toggle"
-
- Last edited - -
+ -
- Tags - $idlist) { - if(count($idlist) > 1) { - ?> - +
+ Tags '; - foreach ($idlist as $id) { - if($id === $page->id()) { - echo '
  • ➤ '.$id.'
  • '; - } else { + foreach ($tagpagelist as $tag => $idlist) { + if(count($idlist) > 1) { ?> -
  • + '; + foreach ($idlist as $id) { + if($id === $page->id()) { + echo '
  • ➤ '.$id.'
  • '; + } else { + ?> +
  • + '; } - } - echo ''; - } - ?> + ?> -
    +
    -
    - Templates -
      - $id) { - if(!empty($id) && !is_bool($id)) { - ?> -
    • :
    • - + Templates +
        + $id) { + if(!empty($id) && !is_bool($id)) { + ?> +
      • :
      • + -
      - -
    + + ?> + + + -

    Authors

    +

    Authors

    - level() >= 4) { foreach ($editorlist as $editor) { @@ -88,6 +87,28 @@ class="toggle" } } ?> + + + +

    Stats

    + + + + + + + + + + + + + + + + +
    edition:editcount() ?>
    display:displaycount() ?>
    visit:visitcount() ?>
    +
    diff --git a/app/view/templates/media.php b/app/view/templates/media.php index f759d8bb..de6dd861 100644 --- a/app/view/templates/media.php +++ b/app/view/templates/media.php @@ -143,10 +143,10 @@ ?> - +
    - filename() ?> + filename() ?>
    diff --git a/assets/css/media.css b/assets/css/media.css index 55adc5cd..b0d3e5b0 100644 --- a/assets/css/media.css +++ b/assets/css/media.css @@ -27,6 +27,11 @@ table#medialist details:hover i { visibility: visible; } +table#medialist td.filename span { + font-family: monospace; + white-space: pre; + font-size: 14px; +} .media ul#gallery { overflow: hidden; @@ -90,3 +95,4 @@ table#medialist details:hover i { } } +