Правила доступа на запись и подписанные ссылки

This commit is contained in:
rsgrinko committed 2026-09-15 22:25:58 +03:00
1 parent 9508c29964
commit 3a04ee5bb3
14 files changed
+638 -10

No files matched your search

+6 -4
View File
@@ -31,10 +31,12 @@ $action = $isNew
<textarea name="body"><?= View::e((string) $note->body) ?></textarea>
</label>
<label class="inline" style="margin-bottom: 12px;">
<input type="checkbox" name="pinned" value="1" <?= $note->pinned ? 'checked' : '' ?>>
<span>Закрепить наверху списка</span>
</label>
<?php if (View::can('note.pin', $note)) { ?>
<label class="inline" style="margin-bottom: 12px;">
<input type="checkbox" name="pinned" value="1" <?= $note->pinned ? 'checked' : '' ?>>
<span>Закрепить наверху списка</span>
</label>
<?php } ?>
<label>
<span>Файл<?= $note->hasFile() ? ' (сейчас: ' . View::e((string) $note->raw('file_name')) . ')' : '' ?></span>
+1 -1
View File
@@ -88,7 +88,7 @@ $report = View::takeStash('import');
<td class="hide-sm muted small"><?= View::e($note->excerpt(80)) ?></td>
<td class="hide-sm muted small"><?= View::e(View::ago((string) $note->raw('created_at'))) ?></td>
<td class="right">
<?php if (View::can('notes.manage')) { ?>
<?php if (View::can('note.edit', $note)) { ?>
<a class="btn small" href="<?= View::e(View::route('notes.edit', ['id' => $note->id()])) ?>">Править</a>
<?php } ?>
</td>
+10 -1
View File
@@ -9,15 +9,18 @@ declare(strict_types=1);
* @var \Rsgrinko\Proton\Models\User|null $author
*/
use Rsgrinko\Proton\Support\SignedUrl;
use Rsgrinko\Proton\View\View;
?>
<div class="row">
<h1 style="margin: 0;"><?= View::e((string) $note->title) ?></h1>
<span class="spacer"></span>
<?php if (View::can('notes.manage')) { ?>
<?php if (View::can('note.edit', $note)) { ?>
<a class="btn" href="<?= View::e(View::route('notes.edit', ['id' => $note->id()])) ?>">Править</a>
<?php } ?>
<?php if (View::can('note.delete', $note)) { ?>
<form method="post" action="<?= View::e(View::route('notes.delete', ['id' => $note->id()])) ?>">
<?= View::csrf() ?>
<button type="submit" class="danger">Удалить</button>
@@ -58,6 +61,12 @@ use Rsgrinko\Proton\View\View;
<dd>
<?php if ($note->hasFile()) { ?>
<a href="<?= View::e(View::route('notes.file', ['id' => $note->id()])) ?>"><?= View::e((string) $note->raw('file_name')) ?></a>
<?php $shared = SignedUrl::absolute('notes.file.shared', ['id' => $note->id()], 86400); ?>
<div class="muted small" style="margin-top: 6px;">
Ссылка на сутки, вход по ней не нужен:
<?= View::copy($shared, 'скопировать') ?>
</div>
<?php } else { ?>
—
<?php } ?>