2018-09-11 17:53:11 +02:00
|
|
|
import '../shared/polyfills';
|
2018-07-12 11:50:47 +02:00
|
|
|
import Turbolinks from 'turbolinks';
|
2019-07-02 14:38:42 +02:00
|
|
|
import Rails from '@rails/ujs';
|
|
|
|
import * as ActiveStorage from '@rails/activestorage';
|
|
|
|
import '@rails/actiontext';
|
2019-11-25 14:17:04 +01:00
|
|
|
import 'whatwg-fetch'; // window.fetch polyfill
|
2018-07-12 11:50:47 +02:00
|
|
|
import Chartkick from 'chartkick';
|
|
|
|
import Highcharts from 'highcharts';
|
2019-08-14 13:11:36 +02:00
|
|
|
import ReactRailsUJS from 'react_ujs';
|
2018-07-12 11:50:47 +02:00
|
|
|
|
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';
|
2019-05-21 14:21:55 +02:00
|
|
|
import '../shared/activestorage/attachment-checker';
|
2018-07-12 11:50:47 +02:00
|
|
|
import '../shared/rails-ujs-fix';
|
2018-08-31 12:56:56 +02:00
|
|
|
import '../shared/safari-11-file-xhr-workaround';
|
2018-08-22 15:06:19 +02:00
|
|
|
import '../shared/autocomplete';
|
2018-08-28 16:42:16 +02:00
|
|
|
import '../shared/remote-input';
|
2018-10-02 16:54:08 +02:00
|
|
|
import '../shared/franceconnect';
|
2019-02-19 14:29:06 +01:00
|
|
|
import '../shared/toggle-target';
|
2018-07-12 11:50:47 +02:00
|
|
|
|
2018-09-11 17:51:44 +02:00
|
|
|
import '../new_design/dropdown';
|
2019-11-19 17:55:30 +01:00
|
|
|
import '../new_design/autosave';
|
2018-07-12 11:50:47 +02:00
|
|
|
import '../new_design/form-validation';
|
2019-04-01 15:04:11 +02:00
|
|
|
import '../new_design/procedure-context';
|
2019-10-21 18:12:57 +02:00
|
|
|
import '../new_design/procedure-form';
|
2018-08-22 14:47:56 +02:00
|
|
|
import '../new_design/select2';
|
2019-02-21 17:50:18 +01:00
|
|
|
import '../new_design/spinner';
|
|
|
|
import '../new_design/support';
|
2018-07-12 11:50:47 +02:00
|
|
|
|
2018-10-17 12:07:12 +02:00
|
|
|
import '../new_design/champs/carte';
|
2018-07-12 11:50:47 +02:00
|
|
|
import '../new_design/champs/linked-drop-down-list';
|
2019-01-30 16:14:15 +01:00
|
|
|
import '../new_design/champs/repetition';
|
2018-07-12 11:50:47 +02:00
|
|
|
|
|
|
|
import { toggleCondidentielExplanation } from '../new_design/avis';
|
|
|
|
import { scrollMessagerie } from '../new_design/messagerie';
|
2019-02-18 17:52:15 +01:00
|
|
|
import {
|
|
|
|
showMotivation,
|
|
|
|
motivationCancel,
|
|
|
|
showImportJustificatif
|
|
|
|
} from '../new_design/state-button';
|
2018-07-12 11:50:47 +02:00
|
|
|
import { toggleChart } from '../new_design/toggle-chart';
|
2018-11-29 17:03:32 +01:00
|
|
|
import { replaceSemicolonByComma } from '../new_design/avis';
|
2019-12-02 13:07:40 +01:00
|
|
|
import { acceptEmailSuggestion, discardEmailSuggestionBox } from '../new_design/user-sign_up';
|
2018-07-12 11:50:47 +02:00
|
|
|
|
|
|
|
// 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),
|
2018-07-12 11:50:47 +02:00
|
|
|
toggleCondidentielExplanation,
|
|
|
|
scrollMessagerie,
|
|
|
|
showMotivation,
|
|
|
|
motivationCancel,
|
2019-02-18 17:52:15 +01:00
|
|
|
showImportJustificatif,
|
2018-11-29 17:03:32 +01:00
|
|
|
toggleChart,
|
2019-12-02 13:07:40 +01:00
|
|
|
replaceSemicolonByComma,
|
|
|
|
acceptEmailSuggestion,
|
|
|
|
discardEmailSuggestionBox
|
2018-07-12 11:50:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// Start Rails helpers
|
|
|
|
Chartkick.addAdapter(Highcharts);
|
|
|
|
Rails.start();
|
|
|
|
Turbolinks.start();
|
|
|
|
ActiveStorage.start();
|
|
|
|
|
2019-08-14 13:11:36 +02:00
|
|
|
// If Turbolinks is imported via Webpacker (and thus not available globally),
|
|
|
|
// ReactRailsUJS will be unable to locate it.
|
|
|
|
// https://github.com/reactjs/react-rails#event-handling
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
ReactRailsUJS.useContext(require.context('components', true));
|
|
|
|
// Add Turbolinks to the global namespace:
|
|
|
|
window.Turbolinks = Turbolinks;
|
|
|
|
// Remove previous event handlers and add new ones:
|
|
|
|
ReactRailsUJS.detectEvents();
|
|
|
|
// (Optional) Clean up global namespace:
|
|
|
|
delete window.Turbolinks;
|
2019-03-13 15:31:59 +01:00
|
|
|
|
2018-07-12 11:50:47 +02:00
|
|
|
// Expose globals
|
|
|
|
window.DS = window.DS || DS;
|
|
|
|
window.Chartkick = Chartkick;
|