mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-10 23:07:47 +00:00
Remove cable ready and mrujs dependencies
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -101,7 +101,6 @@ gem 'redis'
|
||||
gem 'sidekiq'
|
||||
gem 'sidekiq-scheduler'
|
||||
|
||||
gem "cable_ready"
|
||||
gem "stimulus_reflex"
|
||||
|
||||
gem "turbo_power"
|
||||
|
||||
@@ -869,7 +869,6 @@ DEPENDENCIES
|
||||
bootsnap
|
||||
bugsnag
|
||||
bullet
|
||||
cable_ready
|
||||
cancancan (~> 1.15.0)
|
||||
capybara
|
||||
catalog!
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
%span.button.voucher-added
|
||||
%i.ofn-i_051-check-big
|
||||
= t("checkout.step2.voucher.voucher", voucher_amount: voucher_adjustment.originator.display_value)
|
||||
= link_to t("checkout.step2.voucher.remove_code"), voucher_adjustment_path(id: voucher_adjustment.id), data: { turbo_method: "delete", confirm: t("checkout.step2.voucher.confirm_delete") }
|
||||
= link_to t("checkout.step2.voucher.remove_code"), voucher_adjustment_path(id: voucher_adjustment.id), data: { turbo_method: "delete", turbo_confirm: t("checkout.step2.voucher.confirm_delete") }
|
||||
|
||||
- # This might not be true, ie payment method including a fee which wouldn't be covered by voucher or tax implication raising total to be bigger than the voucher amount ?
|
||||
- if voucher_adjustment.originator.amount > order.pre_discount_total && voucher_adjustment.originator.is_a?(Vouchers::FlatRate)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
%i{ class: link[:icon] }
|
||||
%span=link[:name]
|
||||
- else
|
||||
%a.menu_item{ href: link[:url], target: link[:target] || "_self", data: { method: link[:method], confirm: link[:confirm] } }
|
||||
= link_to link[:url], class: 'menu_item', target: link[:target] || "_self", data: { turbo: true, turbo_method: link[:method], turbo_confirm: link[:confirm], action: 'dropdown#submitLink' } do
|
||||
%span
|
||||
%i{ class: link[:icon] }
|
||||
%span=link[:name]
|
||||
|
||||
@@ -18,6 +18,22 @@ export default class extends Controller {
|
||||
this.#stopPropagation(event);
|
||||
}
|
||||
|
||||
submitLink(event) {
|
||||
const link = event.currentTarget;
|
||||
const method = link.getAttribute('data-turbo-method');
|
||||
const confirmMessage = link.getAttribute('data-turbo-confirm');
|
||||
|
||||
if (link && confirmMessage && [null, 'get'].includes(method)) {
|
||||
// Manualy visit link
|
||||
event.preventDefault();
|
||||
if (confirm(link.getAttribute('data-turbo-confirm'))) {
|
||||
Turbo.visit(link.href);
|
||||
}
|
||||
}
|
||||
|
||||
this.closeOnMenu(event);
|
||||
}
|
||||
|
||||
// private
|
||||
|
||||
#close(event) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import { definitionsFromContext } from "stimulus/webpack-helpers";
|
||||
import StimulusReflex from "stimulus_reflex";
|
||||
import consumer from "../channels/consumer";
|
||||
import controller from "../controllers/application_controller";
|
||||
import CableReady from "cable_ready";
|
||||
import RailsNestedForm from '@stimulus-components/rails-nested-form/dist/stimulus-rails-nested-form.umd.js' // the default module entry point is broken
|
||||
|
||||
const application = Application.start();
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
import CableReady from "cable_ready";
|
||||
import mrujs from "mrujs";
|
||||
import { CableCar } from "mrujs/plugins";
|
||||
|
||||
mrujs.start({
|
||||
plugins: [new CableCar(CableReady, { mimeType: "text/vnd.cable-ready.json" })],
|
||||
});
|
||||
|
||||
// Handle legacy jquery ujs buttons
|
||||
document.addEventListener("ajax:beforeNavigation", (event) => {
|
||||
if (event.detail.element.dataset.ujsNavigate !== "false") return;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if (event.detail.fetchResponse.response.redirected) {
|
||||
document.location.href = event.detail.fetchResponse.response.url;
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("ajax:beforeSend", (event) => {
|
||||
window.Turbo.navigator.adapter.progressBar.setValue(0);
|
||||
window.Turbo.navigator.adapter.progressBar.show();
|
||||
});
|
||||
|
||||
document.addEventListener("ajax:complete", (event) => {
|
||||
window.Turbo.navigator.adapter.progressBar.setValue(100);
|
||||
window.Turbo.navigator.adapter.progressBar.hide();
|
||||
});
|
||||
2
app/webpacker/js/ujs.js
Normal file
2
app/webpacker/js/ujs.js
Normal file
@@ -0,0 +1,2 @@
|
||||
import Rails from "@rails/ujs";
|
||||
Rails.start();
|
||||
@@ -2,7 +2,7 @@ import "controllers";
|
||||
import "channels";
|
||||
import "../js/turbo";
|
||||
import "../js/hotkeys";
|
||||
import "../js/mrujs";
|
||||
import "../js/ujs";
|
||||
import "../js/matomo";
|
||||
import "../js/moment";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "controllers";
|
||||
import "../js/turbo";
|
||||
import "../js/hotkeys";
|
||||
import "../js/mrujs";
|
||||
import "../js/ujs";
|
||||
import "../js/matomo";
|
||||
import "../js/moment";
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
"@floating-ui/dom": "^1.6.11",
|
||||
"@hotwired/stimulus": "^3.2",
|
||||
"@hotwired/turbo": "^8.0.12",
|
||||
"@rails/ujs": "^7.1.3-4",
|
||||
"@rails/webpacker": "5.4.4",
|
||||
"@stimulus-components/rails-nested-form": "^5.0.0",
|
||||
"cable_ready": "5.0.5",
|
||||
"flatpickr": "^4.6.9",
|
||||
"foundation-sites": "^5.5.3",
|
||||
"hotkeys-js": "^3.13.7",
|
||||
@@ -25,7 +25,6 @@
|
||||
"leaflet-geosearch": "4.0.0",
|
||||
"leaflet-providers": "2.0.0",
|
||||
"moment": "^2.30.1",
|
||||
"mrujs": "^1.0.2",
|
||||
"select2": "^4.0.13",
|
||||
"shortcut-buttons-flatpickr": "^0.4.0",
|
||||
"stimulus": "^3.2.2",
|
||||
|
||||
16
yarn.lock
16
yarn.lock
@@ -1394,6 +1394,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-7.0.4.tgz#70a3ca56809f7aaabb80af2f9c01ae51e1a8ed41"
|
||||
integrity sha512-tz4oM+Zn9CYsvtyicsa/AwzKZKL+ITHWkhiu7x+xF77clh2b4Rm+s6xnOgY/sGDWoFWZmtKsE95hxBPkgQQNnQ==
|
||||
|
||||
"@rails/ujs@^7.1.3-4":
|
||||
version "7.1.3-4"
|
||||
resolved "https://registry.yarnpkg.com/@rails/ujs/-/ujs-7.1.3-4.tgz#1dddea99d5c042e8513973ea709b2cb7e840dc2d"
|
||||
integrity sha512-z0ckI5jrAJfImcObjMT1RBz2IxH6I5q6ZTMFex6AfxSQKZuuL8JxAXvg2CvBuodGCxKvybFVolDyMHXlBLeYAA==
|
||||
|
||||
"@rails/webpacker@5.4.4":
|
||||
version "5.4.4"
|
||||
resolved "https://registry.yarnpkg.com/@rails/webpacker/-/webpacker-5.4.4.tgz#971a41b987c096c908ce4088accd57c1a9a7e2f7"
|
||||
@@ -2433,7 +2438,7 @@ bytes@3.1.2:
|
||||
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5"
|
||||
integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==
|
||||
|
||||
cable_ready@5.0.5, cable_ready@^5.0.5:
|
||||
cable_ready@^5.0.5:
|
||||
version "5.0.5"
|
||||
resolved "https://registry.yarnpkg.com/cable_ready/-/cable_ready-5.0.5.tgz#45dd12ae5b3c5c53a1b42c10785e79ff87a5be22"
|
||||
integrity sha512-qPC6zaI8h59BzMH3MxtpuMC+H33VJTA2eVddL6fZSWz01jJ2Y3okld01oYWQoKwE2yle/tvHbyuhoKxD4mhEuw==
|
||||
@@ -6193,7 +6198,7 @@ moment@^2.30.1:
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
|
||||
integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==
|
||||
|
||||
morphdom@2.6.1, "morphdom@>=2.6.0 <3.0.0":
|
||||
morphdom@2.6.1:
|
||||
version "2.6.1"
|
||||
resolved "https://registry.yarnpkg.com/morphdom/-/morphdom-2.6.1.tgz#e868e24f989fa3183004b159aed643e628b4306e"
|
||||
integrity sha512-Y8YRbAEP3eKykroIBWrjcfMw7mmwJfjhqdpSvoqinu8Y702nAwikpXcNFDiIkyvfCLxLM9Wu95RZqo4a9jFBaA==
|
||||
@@ -6215,13 +6220,6 @@ mri@^1.2.0:
|
||||
resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b"
|
||||
integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==
|
||||
|
||||
mrujs@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/mrujs/-/mrujs-1.0.2.tgz#f19818735d8f5865dab75254f4cfc38d33804f2e"
|
||||
integrity sha512-dGTUHLH+COsGOn78R7lUFUK/eDLaY8W14N25EymB6lXknENeyoVL31Hsxfb2hEsMb2yjBx0cB//ibO/NTECIzQ==
|
||||
dependencies:
|
||||
morphdom ">=2.6.0 <3.0.0"
|
||||
|
||||
ms@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||
|
||||
Reference in New Issue
Block a user