mirror of
https://github.com/we-promise/sure.git
synced 2026-04-08 06:44:52 +00:00
* Introduce SnapTrade integration with models, migrations, views, and activity processing logic. * Refactor SnapTrade activities processing: improve activity fetching flow, handle pending states, and update UI elements for enhanced user feedback. * Update Brakeman ignore file to include intentional redirect for SnapTrade OAuth portal. * Refactor SnapTrade models, views, and processing logic: add currency extraction helper, improve pending state handling, optimize migration checks, and enhance user feedback in UI. * Remove encryption for SnapTrade `snaptrade_user_id`, as it is an identifier, not a secret. * Introduce `SnaptradeConnectionCleanupJob` to asynchronously handle SnapTrade connection cleanup and improve i18n for SnapTrade item status messages. * Update SnapTrade encryption: make `snaptrade_user_secret` non-deterministic to enhance security. --------- Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> Co-authored-by: luckyPipewrench <luckypipewrench@proton.me> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
36 lines
834 B
JavaScript
36 lines
834 B
JavaScript
import { Controller } from "@hotwired/stimulus";
|
|
|
|
// Connects to data-controller="dialog"
|
|
export default class extends Controller {
|
|
static targets = ["content"]
|
|
|
|
static values = {
|
|
autoOpen: { type: Boolean, default: false },
|
|
reloadOnClose: { type: Boolean, default: false },
|
|
disableClickOutside: { type: Boolean, default: false },
|
|
};
|
|
|
|
connect() {
|
|
if (this.element.open) return;
|
|
if (this.autoOpenValue) {
|
|
this.element.showModal();
|
|
}
|
|
}
|
|
|
|
// If the user clicks anywhere outside of the visible content, close the dialog
|
|
clickOutside(e) {
|
|
if (this.disableClickOutsideValue) return;
|
|
if (!this.contentTarget.contains(e.target)) {
|
|
this.close();
|
|
}
|
|
}
|
|
|
|
close() {
|
|
this.element.close();
|
|
|
|
if (this.reloadOnCloseValue) {
|
|
Turbo.visit(window.location.href);
|
|
}
|
|
}
|
|
}
|