feedback: фото профиля круглым аватаром в строке резидента
- Кнопка фото резидента перенесена в строку поля «Фамилия/Имя» - Фото отображается кружком 34×34 с object-fit:cover вместо растянутого фона - applyResidentPhoto обновляет src img вместо перерисовки innerHTML - Клик открывает фото в imgModal через data-img
This commit is contained in:
+14
-19
@@ -52,14 +52,13 @@
|
||||
.fb-card-info .lesson-group, .fb-card-info .lesson-topic { min-width:0; overflow-wrap:anywhere; }
|
||||
.fb-card-photo { position:relative; width:63px; height:63px; flex:none; }
|
||||
.fb-card-photo img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
|
||||
.settings-field.fb-resident-field { flex-direction:row; align-items:stretch; gap:10px; }
|
||||
.fb-resident-main { flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:8px; }
|
||||
.fb-resident-row { display:flex; align-items:center; min-width:0; }
|
||||
.fb-resident-row .fb-mark-wrap { flex:1 1 auto; min-width:0; display:flex; align-items:center; }
|
||||
.fb-resident-row .fb-mark-wrap input { width:100%; min-width:0; }
|
||||
#fbResidentPhoto { position:relative; flex:none; width:auto; height:auto; aspect-ratio:1 / 1; align-self:stretch; min-height:0; }
|
||||
.fb-top-row { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:12px; margin-bottom:12px; }
|
||||
@media (max-width:700px) { .fb-top-row { grid-template-columns:1fr; gap:8px; } }
|
||||
.fb-top-row .settings-field { display:flex; flex-direction:column; gap:5px; min-width:0; }
|
||||
.fb-top-row .fb-mark-wrap { width:100%; }
|
||||
#fbResidentPhoto[hidden] { display:none; }
|
||||
#fbResidentPhoto img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
|
||||
.fb-resident-photo { width:34px; height:34px; flex:none; border-radius:50%; overflow:hidden; border:1px solid var(--border); background:var(--bg); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
|
||||
.fb-resident-photo img { width:100%; height:100%; object-fit:cover; display:block; }
|
||||
#fbPromptModal { overflow:auto; align-items:flex-start; padding:4vh 16px; }
|
||||
#fbPromptModal > .edit-modal { margin:auto; }
|
||||
.feedback-item { position:relative; }
|
||||
@@ -139,7 +138,7 @@
|
||||
</div>
|
||||
<form id="fbForm" class="settings-stack" autocomplete="off">
|
||||
<input type="hidden" id="fbId">
|
||||
<div class="settings-stack-grid">
|
||||
<div class="fb-top-row">
|
||||
<div class="settings-field">
|
||||
<label>Дата занятия <span style="color:#ef4444">*</span></label>
|
||||
<input type="date" id="fbDate" class="settings-input" required>
|
||||
@@ -148,20 +147,16 @@
|
||||
<label>Группа <span style="color:#ef4444">*</span></label>
|
||||
<select id="fbGroup" class="settings-input" required></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-stack-grid">
|
||||
<div class="settings-field fb-resident-field">
|
||||
<div class="fb-resident-main">
|
||||
<label>Фамилия/Имя резидента <span style="color:#ef4444">*</span></label>
|
||||
<div class="fb-resident-row">
|
||||
<div class="fb-mark-wrap">
|
||||
<input type="text" id="fbResident" class="settings-input" required maxlength="200" placeholder="Иванов Иван" list="fbResidentList" autocomplete="off">
|
||||
</div>
|
||||
<label>Фамилия/Имя резидента <span style="color:#ef4444">*</span></label>
|
||||
<div class="fb-resident-input-wrap" style="display:flex;align-items:center;gap:8px;">
|
||||
<div class="fb-mark-wrap" style="flex:1;">
|
||||
<input type="text" id="fbResident" class="settings-input" required maxlength="200" placeholder="Иванов Иван" list="fbResidentList" autocomplete="off">
|
||||
</div>
|
||||
<datalist id="fbResidentList"></datalist>
|
||||
<div class="fb-att-info" id="fbResidentAtt" hidden></div>
|
||||
<button type="button" id="fbResidentPhoto" class="fb-resident-photo" hidden title="Увеличить фото"><span class="fb-mark-stripe" id="fbMarkStripe" hidden></span><img src="" alt="" loading="lazy"></button>
|
||||
</div>
|
||||
<button type="button" class="student-avatar fb-resident-photo" id="fbResidentPhoto" hidden title="Увеличить фото"><span class="fb-mark-stripe" id="fbMarkStripe" hidden></span></button>
|
||||
<datalist id="fbResidentList"></datalist>
|
||||
<div class="fb-att-info" id="fbResidentAtt" hidden></div>
|
||||
</div>
|
||||
<div class="settings-field">
|
||||
<label>Тема занятия</label>
|
||||
|
||||
@@ -600,20 +600,19 @@
|
||||
if (!el) return;
|
||||
const k = normName(document.getElementById('fbResident').value);
|
||||
const p = k ? studentPhotos.get(k) : '';
|
||||
const img = el.querySelector('img');
|
||||
if (!p) {
|
||||
el.hidden = true;
|
||||
el.removeAttribute('data-img');
|
||||
delete el.dataset.photoPath;
|
||||
el.innerHTML = fbPhotoStripeHtml();
|
||||
if (img) img.src = '';
|
||||
return;
|
||||
}
|
||||
if (el.dataset.photoPath !== p) {
|
||||
el.dataset.photoPath = p;
|
||||
el.dataset.img = fbPhotoFull(p);
|
||||
el.title = 'Увеличить фото';
|
||||
el.innerHTML = `${fbPhotoStripeHtml()}<img src="${escapeHtml(fbStudentThumb(p))}" alt="" loading="lazy">`;
|
||||
const img = el.querySelector('img');
|
||||
if (img) img.addEventListener('error', () => { el.hidden = true; el.removeAttribute('data-img'); delete el.dataset.photoPath; el.innerHTML = fbPhotoStripeHtml(); }, { once: true });
|
||||
if (img) img.src = fbStudentThumb(p);
|
||||
}
|
||||
el.hidden = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user