Fix the URL to get camper.js in admin/services/form.gohtml

Otherwise, the browser assumes they are two different resources, because
i am telling it so with the two URI, and loads the same file twice,
triggering the execution of startup functions, such as the ones that
convert textareas to CKEditor divs, twice.
This commit is contained in:
jordi fita mas 2024-01-24 00:52:57 +01:00
parent 937628ca9a
commit 0a2911749a
1 changed files with 11 additions and 14 deletions

View File

@ -18,18 +18,15 @@
{{ define "content" -}} {{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/services.serviceForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/services.serviceForm*/ -}}
<form <form
{{ if .ID }} {{- if .ID }} data-hx-put="/admin/services/{{ .ID }}"
data-hx-put="/admin/services/{{ .ID }}" {{- else }} action="/admin/services" method="post"{{ end -}}
{{ else }}
action="/admin/services" method="post"
{{ end }}
> >
<h2> <h2>
{{ if .ID }} {{- if .ID -}}
{{( pgettext "Edit Service" "title" )}} {{( pgettext "Edit Service" "title" )}}
{{ else }} {{- else -}}
{{( pgettext "New Service" "title" )}} {{( pgettext "New Service" "title" )}}
{{ end }} {{- end -}}
</h2> </h2>
{{ CSRFInput }} {{ CSRFInput }}
<fieldset {{ template "init-lang" . }}> <fieldset {{ template "init-lang" . }}>
@ -37,9 +34,9 @@
<fieldset class="icon-input"> <fieldset class="icon-input">
<legend>{{( pgettext "Icon" "input")}}</legend> <legend>{{( pgettext "Icon" "input")}}</legend>
<input type="hidden" name="{{ .Name }}" <input type="hidden" name="{{ .Name }}"
{{- range .Options }} {{- range .Options -}}
{{ if $field.IsSelected .Value }} value="{{ .Value }}"{{ end }} {{ if $field.IsSelected .Value }} value="{{ .Value }}"{{ end }}
{{- end }} {{- end -}}
> >
<ul> <ul>
{{- range .Options }} {{- range .Options }}
@ -80,17 +77,17 @@
</fieldset> </fieldset>
<footer> <footer>
<button type="submit"> <button type="submit">
{{ if .ID }} {{- if .ID -}}
{{( pgettext "Update" "action" )}} {{( pgettext "Update" "action" )}}
{{ else }} {{- else -}}
{{( pgettext "Add" "action" )}} {{( pgettext "Add" "action" )}}
{{ end }} {{- end -}}
</button> </button>
</footer> </footer>
</form> </form>
<script type="module"> <script type="module">
import {setupIconInput} from "/static/camper.js?v="; import {setupIconInput} from "/static/camper.js?v={{ camperVersion }}";
setupIconInput(document.querySelector('.icon-input')); setupIconInput(document.querySelector('.icon-input'));
</script> </script>