fix: the video dialog marks the products that already have a published video (DTF-WEB-G, DTF-WEB-H)
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 7m20s
Build and deploy / Secret scan and release gate (push) Successful in 10s
Build and deploy / Publish images (push) Successful in 1m40s
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 7m20s
Build and deploy / Secret scan and release gate (push) Successful in 10s
Build and deploy / Publish images (push) Successful in 1m40s
"Onde aparece" names the products another published video holds and closes them while this one is published; turning Publicar on over a taken product stays off and says which video holds it. The server checks before copying any file and its refusal names that video too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -582,18 +582,37 @@ function videoDialog(video){
|
||||
captionsField.append(node('span',video.captions_name?'Legenda':'Legenda · opcional'),
|
||||
dropField(captionsInput,{title:'Escolher legenda',hint:'Arquivo VTT.'}),
|
||||
node('small',video.captions_name||'Nenhuma legenda enviada.'));
|
||||
// A product page shows one floating video: the products another published
|
||||
// video holds are marked, and closed while this one is published (DTF-WEB-G).
|
||||
const taken=new Map(siteVideos.filter(other=>other.id!==video.id&&other.enabled&&other.product)
|
||||
.map(other=>[other.product,other.title]));
|
||||
const product=node('select');
|
||||
for(const [value,label] of SITE_VIDEO_PRODUCTS){
|
||||
const option=node('option',label);option.value=value;product.append(option);
|
||||
const option=node('option',taken.has(value)?label+' · já tem vídeo':label);option.value=value;product.append(option);
|
||||
}
|
||||
product.value=video.product||'';
|
||||
const where=field('Onde aparece',product,'Ou flutuando na página de um produto.');
|
||||
const whereHint=where.querySelector('small');
|
||||
const paintWhere=()=>{
|
||||
for(const option of product.options)option.disabled=published&&taken.has(option.value);
|
||||
if(!taken.has(product.value))where.classList.remove('warn');
|
||||
whereHint.textContent=taken.has(product.value)
|
||||
?'Este produto já tem o vídeo "'+taken.get(product.value)+'" publicado. Tire esse do Site para publicar este aqui.'
|
||||
:'Ou flutuando na página de um produto.';
|
||||
};
|
||||
product.onchange=paintWhere;
|
||||
const sw=node('button',undefined,'sw'+(published?' on':''));
|
||||
sw.type='button';sw.setAttribute('role','switch');sw.setAttribute('aria-checked',String(published));
|
||||
sw.append(node('span',undefined,'t'),'Publicar no Site');
|
||||
sw.onclick=()=>{published=!published;sw.classList.toggle('on',published);sw.setAttribute('aria-checked',String(published));};
|
||||
sw.onclick=()=>{
|
||||
if(!published&&taken.has(product.value)){where.classList.add('warn');product.focus();return;}
|
||||
published=!published;sw.classList.toggle('on',published);sw.setAttribute('aria-checked',String(published));
|
||||
paintWhere();
|
||||
};
|
||||
const situation=node('div',undefined,'fld');situation.append(node('span','Situação'),sw);
|
||||
const row=node('div',undefined,'g2');
|
||||
row.append(field('Onde aparece',product,'Ou flutuando na página de um produto.'),situation);
|
||||
row.append(where,situation);
|
||||
paintWhere();
|
||||
formDialog(video.title,{width:640,className:'siteDialog',
|
||||
text:video.enabled?'Publicado no Site':'Rascunho · ainda não aparece no Site',
|
||||
fields:[videoField,captionsField,row],label:'Salvar vídeo',onsave:async()=>{
|
||||
|
||||
Reference in New Issue
Block a user