Refresh timers when morphing happens

This commit is contained in:
Jorge Manrubia
2025-04-11 13:05:56 +02:00
parent 4e91d8a666
commit ba6eab509c
2 changed files with 9 additions and 1 deletions
@@ -24,6 +24,14 @@ export default class extends Controller {
clearInterval(this.#timer)
}
refreshAll() {
this.constructor.targets.forEach(targetName => {
this.targets.findAll(targetName).forEach(target => {
this.#formatTime(this[`${targetName}Formatter`], target)
})
})
}
timeTargetConnected(target) {
this.#formatTime(this.timeFormatter, target)
}
+1 -1
View File
@@ -25,7 +25,7 @@
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
</head>
<body data-controller="lightbox local-time timezone-cookie">
<body data-controller="lightbox local-time timezone-cookie" data-action="turbo:morph@window->local-time#refreshAll">
<header id="header">
<a href="#main-content" class="skip-navigation btn">Skip to main content</a>
<%= yield :header %>