Wiki: Bildrechte-Bestätigung bei Foto-Einreichung (Checkbox + DB + Mod-Badge), SW by-v363
This commit is contained in:
parent
de73c7901e
commit
d603b7bae1
6 changed files with 42 additions and 7 deletions
|
|
@ -172,9 +172,16 @@ window.Page_moderation = (() => {
|
|||
${_esc(f.rasse_name || f.rasse_slug)}
|
||||
</div>
|
||||
<div style="font-size:var(--text-xs);color:var(--c-text-muted);
|
||||
margin-bottom:var(--space-3)">
|
||||
margin-bottom:var(--space-2)">
|
||||
von ${_esc(f.user_name)}
|
||||
</div>
|
||||
<div style="margin-bottom:var(--space-3)">
|
||||
${f.rights_confirmed
|
||||
? `<span style="font-size:10px;font-weight:700;padding:2px 8px;border-radius:20px;
|
||||
background:#dcfce7;color:#166534">✓ Bildrechte bestätigt</span>`
|
||||
: `<span style="font-size:10px;font-weight:700;padding:2px 8px;border-radius:20px;
|
||||
background:#fef9c3;color:#92400e">⚠ Keine Bestätigung</span>`}
|
||||
</div>
|
||||
${f.aktuell_foto ? `
|
||||
<img src="${_esc(f.aktuell_foto)}" alt="Aktuell"
|
||||
style="width:100%;height:80px;object-fit:cover;
|
||||
|
|
|
|||
|
|
@ -847,11 +847,23 @@ window.Page_wiki = (() => {
|
|||
<div id="wiki-foto-preview" style="margin-top:var(--space-3);display:none">
|
||||
<img id="wiki-foto-preview-img" style="max-width:100%;max-height:200px;border-radius:var(--radius-md);object-fit:contain">
|
||||
</div>
|
||||
<div style="margin-top:var(--space-4);padding:var(--space-3);
|
||||
background:var(--c-surface-2);border-radius:var(--radius-md);
|
||||
border-left:3px solid var(--c-warning)">
|
||||
<label style="display:flex;gap:var(--space-3);align-items:flex-start;cursor:pointer">
|
||||
<input type="checkbox" id="wiki-foto-rights" style="margin-top:3px;flex-shrink:0">
|
||||
<span style="font-size:var(--text-sm);line-height:1.5">
|
||||
Ich bestätige, dass ich die <strong>uneingeschränkten Bildrechte</strong> an diesem Foto besitze
|
||||
und banyaro.app das dauerhaft gültige, kostenlose Recht einräume, es zu veröffentlichen und zu
|
||||
verwenden. Fotos aus dem Internet oder von Dritten dürfen nicht eingereicht werden.
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</form>
|
||||
`;
|
||||
const footer = `
|
||||
<button type="button" class="btn btn-secondary flex-1" id="wiki-foto-cancel">Abbrechen</button>
|
||||
<button type="submit" form="wiki-foto-form" class="btn btn-primary flex-1" id="wiki-foto-submit">
|
||||
<button type="submit" form="wiki-foto-form" class="btn btn-primary flex-1" id="wiki-foto-submit" disabled>
|
||||
${UI.icon('paper-plane-tilt')} Einreichen
|
||||
</button>
|
||||
`;
|
||||
|
|
@ -859,6 +871,10 @@ window.Page_wiki = (() => {
|
|||
UI.modal.open({ title: 'Foto vorschlagen', body, footer });
|
||||
document.getElementById('wiki-foto-cancel')?.addEventListener('click', UI.modal.close);
|
||||
|
||||
document.getElementById('wiki-foto-rights')?.addEventListener('change', e => {
|
||||
document.getElementById('wiki-foto-submit').disabled = !e.target.checked;
|
||||
});
|
||||
|
||||
document.getElementById('wiki-foto-input')?.addEventListener('change', e => {
|
||||
const file = e.target.files?.[0];
|
||||
if (!file) return;
|
||||
|
|
@ -874,6 +890,10 @@ window.Page_wiki = (() => {
|
|||
const input = document.getElementById('wiki-foto-input');
|
||||
const file = input?.files?.[0];
|
||||
if (!file) return;
|
||||
if (!document.getElementById('wiki-foto-rights')?.checked) {
|
||||
UI.toast('Bitte Bildrechte bestätigen.', 'danger');
|
||||
return;
|
||||
}
|
||||
|
||||
const btn = document.getElementById('wiki-foto-submit');
|
||||
btn.disabled = true;
|
||||
|
|
@ -882,6 +902,7 @@ window.Page_wiki = (() => {
|
|||
try {
|
||||
const fd = new FormData();
|
||||
fd.append('file', file);
|
||||
fd.append('rights_confirmed', '1');
|
||||
const token = localStorage.getItem('by_token');
|
||||
const resp = await fetch(`/api/wiki/rassen/${encodeURIComponent(slug)}/foto`, {
|
||||
method: 'POST',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue