mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-11 23:17:48 +00:00
I'm adding TurboPower for the scroll_into_view action. It adds all the nice CableReady actions to Turbo Streams. Note that I omitted `block: "start"` because that option is the default in Javascript. And the generic `action` method doesn't support parameters like this anyway. I'll work on that in the next commit. I also re-introduced a race condition by rendering the "loading" indicator after triggering the report rendering job. I'm planning to resolve that later.
18 lines
448 B
JavaScript
18 lines
448 B
JavaScript
import "@hotwired/turbo";
|
|
|
|
import TurboPower from "turbo_power";
|
|
TurboPower.initialize(Turbo.StreamActions);
|
|
|
|
document.addEventListener("turbo:frame-missing", (event) => {
|
|
// don't replace frame contents
|
|
event.preventDefault();
|
|
|
|
// show error message instead
|
|
status = event.detail.response.status;
|
|
if(status == 401) {
|
|
alert(I18n.t("errors.unauthorized.message"));
|
|
} else {
|
|
alert(I18n.t("errors.general_error.message"));
|
|
}
|
|
});
|