Admin/Public: simplify admin menu labels and remove comment autofocus

This commit is contained in:
Alexander Andreev 2026-02-21 13:49:55 +03:00
parent def543f813
commit 2ed10f7b63
2 changed files with 8 additions and 13 deletions

View File

@ -143,7 +143,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if ($action === 'update_welcome') {
$text = trim((string)($_POST['welcome_text'] ?? ''));
settingSet('welcome_text', $text);
$message = 'Приветственное сообщение сохранено';
$message = 'Настройки сохранены';
}
if ($action === 'upload_before_bulk') {
@ -794,17 +794,17 @@ function nextUniqueCodeName(string $base): string
<h3>Меню</h3>
<div class="sec">
<a class="<?= $adminMode==='sections'?'active':'' ?>" href="?token=<?= urlencode($tokenIncoming) ?>&mode=sections<?= $activeSectionId>0 ? '&section_id='.(int)$activeSectionId : '' ?>">Разделы</a>
<a class="<?= $adminMode==='photos'?'active':'' ?>" href="?token=<?= urlencode($tokenIncoming) ?>&mode=photos<?= $activeSectionId>0 ? '&section_id='.(int)$activeSectionId : '' ?>">Фото</a>
<a class="<?= $adminMode==='topics'?'active':'' ?>" href="?token=<?= urlencode($tokenIncoming) ?>&mode=topics">Тематики</a>
<a class="<?= $adminMode==='welcome'?'active':'' ?>" href="?token=<?= urlencode($tokenIncoming) ?>&mode=welcome">Приветственное сообщение</a>
<a class="<?= $adminMode==='commenters'?'active':'' ?>" href="?token=<?= urlencode($tokenIncoming) ?>&mode=commenters">Пользователи комментариев</a>
<a class="<?= $adminMode==='photos'?'active':'' ?>" href="?token=<?= urlencode($tokenIncoming) ?>&mode=photos<?= $activeSectionId>0 ? '&section_id='.(int)$activeSectionId : '' ?>">Фото</a>
<a class="<?= $adminMode==='commenters'?'active':'' ?>" href="?token=<?= urlencode($tokenIncoming) ?>&mode=commenters">Пользователи</a>
<a class="<?= $adminMode==='comments'?'active':'' ?>" href="?token=<?= urlencode($tokenIncoming) ?>&mode=comments">Комментарии</a>
<a class="<?= $adminMode==='welcome'?'active':'' ?>" href="?token=<?= urlencode($tokenIncoming) ?>&mode=welcome">Настройки</a>
</div>
</section>
<?php if ($adminMode === 'sections' || $adminMode === 'photos'): ?>
<section class="card">
<h3><?= $adminMode === 'sections' ? 'Разделы' : 'Выбор раздела для фото' ?></h3>
<h3>Разделы</h3>
<div class="sec">
<?php foreach($sections as $s): ?>
<a class="<?= (int)$s['id']===$activeSectionId?'active':'' ?>" href="?token=<?= urlencode($tokenIncoming) ?>&mode=<?= h($adminMode) ?>&section_id=<?= (int)$s['id'] ?>"><?= h((string)$s['name']) ?> <span class="small">(<?= (int)$s['photos_count'] ?>)</span></a>
@ -834,11 +834,11 @@ function nextUniqueCodeName(string $base): string
<main>
<?php if ($adminMode === 'welcome'): ?>
<section class="card">
<h3>Приветственное сообщение (публичная часть)</h3>
<h3>Настройки</h3>
<form method="post" action="?token=<?= urlencode($tokenIncoming) ?>&mode=welcome">
<input type="hidden" name="action" value="update_welcome"><input type="hidden" name="token" value="<?= h($tokenIncoming) ?>">
<p><textarea class="in" name="welcome_text" rows="5" placeholder="Текст приветствия"><?= h($welcomeText) ?></textarea></p>
<button class="btn" type="submit">Сохранить приветствие</button>
<button class="btn" type="submit">Сохранить настройки</button>
</form>
</section>
<?php endif; ?>

View File

@ -563,7 +563,7 @@ function outputWatermarked(string $path, string $mime): never
<input type="hidden" name="section_id" value="<?= $isSectionMode ? (int)$detailSectionId : 0 ?>">
<input type="hidden" name="topic_id" value="<?= $isTopicMode ? (int)$activeTopicId : 0 ?>">
<input type="hidden" name="viewer" value="<?= h($viewerToken) ?>">
<textarea class="js-comment-textarea comment-input" name="comment_text" required autofocus></textarea>
<textarea class="js-comment-textarea comment-input" name="comment_text" required></textarea>
<p class="comment-actions"><button class="btn" type="submit">Отправить</button></p>
</form>
<?php else: ?>
@ -764,11 +764,6 @@ function outputWatermarked(string $path, string $mime): never
const commentTextarea = document.querySelector('.js-comment-textarea');
const commentForm = commentTextarea ? commentTextarea.closest('.js-comment-form') : null;
if (commentTextarea) {
requestAnimationFrame(() => {
commentTextarea.focus();
commentTextarea.setSelectionRange(commentTextarea.value.length, commentTextarea.value.length);
});
commentTextarea.addEventListener('keydown', (e) => {
if (!e.shiftKey || e.key !== 'Enter' || e.isComposing) {
return;