Skip to content

Commit

Permalink
fix: add templateName hidden input to settings templates
Browse files Browse the repository at this point in the history
  • Loading branch information
tphakala committed Sep 22, 2024
1 parent 1dad6b7 commit ea027fb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
22 changes: 14 additions & 8 deletions views/settings/filtersSettings.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{{define "detectionfiltersSettings"}}

<!-- Hidden input to always submit the template name -->
<input type="hidden" name="templateName" value="{{.TemplateName}}">

<!-- Privacy Filter start -->
<div class="collapse collapse-open bg-base-100 shadow-xs col-span-3"
x-data="{
Expand Down Expand Up @@ -73,7 +76,7 @@
enabled: {{.Settings.Realtime.DogBarkFilter.Enabled}},
confidence: {{.Settings.Realtime.DogBarkFilter.Confidence}},
remember: {{.Settings.Realtime.DogBarkFilter.Remember}},
species: {{.Settings.Realtime.DogBarkFilter.Species | toJSON}}
species: {{.Settings.Realtime.DogBarkFilter.Species | toJSON}} || [],
},
newSpecies: '',
editIndex: null,
Expand All @@ -87,13 +90,16 @@
this.hasChanges = false;
},
addSpecies() {
if (this.newSpecies.trim()) {
this.dogBarkFilter.species.push(this.newSpecies.trim());
this.newSpecies = '';
this.hasChanges = true;
this.predictions = [];
}
},
if (!this.dogBarkFilter.species) {
this.dogBarkFilter.species = [];
}
if (this.newSpecies.trim()) {
this.dogBarkFilter.species.push(this.newSpecies.trim());
this.newSpecies = '';
this.hasChanges = true;
this.predictions = [];
}
},
removeSpecies(index) {
this.dogBarkFilter.species.splice(index, 1);
this.hasChanges = true;
Expand Down
3 changes: 3 additions & 0 deletions views/settings/integrationSettings.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{{define "integrationsSettings"}}

<!-- Hidden input to always submit the template name -->
<input type="hidden" name="templateName" value="{{.TemplateName}}">

<!-- BirdWeather Settings start -->
<div class="collapse collapse-open bg-base-100 shadow-xs col-span-3"
x-data="{
Expand Down
4 changes: 3 additions & 1 deletion views/settings/mainSettings.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{{define "mainSettings"}}
<!-- values on this form are populated by alpine.js x-model -->

<!-- Hidden input to always submit the template name -->
<input type="hidden" name="templateName" value="{{.TemplateName}}">

<!-- Node Settings start -->
<div class="collapse collapse-open bg-base-100 shadow-xs col-span-3"
Expand Down

0 comments on commit ea027fb

Please sign in to comment.