fix(chat): просмотр фото вложений в модалке, доступ тьюторов к уведомлениям
- изображения во вложениях чата открываются в общей модалке #imgModal (data-img + общий обработчик в admin.js) вместо новой вкладки - Escape и клик по фону закрывают модалку изображения - .chat-side[hidden] скрывается — раньше правило display:none его не покрывало - страница уведомлений открывается любому авторизованному пользователю (checkAuth вместо requireAdminPage), пункт меню виден всем
This commit is contained in:
+9
-2
@@ -93,7 +93,7 @@ function chatFilesHtml(files) {
|
||||
if (!files || !files.length) return '';
|
||||
return `<div class="msg-files">${files.map(f => {
|
||||
if (CHAT_IMAGE_EXT.test(f.name || '')) {
|
||||
return `<a class="msg-file msg-file-img" href="${chatFileUrl(f)}" target="_blank" rel="noopener">
|
||||
return `<a class="msg-file msg-file-img" href="${chatFileUrl(f)}" data-img="${esc(chatFileUrl(f))}" title="Открыть">
|
||||
<img src="${chatFileThumbUrl(f)}" alt="${esc(f.name)}" loading="lazy">
|
||||
<span class="msg-file-name">${esc(f.name)}</span>
|
||||
</a>`;
|
||||
@@ -428,6 +428,7 @@ function initChatPage() {
|
||||
const newCancel = document.getElementById('chatNewCancel');
|
||||
const newOk = document.getElementById('chatNewOk');
|
||||
const attachBox = document.getElementById('chatAttachList');
|
||||
const imgModal = document.getElementById('imgModal');
|
||||
|
||||
if (list) {
|
||||
list.addEventListener('click', e => {
|
||||
@@ -491,9 +492,15 @@ function initChatPage() {
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.key === 'Escape' && newModal && newModal.classList.contains('open')) newModal.classList.remove('open');
|
||||
if (e.key !== 'Escape') return;
|
||||
if (imgModal && imgModal.classList.contains('open')) { imgModal.classList.remove('open'); return; }
|
||||
if (newModal && newModal.classList.contains('open')) newModal.classList.remove('open');
|
||||
});
|
||||
|
||||
if (imgModal) {
|
||||
imgModal.addEventListener('click', e => e.currentTarget.classList.remove('open'));
|
||||
}
|
||||
|
||||
if (newBtn) newBtn.hidden = !isAdmin();
|
||||
const side = document.getElementById('chatSide');
|
||||
const layout = document.getElementById('chatLayout');
|
||||
|
||||
@@ -88,7 +88,7 @@ document.getElementById('nfMoreBtn').addEventListener('click', () => loadNotifyP
|
||||
document.getElementById('nfReloadBtn').addEventListener('click', () => loadNotifyPage(true));
|
||||
|
||||
(async () => {
|
||||
if (!(await requireAdminPage())) return;
|
||||
if (!(await checkAuth())) return;
|
||||
buildSidebar(document.body.dataset.page);
|
||||
const clearBtn = document.getElementById('nfClearBtn');
|
||||
if (clearBtn) clearBtn.hidden = !isAdmin();
|
||||
|
||||
Reference in New Issue
Block a user