2024-04-29 08:36:13 +02:00
|
|
|
{{ define "page" }}
|
|
|
|
|
|
|
|
{{ block "page_label" . }}{{end}}
|
|
|
|
{{ $version := .VERSION }}
|
2024-06-25 08:59:07 +02:00
|
|
|
{{ $theme := .CONFIG.THEME }}
|
|
|
|
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/{{ .CONFIG.THEME }}/triggers.css">
|
2024-04-29 08:36:13 +02:00
|
|
|
|
2024-05-30 15:06:41 +02:00
|
|
|
<script type="text/javascript">
|
|
|
|
function createTrigger(sectionID) {
|
|
|
|
let name = prompt("Trigger name")
|
|
|
|
if (name === null)
|
|
|
|
return
|
|
|
|
|
|
|
|
if (name.trim() == "") {
|
|
|
|
alert('A name is required')
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
fetch(`/trigger/create/${sectionID}/${encodeURIComponent(name)}`)
|
|
|
|
.then(data=>data.json())
|
|
|
|
.then(json=>{
|
|
|
|
if (!json.OK) {
|
|
|
|
alert(json.Error)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
location.href = `/trigger/edit/${json.Trigger.ID}`
|
|
|
|
})
|
|
|
|
}
|
2024-06-01 09:18:56 +02:00
|
|
|
|
|
|
|
function deleteTrigger(triggerID, name) {
|
|
|
|
if (!confirm(`Sure you want to delete '${name}'?`))
|
|
|
|
return
|
|
|
|
location.href = `/trigger/delete/${triggerID}`
|
|
|
|
}
|
2024-05-30 15:06:41 +02:00
|
|
|
</script>
|
|
|
|
|
2024-04-29 08:36:13 +02:00
|
|
|
<div id="areas">
|
|
|
|
{{ range .Data.Areas }}
|
|
|
|
<div class="area">
|
|
|
|
<div class="name">{{ .Name }}</div>
|
|
|
|
{{ range .SortedSections }}
|
2024-06-02 09:17:50 +02:00
|
|
|
{{ if eq .ID 0 }}
|
|
|
|
{{ continue }}
|
|
|
|
{{ end }}
|
2024-04-29 08:36:13 +02:00
|
|
|
<div class="section">
|
2024-05-01 10:02:33 +02:00
|
|
|
<div class="create">
|
|
|
|
<div class="name">{{ .Name }}</div>
|
2024-05-30 15:06:41 +02:00
|
|
|
<div class="new"><a onclick="createTrigger({{ .ID }})">+</a></div>
|
2024-05-01 10:02:33 +02:00
|
|
|
</div>
|
2024-04-29 08:36:13 +02:00
|
|
|
|
|
|
|
<div class="triggers">
|
|
|
|
{{ range .SortedTriggers }}
|
|
|
|
{{ if eq .Name "" }}
|
|
|
|
{{ continue }}
|
|
|
|
{{ end }}
|
2024-06-01 09:18:56 +02:00
|
|
|
<div class="trigger">
|
2024-06-25 08:59:07 +02:00
|
|
|
<img src="/images/{{ $version }}/{{ $theme }}/triggers.svg">
|
2024-06-01 09:18:56 +02:00
|
|
|
<div class="label"><a href="/trigger/edit/{{ .ID }}">{{ .Name }}</a></div>
|
2024-06-25 09:49:09 +02:00
|
|
|
<img src="/images/{{ $version }}/{{ $theme }}/delete.svg" onclick="deleteTrigger({{ .ID }}, '{{ .Name }}')">
|
2024-06-01 09:18:56 +02:00
|
|
|
</div>
|
2024-04-29 08:36:13 +02:00
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{ end }}
|