Skip to content

Commit

Permalink
minor UX tweaks
Browse files Browse the repository at this point in the history
- page stats in editor
- trim filename when renaming
  • Loading branch information
vincent-peugnet committed Dec 27, 2023
1 parent 73949da commit 2d6e1a5
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 51 deletions.
6 changes: 5 additions & 1 deletion app/class/Modelmedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion app/fn/fn.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

function readablesize($bytes, $base = 2 ** 10)
{
$format = ' %d %s';
$format = '%d %s';

if ($base === 2 ** 10) {
$i = 'i';
Expand Down
115 changes: 68 additions & 47 deletions app/view/templates/editrightbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,70 +12,69 @@ class="toggle"
<div id="rightbarpanel" class="panel">


<details id="lastedited" open>
<summary>Last edited</summary>
<ul>
<?php
foreach ($lasteditedpagelist as $id) {
?>
<li><a href="<?= $this->upage('pageedit', $id) ?>"><?= $id === $page->id() ? '' : '' ?> <?= $id ?></a></li>
<details id="lastedited" open>
<summary>Last edited</summary>
<ul>
<?php
}
foreach ($lasteditedpagelist as $id) {
?>
<li><a href="<?= $this->upage('pageedit', $id) ?>"><?= $id === $page->id() ? '' : '' ?> <?= $id ?></a></li>
<?php
}

?>
</ul>
?>
</ul>

</details>
</details>


<details id="tags" open>
<summary>Tags</summary>
<?php
foreach ($tagpagelist as $tag => $idlist) {
if(count($idlist) > 1) {
?>
<strong><?= $tag ?></strong>
<details id="tags" open>
<summary>Tags</summary>
<?php

echo '<ul>';
foreach ($idlist as $id) {
if($id === $page->id()) {
echo '<li>➤ '.$id.'</li>';
} else {
foreach ($tagpagelist as $tag => $idlist) {
if(count($idlist) > 1) {
?>
<li><a href="<?= $this->upage('pageedit', $id) ?>">✎ <?= $id ?></a></li>
<strong><?= $tag ?></strong>
<?php

echo '<ul>';
foreach ($idlist as $id) {
if($id === $page->id()) {
echo '<li>➤ '.$id.'</li>';
} else {
?>
<li><a href="<?= $this->upage('pageedit', $id) ?>">✎ <?= $id ?></a></li>
<?php
}
}
}
echo '</ul>';
}
}
echo '</ul>';
}

?>
?>

</details>
</details>

<details id="tempaltes" open>
<summary>Templates</summary>
<ul>
<?php
foreach ($templates as $template => $id) {
if(!empty($id) && !is_bool($id)) {
?>
<li><?= $template ?> : <?= $id ?> <a href="<?= $this->upage('pageedit', $id) ?>">✎</a></li>
<?php
<details id="tempaltes" open>
<summary>Templates</summary>
<ul>
<?php
foreach ($templates as $template => $id) {
if(!empty($id) && !is_bool($id)) {
?>
<li><?= $template ?> : <?= $id ?> <a href="<?= $this->upage('pageedit', $id) ?>">✎</a></li>
<?php
}
}
}

?>
</ul>

</details>

?>
</ul>

</details>

<h3>Authors</h3>

<h3>Authors</h3>


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



<h3>Stats</h3>

<table>
<tbody>
<tr>
<td>edition:</td>
<td><?= $page->editcount() ?></td>
</tr>
<tr>
<td>display:</td>
<td><?= $page->displaycount() ?></td>
</tr>
<tr>
<td>visit:</td>
<td><?= $page->visitcount() ?></td>
</tr>
</tbody>
</table>

</div>

</div>
4 changes: 2 additions & 2 deletions app/view/templates/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@
?>
<tr>
<td><input type="checkbox" name="id[]" value="<?= $media->getlocalpath() ?>" form="mediaedit" id="media_<?= $media->filename() ?>"></td>
<td>
<td class="filename">
<details>
<summary>
<?= $media->filename() ?>
<span><?= $media->filename() ?></span>
<i class="fa fa-pencil"></i>
</summary>
<form action="<?= $this->url('mediarename') ?>" method="post">
Expand Down
6 changes: 6 additions & 0 deletions assets/css/media.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -90,3 +95,4 @@ table#medialist details:hover i {
}

}

0 comments on commit 2d6e1a5

Please sign in to comment.