3
0

Add enable switch on code snippets

This commit is contained in:
Mumbi Francis
2024-08-28 12:08:31 +03:00
parent 2d63f4d0d7
commit 06ab6a421e
4 changed files with 13 additions and 1 deletions
@@ -71,6 +71,13 @@
title-class="text-capitalize"
@ok="modal.updater(modal.data)"
>
<b-checkbox
v-model="modal.data.enabled"
class="mb-3"
>
{{ $t('code-snippets.enabled') }}
</b-checkbox>
<b-form-group
:label="$t('code-snippets.form.provider.label')"
label-class="text-primary"
@@ -234,6 +241,7 @@ export default {
data: {
name: '',
script: '<' + 'script> ' + '</' + 'script>',
enabled: true,
},
updater: (changed) => {
this.codeSnippets.push(changed)
@@ -4,6 +4,7 @@ editor:
code-snippets:
add: Add code snippet
empty: No snippets yet
enabled: Enabled
table-headers:
provider: Provider
value: Script value
+3 -1
View File
@@ -167,7 +167,9 @@ func serveConfig(r chi.Router, config webappConfig) {
snippetScripts := ""
for _, snippet := range codeSnippets {
snippetScripts += snippet.Script
if snippet.Enabled {
snippetScripts += snippet.Script
}
}
doc, err := html.Parse(strings.NewReader(snippetScripts))
+1
View File
@@ -420,6 +420,7 @@ type (
CodeSnippet struct {
Name string `json:"name"`
Script string `json:"script"`
Enabled bool `json:"enabled"`
}
SmtpServers struct {