remove unused javascript
This commit is contained in:
parent
e63993c07e
commit
95eb907090
3 changed files with 5 additions and 26 deletions
|
@ -1,6 +1,6 @@
|
||||||
import { scrollTo, scrollToBottom } from '@utils';
|
import { scrollTo, scrollToBottom } from '@utils';
|
||||||
|
|
||||||
export function scrollMessagerie() {
|
function scrollMessagerie() {
|
||||||
const ul = document.querySelector('.messagerie ul');
|
const ul = document.querySelector('.messagerie ul');
|
||||||
|
|
||||||
if (ul) {
|
if (ul) {
|
||||||
|
|
|
@ -29,14 +29,15 @@ import '../new_design/champs/carte';
|
||||||
import '../new_design/champs/linked-drop-down-list';
|
import '../new_design/champs/linked-drop-down-list';
|
||||||
import '../new_design/champs/repetition';
|
import '../new_design/champs/repetition';
|
||||||
|
|
||||||
import { toggleCondidentielExplanation } from '../new_design/avis';
|
import {
|
||||||
import { scrollMessagerie } from '../new_design/messagerie';
|
toggleCondidentielExplanation,
|
||||||
|
replaceSemicolonByComma
|
||||||
|
} from '../new_design/avis';
|
||||||
import {
|
import {
|
||||||
showMotivation,
|
showMotivation,
|
||||||
motivationCancel,
|
motivationCancel,
|
||||||
showImportJustificatif
|
showImportJustificatif
|
||||||
} from '../new_design/state-button';
|
} from '../new_design/state-button';
|
||||||
import { replaceSemicolonByComma } from '../new_design/avis';
|
|
||||||
import {
|
import {
|
||||||
acceptEmailSuggestion,
|
acceptEmailSuggestion,
|
||||||
discardEmailSuggestionBox
|
discardEmailSuggestionBox
|
||||||
|
@ -46,7 +47,6 @@ import {
|
||||||
const DS = {
|
const DS = {
|
||||||
fire: (eventName, data) => Rails.fire(document, eventName, data),
|
fire: (eventName, data) => Rails.fire(document, eventName, data),
|
||||||
toggleCondidentielExplanation,
|
toggleCondidentielExplanation,
|
||||||
scrollMessagerie,
|
|
||||||
showMotivation,
|
showMotivation,
|
||||||
motivationCancel,
|
motivationCancel,
|
||||||
showImportJustificatif,
|
showImportJustificatif,
|
||||||
|
|
|
@ -1,26 +1,5 @@
|
||||||
import Rails from '@rails/ujs';
|
|
||||||
import jQuery from 'jquery';
|
import jQuery from 'jquery';
|
||||||
|
|
||||||
// `smart_listing` gem is overriding `$.rails.href` method. When using newer
|
|
||||||
// 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, handleRemote } = Rails;
|
|
||||||
Rails.href = function (element) {
|
|
||||||
return element.href || href(element);
|
|
||||||
};
|
|
||||||
Rails.handleRemote = function (e) {
|
|
||||||
if (this instanceof HTMLElement) {
|
|
||||||
handleRemote.call(this, e);
|
|
||||||
} else {
|
|
||||||
let element = e.find('[data-remote]')[0];
|
|
||||||
let event = new CustomEvent('click');
|
|
||||||
Object.defineProperty(event, 'target', { value: element });
|
|
||||||
return handleRemote.call(element, event);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// rails-ujs installs CSRFProtection for its own ajax implementation. We might need
|
// rails-ujs installs CSRFProtection for its own ajax implementation. We might need
|
||||||
// CSRFProtection for jQuery initiated requests. This code is from jquery-ujs.
|
// CSRFProtection for jQuery initiated requests. This code is from jquery-ujs.
|
||||||
jQuery.ajaxPrefilter((options, originalOptions, xhr) => {
|
jQuery.ajaxPrefilter((options, originalOptions, xhr) => {
|
||||||
|
|
Loading…
Reference in a new issue