Skip to content

Commit ba0ecab

Browse files
committed
save
1 parent c81672a commit ba0ecab

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

pgml-dashboard/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import { Controller } from '@hotwired/stimulus'
1+
import { Controller } from "@hotwired/stimulus";
22

33
export default class extends Controller {
4-
static initialized = false
4+
static initialized = false;
55

66
initialize() {
7-
if (this.constructor.initialized) return
7+
if (this.constructor.initialized) return;
88

9-
window.addEventListener("turbo:before-visit", function(event) {
10-
localStorage.setItem('scrollpos', window.scrollY);
9+
window.addEventListener("turbo:before-visit", function (event) {
10+
localStorage.setItem("scrollpos", window.scrollY);
1111
});
1212

13-
window.addEventListener("turbo:load", function(event) {
14-
const scrollpos = localStorage.getItem('scrollpos');
13+
window.addEventListener("turbo:load", function (event) {
14+
const scrollpos = localStorage.getItem("scrollpos");
1515
if (scrollpos) {
1616
window.scrollTo(0, scrollpos);
1717
}
18-
})
18+
});
1919

20-
this.constructor.initialized = true
20+
this.constructor.initialized = true;
2121
}
2222
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Controller } from "@hotwired/stimulus";
22

33
export default class extends Controller {
4-
static targets = ["button", "link"];
4+
static targets = ["button"];
55

66
selectSwitchOption(e) {
77
this.buttonTargets.forEach((target) => {
@@ -12,8 +12,10 @@ export default class extends Controller {
1212
e.currentTarget.classList.add("active");
1313
e.currentTarget.ariaPressed = true;
1414

15-
if (this.hasLinkTarget) {
16-
this.linkTarget.click()
15+
const link = e.currentTarget.querySelector("a");
16+
17+
if (link) {
18+
link.click();
1719
}
1820
}
1921
}

pgml-dashboard/src/components/inputs/switch_v_2/template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
data-action="<%= option.actions %>"
1717
>
1818
<% if let Some(ref link) = option.link { %>
19-
<a href="<%= link %>" class="d-none" data-inputs-switch-v-2-target="link"></a>
19+
<a href="<%= link %>" class="d-none"></a>
2020
<% } %>
21-
21+
2222
<% if let Some(icon) = option.icon { %>
2323
<span class="material-symbols-outlined">
2424
<%= icon %>

0 commit comments

Comments
 (0)