feat(journal): превью вложений и навигация по лайтбоксу в карточке отчёта
This commit is contained in:
+43
-1
@@ -1174,7 +1174,8 @@ body.report-card-open .report-fields{display:flex}
|
|||||||
border-radius:14px;
|
border-radius:14px;
|
||||||
box-shadow:0 18px 40px rgba(0,0,0,.2);
|
box-shadow:0 18px 40px rgba(0,0,0,.2);
|
||||||
padding:14px 16px;
|
padding:14px 16px;
|
||||||
overflow:hidden;
|
max-height:calc(100vh - 140px);
|
||||||
|
overflow:hidden auto;
|
||||||
}
|
}
|
||||||
.report-fields:hover .report-fields__panel,
|
.report-fields:hover .report-fields__panel,
|
||||||
.report-fields.open .report-fields__panel{display:block}
|
.report-fields.open .report-fields__panel{display:block}
|
||||||
@@ -1197,9 +1198,50 @@ body.report-card-open .report-fields{display:flex}
|
|||||||
.report-fields__item:hover{background:var(--bg)}
|
.report-fields__item:hover{background:var(--bg)}
|
||||||
.report-fields__item input{width:16px;height:16px;accent-color:var(--accent);cursor:pointer;flex:none;margin:0}
|
.report-fields__item input{width:16px;height:16px;accent-color:var(--accent);cursor:pointer;flex:none;margin:0}
|
||||||
.report-fields__item span{overflow:hidden;text-overflow:ellipsis}
|
.report-fields__item span{overflow:hidden;text-overflow:ellipsis}
|
||||||
|
.report-fields__row{margin-top:10px;padding-top:10px;border-top:1px solid var(--border)}
|
||||||
|
.report-fields__toggle{position:relative;display:flex;align-items:center;gap:10px;cursor:pointer;user-select:none;font-size:.85rem;font-weight:600;padding:6px 8px;border-radius:8px}
|
||||||
|
.report-fields__toggle:hover{background:var(--bg)}
|
||||||
|
.report-fields__toggle input{position:absolute;width:1px;height:1px;opacity:0;margin:0}
|
||||||
|
.report-fields__track{position:relative;flex:none;width:34px;height:19px;border-radius:999px;background:var(--border);transition:background .18s ease}
|
||||||
|
.report-fields__track::after{content:'';position:absolute;top:2px;left:2px;width:15px;height:15px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.28);transition:transform .18s ease}
|
||||||
|
.report-fields__toggle input:checked + .report-fields__track{background:var(--accent)}
|
||||||
|
.report-fields__toggle input:checked + .report-fields__track::after{transform:translateX(15px)}
|
||||||
|
.report-fields__toggle input:focus-visible + .report-fields__track{outline:2px solid var(--accent);outline-offset:2px}
|
||||||
|
.report-fields__toggle-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||||
|
.report-fields__hint{margin:4px 0 0;padding:0 8px;font-size:.72rem;line-height:1.35;color:var(--muted)}
|
||||||
|
|
||||||
|
/* --- Галерея вложений в карточке отчёта (журнал) --- */
|
||||||
|
.student-card__gallery-grid{columns:118px 3;column-gap:10px}
|
||||||
|
.sc-gal__shot{position:relative;display:block;width:100%;padding:0;margin:0 0 10px;border:1px solid var(--sc-border);border-radius:12px;overflow:hidden;background:var(--sc-primary-soft);aspect-ratio:4/3;cursor:zoom-in;break-inside:avoid;-webkit-column-break-inside:avoid;transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease;-webkit-tap-highlight-color:transparent}
|
||||||
|
.sc-gal__shot.is-ready{aspect-ratio:auto}
|
||||||
|
.sc-gal__shot:hover{transform:translateY(-3px);border-color:#BCD6FA;box-shadow:0 10px 22px rgba(23,59,120,.18)}
|
||||||
|
.sc-gal__shot:active{transform:translateY(-1px)}
|
||||||
|
.sc-gal__img{position:relative;z-index:1;display:block;width:100%;height:auto;max-height:min(340px,52vh);object-fit:contain;opacity:0;transition:opacity .28s ease}
|
||||||
|
.sc-gal__img.is-loaded{opacity:1}
|
||||||
|
.sc-gal__img.is-error{opacity:0}
|
||||||
|
.sc-gal__spin{position:absolute;inset:0;z-index:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:.6rem}
|
||||||
|
.sc-gal__spin::before{content:'';position:absolute;inset:0;background:linear-gradient(100deg,transparent 20%,rgba(52,120,246,.13) 50%,transparent 80%);background-size:220% 100%;animation:imgShimmer 1.4s ease-in-out infinite}
|
||||||
|
.sc-gal__spin::after{content:'';position:relative;width:20px;height:20px;border-radius:50%;border:2px solid var(--border);border-top-color:var(--sc-primary);animation:spin .7s linear infinite}
|
||||||
|
.sc-gal__img.is-loaded ~ .sc-gal__spin{display:none}
|
||||||
|
.sc-gal__shot.is-error .sc-gal__spin::before{animation:none;background:none}
|
||||||
|
.sc-gal__shot.is-error .sc-gal__spin::after{display:none}
|
||||||
|
.sc-gal__zoom{position:absolute;right:6px;bottom:6px;z-index:2;display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:8px;background:rgba(23,59,120,.86);color:#fff;opacity:0;transform:translateY(4px);transition:opacity .2s ease,transform .2s ease}
|
||||||
|
.sc-gal__zoom svg{width:14px;height:14px}
|
||||||
|
.sc-gal__shot:hover .sc-gal__zoom,.sc-gal__shot:focus-visible .sc-gal__zoom{opacity:1;transform:translateY(0)}
|
||||||
|
@media(prefers-reduced-motion:reduce){.sc-gal__spin::before,.sc-gal__spin::after{animation:none}.sc-gal__shot{transition:none}}
|
||||||
|
|
||||||
|
/* --- Навигация лайтбокса карточки отчёта --- */
|
||||||
|
.img-modal-nav{position:absolute;left:50%;bottom:22px;transform:translateX(-50%);display:flex;align-items:center;gap:14px;padding:7px 12px;border-radius:999px;background:rgba(23,59,120,.82);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);box-shadow:0 8px 24px rgba(0,0,0,.3)}
|
||||||
|
.img-modal-nav[hidden]{display:none}
|
||||||
|
.img-modal-arrow{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:50%;background:rgba(255,255,255,.16);color:#fff;cursor:pointer;transition:background .16s ease,transform .16s ease}
|
||||||
|
.img-modal-arrow svg{width:16px;height:16px}
|
||||||
|
.img-modal-arrow:hover{background:rgba(255,255,255,.32);transform:scale(1.06)}
|
||||||
|
.img-modal-count{min-width:52px;color:#fff;font-size:.8rem;font-weight:700;text-align:center;font-variant-numeric:tabular-nums;user-select:none}
|
||||||
@media(max-width:640px){
|
@media(max-width:640px){
|
||||||
.report-fields{right:16px;bottom:16px}
|
.report-fields{right:16px;bottom:16px}
|
||||||
.report-fields__btn{padding:10px 14px}
|
.report-fields__btn{padding:10px 14px}
|
||||||
|
.student-card__gallery-grid{columns:104px 2;column-gap:8px}
|
||||||
|
.sc-gal__shot{margin-bottom:8px}
|
||||||
}
|
}
|
||||||
.journal-card .foot .edit svg,.journal-card .foot .del svg,.card .edit svg,.card .del svg{width:16px;height:16px;display:block}
|
.journal-card .foot .edit svg,.journal-card .foot .del svg,.card .edit svg,.card .del svg{width:16px;height:16px;display:block}
|
||||||
@media(max-width:420px){
|
@media(max-width:420px){
|
||||||
|
|||||||
@@ -78,6 +78,11 @@
|
|||||||
|
|
||||||
<div class="modal-overlay" id="imgModal">
|
<div class="modal-overlay" id="imgModal">
|
||||||
<img id="imgModalSrc">
|
<img id="imgModalSrc">
|
||||||
|
<div class="img-modal-nav" id="imgModalNav" hidden>
|
||||||
|
<button type="button" class="img-modal-arrow" id="imgModalPrev" title="Предыдущая картинка" aria-label="Предыдущая картинка"><i data-lucide="chevron-left"></i></button>
|
||||||
|
<span class="img-modal-count" id="imgModalCount"></span>
|
||||||
|
<button type="button" class="img-modal-arrow" id="imgModalNext" title="Следующая картинка" aria-label="Следующая картинка"><i data-lucide="chevron-right"></i></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-overlay" id="videoModal">
|
<div class="modal-overlay" id="videoModal">
|
||||||
@@ -366,6 +371,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="report-fields__list" id="reportFieldsList"></div>
|
<div class="report-fields__list" id="reportFieldsList"></div>
|
||||||
|
<div class="report-fields__row">
|
||||||
|
<label class="report-fields__toggle">
|
||||||
|
<input type="checkbox" id="reportEmbedToggle">
|
||||||
|
<span class="report-fields__track" aria-hidden="true"></span>
|
||||||
|
<span class="report-fields__toggle-label">Встроить картинки</span>
|
||||||
|
</label>
|
||||||
|
<p class="report-fields__hint" id="reportEmbedHint">Показывать превью картинок из вложений прямо в карточке</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
+161
-5
@@ -65,7 +65,36 @@ const REPORT_CARD_FIELDS = [
|
|||||||
];
|
];
|
||||||
const REPORT_CARD_FIELDS_KEY = 'reportCardFields';
|
const REPORT_CARD_FIELDS_KEY = 'reportCardFields';
|
||||||
const reportCardFields = loadReportCardFields();
|
const reportCardFields = loadReportCardFields();
|
||||||
|
const REPORT_CARD_EMBED_KEY = 'reportCardEmbedImages';
|
||||||
|
let reportCardEmbed = loadReportCardEmbed();
|
||||||
let reportCardEntryId = null;
|
let reportCardEntryId = null;
|
||||||
|
let galleryList = [];
|
||||||
|
let galleryIndex = -1;
|
||||||
|
|
||||||
|
function loadReportCardEmbed() {
|
||||||
|
try {
|
||||||
|
return localStorage.getItem(REPORT_CARD_EMBED_KEY) === '1';
|
||||||
|
} catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveReportCardEmbed() {
|
||||||
|
try {
|
||||||
|
localStorage.setItem(REPORT_CARD_EMBED_KEY, reportCardEmbed ? '1' : '0');
|
||||||
|
} catch (err) {
|
||||||
|
showToast('Не удалось сохранить настройку галереи', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isEmbeddableImage(name) {
|
||||||
|
return /\.(jpe?g|jfif|png|gif|webp|bmp|avif)$/i.test(name || '');
|
||||||
|
}
|
||||||
|
|
||||||
|
function reportCardImages(e) {
|
||||||
|
if (!reportCardEmbed || !e.files) return [];
|
||||||
|
return e.files.filter(f => isEmbeddableImage(f.name));
|
||||||
|
}
|
||||||
|
|
||||||
function loadReportCardFields() {
|
function loadReportCardFields() {
|
||||||
const all = REPORT_CARD_FIELDS.map(f => f.key);
|
const all = REPORT_CARD_FIELDS.map(f => f.key);
|
||||||
@@ -98,22 +127,58 @@ function splitStudentName(full) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reportCardFilesHTML(e) {
|
function reportCardFilesHTML(e) {
|
||||||
if (!e.files || !e.files.length) return '';
|
const files = (e.files || []).filter(f => !(reportCardEmbed && isEmbeddableImage(f.name)));
|
||||||
return `<div class="student-card__meta-files">${e.files.map(f => {
|
if (!files.length) return '';
|
||||||
|
return `<div class="student-card__meta-files">${files.map(f => {
|
||||||
const url = `${API}/api/files/${f.token}`;
|
const url = `${API}/api/files/${f.token}`;
|
||||||
if (isImageFile(f.name)) return `<a href="#" data-img="${esc(thumbSrc(url))}" title="Открыть">${esc(f.name)}</a>`;
|
if (isImageFile(f.name)) return `<a href="#" data-img="${url}" title="Открыть">${esc(f.name)}</a>`;
|
||||||
if (isPlayableVideoFile(f.name)) return `<a href="${url}?play=1" data-video="${url}?play=1" data-video-name="${esc(f.name)}" data-video-token="${f.token}" title="Смотреть">${esc(f.name)}</a>`;
|
if (isPlayableVideoFile(f.name)) return `<a href="${url}?play=1" data-video="${url}?play=1" data-video-name="${esc(f.name)}" data-video-token="${f.token}" title="Смотреть">${esc(f.name)}</a>`;
|
||||||
const note = isVideoFile(f.name) ? 'Скачать (браузер не умеет играть этот формат)' : 'Скачать';
|
const note = isVideoFile(f.name) ? 'Скачать (браузер не умеет играть этот формат)' : 'Скачать';
|
||||||
return `<a href="${url}" download title="${note}">${esc(f.name)}</a>`;
|
return `<a href="${url}" download title="${note}">${esc(f.name)}</a>`;
|
||||||
}).join('')}</div>`;
|
}).join('')}</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reportCardGalleryHTML(e) {
|
||||||
|
const imgs = reportCardImages(e);
|
||||||
|
if (!imgs.length) return '';
|
||||||
|
return `<div class="student-card__gallery-grid">${imgs.map((f, i) => {
|
||||||
|
const url = `${API}/api/files/${f.token}`;
|
||||||
|
return `<button type="button" class="sc-gal__shot" data-img="${url}" data-gal-index="${i}" title="${esc(f.name)}" aria-label="${esc(f.name)}">
|
||||||
|
<img class="sc-gal__img" src="${thumbSrc(url)}" alt="${esc(f.name)}" loading="lazy" decoding="async">
|
||||||
|
<span class="sc-gal__spin" aria-hidden="true"></span>
|
||||||
|
<span class="sc-gal__zoom" aria-hidden="true"><i data-lucide="maximize-2"></i></span>
|
||||||
|
</button>`;
|
||||||
|
}).join('')}</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function settleReportGallery(root) {
|
||||||
|
if (!root) return;
|
||||||
|
root.querySelectorAll('.sc-gal__img').forEach(img => {
|
||||||
|
const shot = img.closest('.sc-gal__shot');
|
||||||
|
const ready = () => {
|
||||||
|
img.classList.add('is-loaded');
|
||||||
|
if (shot) shot.classList.add('is-ready');
|
||||||
|
};
|
||||||
|
const failed = () => {
|
||||||
|
img.classList.add('is-error');
|
||||||
|
if (shot) shot.classList.add('is-error');
|
||||||
|
};
|
||||||
|
if (img.complete) {
|
||||||
|
if (img.naturalWidth > 0) ready(); else failed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
img.addEventListener('load', ready, { once: true });
|
||||||
|
img.addEventListener('error', failed, { once: true });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function reportCardMetaHTML(e) {
|
function reportCardMetaHTML(e) {
|
||||||
let html = '';
|
let html = '';
|
||||||
if (reportCardFieldOn('date') && e.created_at) {
|
if (reportCardFieldOn('date') && e.created_at) {
|
||||||
html += `<div class="student-card__meta-val">${esc(fmtFull(e.created_at))}</div>`;
|
html += `<div class="student-card__meta-val">${esc(fmtFull(e.created_at))}</div>`;
|
||||||
}
|
}
|
||||||
if (reportCardFieldOn('files')) html += reportCardFilesHTML(e);
|
if (reportCardFieldOn('files')) html += reportCardFilesHTML(e);
|
||||||
|
html += reportCardGalleryHTML(e);
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +225,11 @@ function renderReportCard(e) {
|
|||||||
document.getElementById('reportCardModule').textContent = tool;
|
document.getElementById('reportCardModule').textContent = tool;
|
||||||
document.getElementById('reportCardModuleIcon').textContent = moduleIconText(tool);
|
document.getElementById('reportCardModuleIcon').textContent = moduleIconText(tool);
|
||||||
toolBadge.hidden = !reportCardFieldOn('module') || !tool;
|
toolBadge.hidden = !reportCardFieldOn('module') || !tool;
|
||||||
document.getElementById('reportCardMeta').innerHTML = reportCardMetaHTML(e);
|
const meta = document.getElementById('reportCardMeta');
|
||||||
|
meta.innerHTML = reportCardMetaHTML(e);
|
||||||
|
galleryList = reportCardImages(e).map(f => `${API}/api/files/${f.token}`);
|
||||||
|
settleReportGallery(meta);
|
||||||
|
renderIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshReportCard() {
|
function refreshReportCard() {
|
||||||
@@ -180,6 +249,9 @@ function openReportCard(id) {
|
|||||||
|
|
||||||
function closeReportCard() {
|
function closeReportCard() {
|
||||||
reportCardEntryId = null;
|
reportCardEntryId = null;
|
||||||
|
galleryList = [];
|
||||||
|
galleryIndex = -1;
|
||||||
|
closeImgModal();
|
||||||
document.getElementById('reportCardModal').classList.remove('open');
|
document.getElementById('reportCardModal').classList.remove('open');
|
||||||
document.body.classList.remove('report-card-open');
|
document.body.classList.remove('report-card-open');
|
||||||
setReportFieldsOpen(false);
|
setReportFieldsOpen(false);
|
||||||
@@ -1796,12 +1868,74 @@ async function createLink() {
|
|||||||
|
|
||||||
function copyLink() { copyText(createdLinkUrl); }
|
function copyLink() { copyText(createdLinkUrl); }
|
||||||
|
|
||||||
document.getElementById('imgModal').addEventListener('click', e => e.currentTarget.classList.remove('open'));
|
function closeImgModal() {
|
||||||
|
const m = document.getElementById('imgModal');
|
||||||
|
if (!m) return;
|
||||||
|
m.classList.remove('open');
|
||||||
|
document.getElementById('imgModalSrc').removeAttribute('src');
|
||||||
|
galleryIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncImgModalNav() {
|
||||||
|
const nav = document.getElementById('imgModalNav');
|
||||||
|
const count = document.getElementById('imgModalCount');
|
||||||
|
if (!nav || !count) return;
|
||||||
|
const multi = galleryList.length > 1 && galleryIndex >= 0;
|
||||||
|
nav.hidden = !multi;
|
||||||
|
if (multi) count.textContent = `${galleryIndex + 1} / ${galleryList.length}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function showGalleryImage(i) {
|
||||||
|
if (!galleryList.length) return;
|
||||||
|
const n = galleryList.length;
|
||||||
|
galleryIndex = ((i % n) + n) % n;
|
||||||
|
showImg(galleryList[galleryIndex]);
|
||||||
|
syncImgModalNav();
|
||||||
|
}
|
||||||
|
|
||||||
|
function bindReportGalleryLightbox() {
|
||||||
|
const modal = document.getElementById('imgModal');
|
||||||
|
const prev = document.getElementById('imgModalPrev');
|
||||||
|
const next = document.getElementById('imgModalNext');
|
||||||
|
const card = document.getElementById('reportCardModal');
|
||||||
|
if (prev) prev.addEventListener('click', e => { e.stopPropagation(); showGalleryImage(galleryIndex - 1); });
|
||||||
|
if (next) next.addEventListener('click', e => { e.stopPropagation(); showGalleryImage(galleryIndex + 1); });
|
||||||
|
if (modal) {
|
||||||
|
modal.addEventListener('click', e => {
|
||||||
|
if (e.target.closest('.img-modal-nav')) return;
|
||||||
|
closeImgModal();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!card) return;
|
||||||
|
card.addEventListener('click', e => {
|
||||||
|
const shot = e.target.closest('[data-gal-index]');
|
||||||
|
if (!shot) return;
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
showGalleryImage(parseInt(shot.dataset.galIndex, 10));
|
||||||
|
});
|
||||||
|
card.addEventListener('wheel', e => {
|
||||||
|
if (Math.abs(e.deltaX) <= Math.abs(e.deltaY) || galleryList.length < 2) return;
|
||||||
|
e.preventDefault();
|
||||||
|
showGalleryImage(galleryIndex + (e.deltaX > 0 ? 1 : -1));
|
||||||
|
}, { passive: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
bindReportGalleryLightbox();
|
||||||
|
|
||||||
document.getElementById('editModal').addEventListener('click', e => { if (e.target === e.currentTarget) closeEdit(); });
|
document.getElementById('editModal').addEventListener('click', e => { if (e.target === e.currentTarget) closeEdit(); });
|
||||||
document.getElementById('linkModal').addEventListener('click', e => { if (e.target === e.currentTarget) closeLinkCreate(); });
|
document.getElementById('linkModal').addEventListener('click', e => { if (e.target === e.currentTarget) closeLinkCreate(); });
|
||||||
document.getElementById('reportCardModal').addEventListener('click', e => { if (e.target === e.currentTarget) closeReportCard(); });
|
document.getElementById('reportCardModal').addEventListener('click', e => { if (e.target === e.currentTarget) closeReportCard(); });
|
||||||
document.addEventListener('keydown', e => {
|
document.addEventListener('keydown', e => {
|
||||||
|
if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
|
||||||
|
if (!document.getElementById('imgModal').classList.contains('open')) return;
|
||||||
|
if (galleryList.length < 2 || galleryIndex < 0) return;
|
||||||
|
e.preventDefault();
|
||||||
|
showGalleryImage(galleryIndex + (e.key === 'ArrowRight' ? 1 : -1));
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (e.key !== 'Escape') return;
|
if (e.key !== 'Escape') return;
|
||||||
|
if (document.getElementById('imgModal').classList.contains('open')) { closeImgModal(); return; }
|
||||||
if (document.getElementById('reportFields').classList.contains('open')) { setReportFieldsOpen(false); return; }
|
if (document.getElementById('reportFields').classList.contains('open')) { setReportFieldsOpen(false); return; }
|
||||||
if (document.getElementById('reportCardModal').classList.contains('open')) closeReportCard();
|
if (document.getElementById('reportCardModal').classList.contains('open')) closeReportCard();
|
||||||
});
|
});
|
||||||
@@ -1811,6 +1945,7 @@ function setReportCardFields(keys) {
|
|||||||
REPORT_CARD_FIELDS.map(f => f.key).filter(k => keys.includes(k)).forEach(k => reportCardFields.push(k));
|
REPORT_CARD_FIELDS.map(f => f.key).filter(k => keys.includes(k)).forEach(k => reportCardFields.push(k));
|
||||||
saveReportCardFields();
|
saveReportCardFields();
|
||||||
renderReportFieldsList();
|
renderReportFieldsList();
|
||||||
|
renderReportEmbedToggle();
|
||||||
refreshReportCard();
|
refreshReportCard();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1827,6 +1962,26 @@ function renderReportFieldsList() {
|
|||||||
const reportFieldsRoot = document.getElementById('reportFields');
|
const reportFieldsRoot = document.getElementById('reportFields');
|
||||||
const reportFieldsBtn = document.getElementById('reportFieldsBtn');
|
const reportFieldsBtn = document.getElementById('reportFieldsBtn');
|
||||||
const reportFieldsPanel = document.getElementById('reportFieldsPanel');
|
const reportFieldsPanel = document.getElementById('reportFieldsPanel');
|
||||||
|
const reportEmbedToggle = document.getElementById('reportEmbedToggle');
|
||||||
|
const reportEmbedHint = document.getElementById('reportEmbedHint');
|
||||||
|
const REPORT_EMBED_HINT = 'Показывать превью картинок из вложений прямо в карточке';
|
||||||
|
|
||||||
|
function renderReportEmbedToggle() {
|
||||||
|
if (!reportEmbedToggle) return;
|
||||||
|
reportEmbedToggle.checked = reportCardEmbed;
|
||||||
|
if (reportEmbedHint) reportEmbedHint.textContent = REPORT_EMBED_HINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setReportCardEmbed(on) {
|
||||||
|
reportCardEmbed = !!on;
|
||||||
|
saveReportCardEmbed();
|
||||||
|
renderReportEmbedToggle();
|
||||||
|
refreshReportCard();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reportEmbedToggle) {
|
||||||
|
reportEmbedToggle.addEventListener('change', e => setReportCardEmbed(e.target.checked));
|
||||||
|
}
|
||||||
|
|
||||||
function setReportFieldsOpen(open) {
|
function setReportFieldsOpen(open) {
|
||||||
reportFieldsRoot.classList.toggle('open', open);
|
reportFieldsRoot.classList.toggle('open', open);
|
||||||
@@ -1834,6 +1989,7 @@ function setReportFieldsOpen(open) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderReportFieldsList();
|
renderReportFieldsList();
|
||||||
|
renderReportEmbedToggle();
|
||||||
reportFieldsBtn.addEventListener('click', () => setReportFieldsOpen(!reportFieldsRoot.classList.contains('open')));
|
reportFieldsBtn.addEventListener('click', () => setReportFieldsOpen(!reportFieldsRoot.classList.contains('open')));
|
||||||
reportFieldsPanel.addEventListener('change', e => {
|
reportFieldsPanel.addEventListener('change', e => {
|
||||||
const cb = e.target.closest('[data-report-field]');
|
const cb = e.target.closest('[data-report-field]');
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 118 KiB |
Reference in New Issue
Block a user