fix: remove UI button section, fix _path→path, show folder in file pickers
This commit is contained in:
@@ -45,7 +45,7 @@ DEFAULT_ACTION: dict = {
|
|||||||
|
|
||||||
|
|
||||||
def _presets_dir(request: Request) -> Path:
|
def _presets_dir(request: Request) -> Path:
|
||||||
base = Path(request.app.state.config_service._path).parent.parent / "data" / "action_presets"
|
base = Path(request.app.state.config_service.path).parent.parent / "data" / "action_presets"
|
||||||
base.mkdir(parents=True, exist_ok=True)
|
base.mkdir(parents=True, exist_ok=True)
|
||||||
return base
|
return base
|
||||||
|
|
||||||
|
|||||||
@@ -227,8 +227,6 @@ function cardHTML(action, idx) {
|
|||||||
const name = esc(action.name || 'Sans nom');
|
const name = esc(action.name || 'Sans nom');
|
||||||
const proc = action.processing || {};
|
const proc = action.processing || {};
|
||||||
const jc = action.jobcontrol || {};
|
const jc = action.jobcontrol || {};
|
||||||
const ui = (action.trigger || {}).ui_trigger || {};
|
|
||||||
|
|
||||||
const chips = [
|
const chips = [
|
||||||
`<span class="ac-chip">⏱ ${jc.countdown_capture ?? '?'}s</span>`,
|
`<span class="ac-chip">⏱ ${jc.countdown_capture ?? '?'}s</span>`,
|
||||||
];
|
];
|
||||||
@@ -242,8 +240,6 @@ function cardHTML(action, idx) {
|
|||||||
chips.push('<span class="ac-chip hl">Remove BG</span>');
|
chips.push('<span class="ac-chip hl">Remove BG</span>');
|
||||||
if (proc.image_filter && proc.image_filter !== 'original')
|
if (proc.image_filter && proc.image_filter !== 'original')
|
||||||
chips.push(`<span class="ac-chip hl">🎨 ${esc(proc.image_filter.split('.').pop())}</span>`);
|
chips.push(`<span class="ac-chip hl">🎨 ${esc(proc.image_filter.split('.').pop())}</span>`);
|
||||||
if (ui.show_button)
|
|
||||||
chips.push(`<span class="ac-chip hl">🔘 ${esc(ui.title || '')}</span>`);
|
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<div class="action-card" draggable="true" data-idx="${idx}" id="ac-${idx}">
|
<div class="action-card" draggable="true" data-idx="${idx}" id="ac-${idx}">
|
||||||
@@ -267,7 +263,6 @@ function cardHTML(action, idx) {
|
|||||||
function editFormHTML(action, idx) {
|
function editFormHTML(action, idx) {
|
||||||
const proc = action.processing || {};
|
const proc = action.processing || {};
|
||||||
const jc = action.jobcontrol || {};
|
const jc = action.jobcontrol || {};
|
||||||
const ui = (action.trigger || {}).ui_trigger || {};
|
|
||||||
|
|
||||||
const frameSel = assetSelect(`ef-frame-sel-${idx}`, proc.img_frame_file || '', assets.frames, '— aucun cadre —', `ef-frame-${idx}`);
|
const frameSel = assetSelect(`ef-frame-sel-${idx}`, proc.img_frame_file || '', assets.frames, '— aucun cadre —', `ef-frame-${idx}`);
|
||||||
const bgSel = assetSelect(`ef-bg-sel-${idx}`, proc.img_background_file || '', assets.backgrounds, '— aucun fond —', `ef-bg-${idx}`);
|
const bgSel = assetSelect(`ef-bg-sel-${idx}`, proc.img_background_file || '', assets.backgrounds, '— aucun fond —', `ef-bg-${idx}`);
|
||||||
@@ -341,30 +336,6 @@ function editFormHTML(action, idx) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="edit-section">
|
|
||||||
<div class="edit-section-title">Interface photobooth (bouton UI)</div>
|
|
||||||
<div class="grid-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label flex items-center gap-1">
|
|
||||||
<input type="checkbox" id="ef-ui-show-${idx}" ${ui.show_button?'checked':''}> Afficher le bouton
|
|
||||||
</label>
|
|
||||||
<label class="form-label mt-1">Titre du bouton</label>
|
|
||||||
<input type="text" class="form-control" id="ef-ui-title-${idx}"
|
|
||||||
value="${esc(ui.title||'')}" placeholder="Photo normal…">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label">Icône (nom Material)</label>
|
|
||||||
<input type="text" class="form-control" id="ef-ui-icon-${idx}"
|
|
||||||
value="${esc(ui.icon||'Photo')}" placeholder="Photo, star_shine, brick…">
|
|
||||||
<label class="form-label mt-1 flex items-center gap-1">
|
|
||||||
<input type="checkbox" id="ef-ui-usecol-${idx}" ${ui.use_custom_color?'checked':''}> Couleur personnalisée
|
|
||||||
</label>
|
|
||||||
<input type="color" class="form-control mt-1" id="ef-ui-color-${idx}"
|
|
||||||
value="${esc(ui.custom_color||'#016911')}" style="height:36px;max-width:80px">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex gap-1">
|
<div class="flex gap-1">
|
||||||
<button class="btn btn-primary btn-sm" onclick="saveAction(${idx})">💾 Sauvegarder</button>
|
<button class="btn btn-primary btn-sm" onclick="saveAction(${idx})">💾 Sauvegarder</button>
|
||||||
<button class="btn btn-ghost btn-sm" onclick="toggleEdit(${idx})">Annuler</button>
|
<button class="btn btn-ghost btn-sm" onclick="toggleEdit(${idx})">Annuler</button>
|
||||||
@@ -373,7 +344,7 @@ function editFormHTML(action, idx) {
|
|||||||
|
|
||||||
function assetSelect(selId, current, options, placeholder, textId) {
|
function assetSelect(selId, current, options, placeholder, textId) {
|
||||||
const opts = options.map(f => {
|
const opts = options.map(f => {
|
||||||
const label = f.split('/').pop();
|
const label = f.replace(/^userdata\//, '');
|
||||||
return `<option value="${esc(f)}" ${f===current?'selected':''}>${esc(label)}</option>`;
|
return `<option value="${esc(f)}" ${f===current?'selected':''}>${esc(label)}</option>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
return `<select class="form-control" id="${selId}"
|
return `<select class="form-control" id="${selId}"
|
||||||
@@ -410,11 +381,6 @@ async function saveAction(idx) {
|
|||||||
fill_background_color: document.getElementById(`ef-fill-color-${idx}`).value,
|
fill_background_color: document.getElementById(`ef-fill-color-${idx}`).value,
|
||||||
remove_background: document.getElementById(`ef-rmbg-${idx}`).checked,
|
remove_background: document.getElementById(`ef-rmbg-${idx}`).checked,
|
||||||
image_filter: document.getElementById(`ef-filter-${idx}`).value,
|
image_filter: document.getElementById(`ef-filter-${idx}`).value,
|
||||||
ui_show_button: document.getElementById(`ef-ui-show-${idx}`).checked,
|
|
||||||
ui_title: document.getElementById(`ef-ui-title-${idx}`).value,
|
|
||||||
ui_icon: document.getElementById(`ef-ui-icon-${idx}`).value,
|
|
||||||
ui_use_custom_color: document.getElementById(`ef-ui-usecol-${idx}`).checked,
|
|
||||||
ui_custom_color: document.getElementById(`ef-ui-color-${idx}`).value,
|
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await api('PUT', `/api/actions/photobooth/${realIdx}`, updates);
|
await api('PUT', `/api/actions/photobooth/${realIdx}`, updates);
|
||||||
|
|||||||
Reference in New Issue
Block a user