Files
proton/resources/views/notes/show.php
T
2026-09-12 23:55:44 +03:00

70 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
/**
* Карточка заметки.
*
* @var \App\Models\Note $note
* @var \Rsgrinko\Proton\Models\User|null $author
*/
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')) { ?>
<a class="btn" href="<?= View::e(View::route('notes.edit', ['id' => $note->id()])) ?>">Править</a>
<form method="post" action="<?= View::e(View::route('notes.delete', ['id' => $note->id()])) ?>">
<?= View::csrf() ?>
<button type="submit" class="danger">Удалить</button>
</form>
<?php } ?>
</div>
<div class="grid cols-2" style="margin-top: 16px;">
<div class="card">
<h2>Текст</h2>
<?php if (trim((string) $note->body) === '') { ?>
<p class="muted">Пусто.</p>
<?php } else { ?>
<pre class="break"><?= View::e((string) $note->body) ?></pre>
<?php } ?>
</div>
<div class="card">
<h2>Свойства</h2>
<dl class="props">
<dt>Автор</dt>
<dd><?= View::e($author === null ? '—' : (string) $author->login) ?></dd>
<dt>Адресная часть</dt>
<dd class="mono"><?= View::e((string) $note->raw('slug')) ?></dd>
<dt>Закреплена</dt>
<dd><?= $note->pinned ? 'да' : 'нет' ?></dd>
<dt>Создана</dt>
<dd><?= View::e(View::date((string) $note->raw('created_at'))) ?></dd>
<dt>Изменена</dt>
<dd><?= View::e(View::date((string) $note->raw('updated_at'))) ?></dd>
<dt>Файл</dt>
<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 } else { ?>
—
<?php } ?>
</dd>
</dl>
</div>
</div>
<p><a href="<?= View::e(View::route('notes.index')) ?>">← ко всем заметкам</a></p>