demarches-normaliennes/app/javascript/packs/application.js

72 lines
2.2 KiB
JavaScript
Raw Normal View History

import '../shared/polyfills';
import Turbolinks from 'turbolinks';
import Rails from '@rails/ujs';
import * as ActiveStorage from '@rails/activestorage';
import '@rails/actiontext';
import 'whatwg-fetch'; // window.fetch polyfill
2019-08-14 13:11:36 +02:00
import ReactRailsUJS from 'react_ujs';
2019-08-01 15:22:37 +02:00
import '../shared/page-update-event';
2019-02-13 14:16:22 +01:00
import '../shared/activestorage/ujs';
2020-01-29 12:16:38 +01:00
import '../shared/remote-poller';
import '../shared/rails-ujs-fix';
2018-08-31 12:56:56 +02:00
import '../shared/safari-11-file-xhr-workaround';
import '../shared/remote-input';
import '../shared/franceconnect';
import '../shared/toggle-target';
import '../new_design/dropdown';
2019-11-19 17:55:30 +01:00
import '../new_design/autosave';
import '../new_design/form-validation';
import '../new_design/procedure-context';
import '../new_design/procedure-form';
import '../new_design/select2';
2019-02-21 17:50:18 +01:00
import '../new_design/spinner';
import '../new_design/support';
2018-10-17 12:07:12 +02:00
import '../new_design/champs/carte';
import '../new_design/champs/linked-drop-down-list';
2019-01-30 16:14:15 +01:00
import '../new_design/champs/repetition';
import { toggleCondidentielExplanation } from '../new_design/avis';
import { scrollMessagerie } from '../new_design/messagerie';
import {
showMotivation,
motivationCancel,
showImportJustificatif
} from '../new_design/state-button';
import { replaceSemicolonByComma } from '../new_design/avis';
2019-12-02 14:20:26 +01:00
import {
acceptEmailSuggestion,
discardEmailSuggestionBox
} from '../new_design/user-sign_up';
// This is the global application namespace where we expose helpers used from rails views
const DS = {
2018-11-14 16:28:02 +01:00
fire: (eventName, data) => Rails.fire(document, eventName, data),
toggleCondidentielExplanation,
scrollMessagerie,
showMotivation,
motivationCancel,
showImportJustificatif,
replaceSemicolonByComma,
acceptEmailSuggestion,
discardEmailSuggestionBox
};
// Start Rails helpers
Rails.start();
Turbolinks.start();
ActiveStorage.start();
// Expose globals
window.DS = window.DS || DS;
// (Both Rails redirects and ReactRailsUJS expect Turbolinks to be globally available)
window.Turbolinks = Turbolinks;
2019-08-14 13:11:36 +02:00
// Now that Turbolinks is globally exposed,configure ReactRailsUJS
2019-08-14 13:11:36 +02:00
// eslint-disable-next-line no-undef
ReactRailsUJS.useContext(require.context('loaders', true));
2019-08-14 13:11:36 +02:00
// Remove previous event handlers and add new ones:
ReactRailsUJS.detectEvents();