Load chartkick and highcharts only on stat pages

This commit is contained in:
Paul Chavard 2020-02-20 19:01:23 +01:00
parent 655e8bc849
commit d8eb3ebb94
8 changed files with 29 additions and 18 deletions

View file

@ -4,8 +4,6 @@ import Rails from '@rails/ujs';
import * as ActiveStorage from '@rails/activestorage';
import '@rails/actiontext';
import 'whatwg-fetch'; // window.fetch polyfill
import Chartkick from 'chartkick';
import Highcharts from 'highcharts';
import ReactRailsUJS from 'react_ujs';
import '../shared/page-update-event';
@ -37,7 +35,6 @@ import {
motivationCancel,
showImportJustificatif
} from '../new_design/state-button';
import { toggleChart } from '../new_design/toggle-chart';
import { replaceSemicolonByComma } from '../new_design/avis';
import {
acceptEmailSuggestion,
@ -52,21 +49,18 @@ const DS = {
showMotivation,
motivationCancel,
showImportJustificatif,
toggleChart,
replaceSemicolonByComma,
acceptEmailSuggestion,
discardEmailSuggestionBox
};
// Start Rails helpers
Chartkick.addAdapter(Highcharts);
Rails.start();
Turbolinks.start();
ActiveStorage.start();
// Expose globals
window.DS = window.DS || DS;
window.Chartkick = Chartkick;
// (Both Rails redirects and ReactRailsUJS expect Turbolinks to be globally available)
window.Turbolinks = Turbolinks;