Skip to content

Commit

Permalink
multi file upload demo
Browse files Browse the repository at this point in the history
  • Loading branch information
starswan committed Oct 25, 2024
1 parent 1f705bd commit 80a9aa7
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions app/assets/javascript/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import 'core-js/modules/es.weak-set';
import '@stimulus/polyfills';
import { initAll as govukInit } from 'govuk-frontend';
import $ from 'jquery';
// import { initAll as mojInit, MultiFileUpload } from '@ministryofjustice/frontend';
import { initAll as mojInit } from '@ministryofjustice/frontend';
// import { MOJFrontend } from '@ministryofjustice/frontend';

import { Application } from '@hotwired/stimulus';
import Rails from 'rails-ujs';
Expand All @@ -32,6 +29,8 @@ import ShowHiddenContentController from './js_components/showHiddenContent/showH
import TrackedLinkController from './js_components/trackedLink/trackedLink';
import UtilsController from './js_components/utils';

const MOJFrontend = require('@ministryofjustice/frontend/moj/all');

Sentry.init({
// `sentryConfig` is set from the application layout
dsn: window.sentryConfig.dsn,
Expand Down Expand Up @@ -68,18 +67,13 @@ application.register('utils', UtilsController);
Rails.start();
govukInit();
window.$ = $;
mojInit();
// MOJFrontend.initAll();
// window.MOJFrontend = MOJFrontend;
MOJFrontend.initAll();

// if (typeof MultiFileUpload !== 'undefined') {
// alert('MultiFileUpload being enabled');
// // eslint-disable-next-line no-new
// new MultiFileUpload({
// container: document.querySelector('.moj-multi-file-upload'),
// uploadUrl: '/ajax-upload-url',
// deleteUrl: '/ajax-delete-url',
// });
// } else {
// alert('MultiFileUpload disabled');
// }
if (typeof MOJFrontend.MultiFileUpload !== 'undefined') {
// eslint-disable-next-line no-new
new MOJFrontend.MultiFileUpload({
container: document.querySelector('.moj-multi-file-upload'),
uploadUrl: '/ajax-upload-url',
deleteUrl: '/ajax-delete-url',
});
}

0 comments on commit 80a9aa7

Please sign in to comment.