Files
sure/app/javascript/controllers/cashflow_expand_controller.js
Number Eight 0c6d208ef2 feat: implement expandable view for cashflow sankey chart (#739)
* feat: implement expandable view for cashflow sankey chart

* refactor: migrate cashflow dialog sizing to tailwind utilities

* refactor: declarative draggable restore on cashflow dialog close

* refactor: localized title and use Tailwind utilities

* refactor: update dialog interaction especially on mobile

* refactor: add global expand text to localization

* fix: restore draggable immediately after dialog close

* Whitespace noise

---------

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2026-01-23 09:52:15 +01:00

24 lines
666 B
JavaScript

import { Controller } from "@hotwired/stimulus";
export default class extends Controller {
open() {
const dialog = this.element.querySelector("dialog");
if (!dialog) return;
if (typeof this.originalDraggable === "undefined") {
this.originalDraggable = this.element.getAttribute("draggable");
}
this.element.setAttribute("draggable", "false");
dialog.showModal();
}
restore() {
if (this.originalDraggable === undefined) return;
this.originalDraggable
? this.element.setAttribute("draggable", this.originalDraggable)
: this.element.removeAttribute("draggable");
this.originalDraggable = undefined;
}
}