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