Explicitly import jQuery
This commit is contained in:
parent
980d89dcac
commit
008d84f107
18 changed files with 28 additions and 12 deletions
|
@ -5,7 +5,6 @@ module.exports = {
|
|||
sourceType: 'module'
|
||||
},
|
||||
globals: {
|
||||
'$': true,
|
||||
'process': true
|
||||
},
|
||||
plugins: ['prettier'],
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Administrate injects its own copy of jQuery, and it is the one
|
||||
// configured by rails to send csrf-token
|
||||
const $ = window.$;
|
||||
// Administrate injects its own copy of jQuery
|
||||
/* globals $ */
|
||||
|
||||
$(document).on('change', '#features input[type=checkbox]', ({ target }) => {
|
||||
target = $(target);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
export function toggleCondidentielExplanation() {
|
||||
$('.confidentiel-explanation').toggle();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
$(document).on('click', 'body', () => {
|
||||
$('.button.dropdown').removeClass('open');
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import $ from 'jquery';
|
||||
import L from 'leaflet';
|
||||
|
||||
import { getData } from '../shared/data';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import $ from 'jquery';
|
||||
import Bloodhound from 'bloodhound-js';
|
||||
|
||||
const display = 'label';
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
function showNotFound() {
|
||||
$('.dossier-link .text-info').hide();
|
||||
$('.dossier-link .text-warning').show();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
addEventListener('turbolinks:load', () => {
|
||||
$('select.select2').select2({
|
||||
language: 'fr',
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
addEventListener('turbolinks:load', () => {
|
||||
$('[data-siret]').on('input', evt => {
|
||||
const input = $(evt.target);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
$(document).on('click', 'body', () => {
|
||||
$('.print-menu').removeClass('open fade-in-down');
|
||||
});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
$(document).on('blur keydown', 'input, textarea', () => {
|
||||
$(this).addClass('touched');
|
||||
});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
$(document).on('click', 'body', () => {
|
||||
$('.header-menu').removeClass('open fade-in-down');
|
||||
});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
export function scrollMessagerie() {
|
||||
const $ul = $('.messagerie ul').first();
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
export function showMotivation(state) {
|
||||
$(`.motivation.${state}`).show();
|
||||
$('.dropdown-items').hide();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import $ from 'jquery';
|
||||
import Chartkick from 'chartkick';
|
||||
|
||||
export function toggleChart(event, chartClass) {
|
||||
|
|
|
@ -31,5 +31,6 @@ if (process.env['RAILS_ENV'] === 'test') {
|
|||
window.Bloodhound = Bloodhound;
|
||||
window.Chartkick = Chartkick;
|
||||
// Export jQuery globally for legacy Javascript files used in the old design
|
||||
jQuery.rails = Rails;
|
||||
window.$ = jQuery;
|
||||
window.jQuery = jQuery;
|
||||
|
|
|
@ -19,8 +19,8 @@ Rails.delegate(document, '[data-remote]', 'ajax:send', ({ target }) => {
|
|||
// jQuery-less version of rails-ujs it breaks.
|
||||
// https://github.com/Sology/smart_listing/blob/master/app/assets/javascripts/smart_listing.coffee.erb#L9
|
||||
addEventListener('load', () => {
|
||||
const { href } = $.rails;
|
||||
$.rails.href = function(element) {
|
||||
const { href } = Rails;
|
||||
Rails.href = function(element) {
|
||||
return element.href || href(element);
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
const { environment } = require('@rails/webpacker')
|
||||
|
||||
const webpack = require('webpack');
|
||||
environment.plugins.append('Provide', new webpack.ProvidePlugin({
|
||||
$: 'jquery',
|
||||
jQuery: 'jquery'
|
||||
}));
|
||||
|
||||
module.exports = environment
|
||||
|
|
Loading…
Reference in a new issue