Started working on proper parameters

This commit is contained in:
Leon Mika 2026-03-26 22:14:57 +11:00
parent 2d42a0ef90
commit 488942db2e
3 changed files with 69 additions and 10 deletions

View file

@ -1,6 +1,10 @@
import Handlebars from "handlebars";
import {Controller} from "@hotwired/stimulus";
Handlebars.registerHelper("submit_on", function (id, event) {
return `data-action="${event}->edit-upload#updateProcessor" data-edit-upload-id-param="${id}"`
});
const processorFrame = Handlebars.compile(`
<div class="card mb-3">
<div class="card-header d-flex justify-content-between">
@ -11,7 +15,7 @@ const processorFrame = Handlebars.compile(`
>X</a>
</div>
<div class="card-body">
{{{props}}}
<form data-role="processor-params" data-params-id="{{id}}">{{{props}}}</form>
</div>
</div>
`);
@ -19,7 +23,12 @@ const processorFrame = Handlebars.compile(`
const processorUIs = {
"shadow": {
label: "Shadow",
template: Handlebars.compile(`This processor has no properties.`),
template: Handlebars.compile(`
<div class="mb-3">
<label for="{{id}}_width" class="form-label">Colour</label>
<input name="width" class="form-control" id="{{id}}_{{props.color}}" type="color" value="{{color}}" {{{submit_on id 'change'}}}>
</div>
`),
},
"resize": {
label: "Resize",