<% for info in item { %>
diff --git a/pgml-dashboard/src/components/inputs/select/select_controller.js b/pgml-dashboard/src/components/inputs/select/select_controller.js
index e7c712dba..d5321f1b0 100644
--- a/pgml-dashboard/src/components/inputs/select/select_controller.js
+++ b/pgml-dashboard/src/components/inputs/select/select_controller.js
@@ -4,8 +4,16 @@ export default class extends Controller {
static targets = ["input", "value"]
choose(e) {
- this.inputTarget.value = e.target.innerHTML
- this.valueTarget.innerHTML = e.target.innerHTML
+ this.setValue(e.target.innerHTML)
+ }
+
+ resetSelect() {
+ this.setValue(this.element.dataset.initial)
+ }
+
+ setValue(value) {
+ this.inputTarget.value = value
+ this.valueTarget.innerHTML = value
this.inputTarget.dispatchEvent(new Event('change'))
}
}
diff --git a/pgml-dashboard/src/components/inputs/select/template.html b/pgml-dashboard/src/components/inputs/select/template.html
index b158717bc..4bc33ecd4 100644
--- a/pgml-dashboard/src/components/inputs/select/template.html
+++ b/pgml-dashboard/src/components/inputs/select/template.html
@@ -2,7 +2,7 @@
use crate::components::dropdown::Dropdown;
use crate::components::stimulus::stimulus_target::StimulusTarget;
%>
-
+
<% let mut dropdown = Dropdown::new()
.items(options)
@@ -29,5 +29,5 @@
<%+ dropdown %>
- data-action="<%- action %>" />
+ data-action="<%- action %> reset->inputs-select#resetSelect" />
diff --git a/pgml-dashboard/src/components/inputs/switch/mod.rs b/pgml-dashboard/src/components/inputs/switch/mod.rs
index 389fde568..7db04ae71 100644
--- a/pgml-dashboard/src/components/inputs/switch/mod.rs
+++ b/pgml-dashboard/src/components/inputs/switch/mod.rs
@@ -60,8 +60,8 @@ impl Switch {
self
}
- pub fn start_toggled(mut self) -> Switch {
- self.initial_state = State::Right;
+ pub fn default_position(mut self, state: State) -> Switch {
+ self.initial_state = state;
self
}
diff --git a/pgml-dashboard/src/components/inputs/switch/switch.scss b/pgml-dashboard/src/components/inputs/switch/switch.scss
index ac8ffe4d9..af6e97af8 100644
--- a/pgml-dashboard/src/components/inputs/switch/switch.scss
+++ b/pgml-dashboard/src/components/inputs/switch/switch.scss
@@ -7,11 +7,12 @@ div[data-controller="inputs-switch"] {
}
.label {
- padding: 8px 20px;
+ padding: 8px 40px;
border-radius: 5rem;
text-align: center;
display: flex;
justify-content: center;
+ align-items: center;
@extend .gap-2;
}
diff --git a/pgml-dashboard/src/components/inputs/text/editable_header/editable_header.scss b/pgml-dashboard/src/components/inputs/text/editable_header/editable_header.scss
index 49b36cad9..709658e68 100644
--- a/pgml-dashboard/src/components/inputs/text/editable_header/editable_header.scss
+++ b/pgml-dashboard/src/components/inputs/text/editable_header/editable_header.scss
@@ -33,4 +33,10 @@ div[data-controller="inputs-text-editable-header"] {
padding: 0px;
margin-bottom: -2px; // compensate for border space
}
+
+ #title {
+ &.error {
+ border-bottom: 1px solid #{$error}
+ }
+ }
}
diff --git a/pgml-dashboard/src/components/inputs/text/editable_header/editable_header_controller.js b/pgml-dashboard/src/components/inputs/text/editable_header/editable_header_controller.js
index e00b8cefb..b5195a087 100644
--- a/pgml-dashboard/src/components/inputs/text/editable_header/editable_header_controller.js
+++ b/pgml-dashboard/src/components/inputs/text/editable_header/editable_header_controller.js
@@ -31,9 +31,11 @@ export default class extends Controller {
error(e) {
this.errorTarget.innerHTML = e.detail
this.errorTarget.style.display = "block"
+ this.headerTarget.classList.add("error")
}
clear() {
this.errorTarget.style.display = "none"
+ this.headerTarget.classList.remove("error")
}
}
diff --git a/pgml-dashboard/src/components/inputs/text/editable_header/template.html b/pgml-dashboard/src/components/inputs/text/editable_header/template.html
index eb320ed5a..31c879a7b 100644
--- a/pgml-dashboard/src/components/inputs/text/editable_header/template.html
+++ b/pgml-dashboard/src/components/inputs/text/editable_header/template.html
@@ -5,7 +5,7 @@