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