fix new prettier defaults
This commit is contained in:
parent
02b15e10cf
commit
43a1ead1cb
40 changed files with 111 additions and 122 deletions
|
@ -4,7 +4,7 @@ const PRIMARY_SELECTOR = 'select[data-secondary-options]';
|
|||
const SECONDARY_SELECTOR = 'select[data-secondary]';
|
||||
const CHAMP_SELECTOR = '.editable-champ';
|
||||
|
||||
delegate('change', PRIMARY_SELECTOR, evt => {
|
||||
delegate('change', PRIMARY_SELECTOR, (evt) => {
|
||||
const primary = evt.target;
|
||||
const secondary = primary
|
||||
.closest(CHAMP_SELECTOR)
|
||||
|
|
|
@ -4,7 +4,7 @@ const BUTTON_SELECTOR = '.button.remove-row';
|
|||
const DESTROY_INPUT_SELECTOR = 'input[type=hidden][name*=_destroy]';
|
||||
const CHAMP_SELECTOR = '.editable-champ';
|
||||
|
||||
delegate('click', BUTTON_SELECTOR, evt => {
|
||||
delegate('click', BUTTON_SELECTOR, (evt) => {
|
||||
evt.preventDefault();
|
||||
|
||||
const row = evt.target.closest('.row');
|
||||
|
|
|
@ -41,7 +41,7 @@ export default class AutoSaveController {
|
|||
headers: { Accept: 'application/json' }
|
||||
};
|
||||
|
||||
return window.fetch(form.action, fetchOptions).then(response => {
|
||||
return window.fetch(form.action, fetchOptions).then((response) => {
|
||||
if (response.ok) {
|
||||
resolve(response);
|
||||
} else {
|
||||
|
@ -64,7 +64,7 @@ export default class AutoSaveController {
|
|||
const fileInputs = form.querySelectorAll(
|
||||
'input[type="file"]:not([disabled]), .editable-champ-piece_justificative input:not([disabled])'
|
||||
);
|
||||
fileInputs.forEach(fileInput => (fileInput.disabled = true));
|
||||
fileInputs.forEach((fileInput) => (fileInput.disabled = true));
|
||||
|
||||
// Generate the form data
|
||||
let formData = null;
|
||||
|
@ -75,7 +75,7 @@ export default class AutoSaveController {
|
|||
return [null, error];
|
||||
} finally {
|
||||
// Re-enable disabled file inputs
|
||||
fileInputs.forEach(fileInput => (fileInput.disabled = false));
|
||||
fileInputs.forEach((fileInput) => (fileInput.disabled = false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ addEventListener('autosave:end', () => {
|
|||
hideSucceededStatusAfterDelay();
|
||||
});
|
||||
|
||||
addEventListener('autosave:error', event => {
|
||||
addEventListener('autosave:error', (event) => {
|
||||
enable(document.querySelector('button.autosave-retry'));
|
||||
setState('failed');
|
||||
logError(event.detail);
|
||||
|
|
|
@ -5,18 +5,18 @@ import { delegate } from '@utils';
|
|||
const autoUploadsControllers = new AutoUploadsControllers();
|
||||
|
||||
function startUpload(input) {
|
||||
Array.from(input.files).forEach(file => {
|
||||
Array.from(input.files).forEach((file) => {
|
||||
autoUploadsControllers.upload(input, file);
|
||||
});
|
||||
}
|
||||
|
||||
const fileInputSelector = `input[type=file][data-direct-upload-url][data-auto-attach-url]:not([disabled])`;
|
||||
delegate('change', fileInputSelector, event => {
|
||||
delegate('change', fileInputSelector, (event) => {
|
||||
startUpload(event.target);
|
||||
});
|
||||
|
||||
const retryButtonSelector = `button.attachment-error-retry`;
|
||||
delegate('click', retryButtonSelector, function() {
|
||||
delegate('click', retryButtonSelector, function () {
|
||||
const inputSelector = this.dataset.inputTarget;
|
||||
const input = document.querySelector(inputSelector);
|
||||
startUpload(input);
|
||||
|
|
|
@ -40,18 +40,18 @@ export default class AutoUploadsControllers {
|
|||
if (form) {
|
||||
form
|
||||
.querySelectorAll('button[type=submit]')
|
||||
.forEach(submitButton => Rails.disableElement(submitButton));
|
||||
.forEach((submitButton) => Rails.disableElement(submitButton));
|
||||
}
|
||||
|
||||
//
|
||||
// DEBUG: hook into FileReader onload event
|
||||
//
|
||||
if (FileReader.prototype.addEventListener === originalImpl) {
|
||||
FileReader.prototype.addEventListener = function() {
|
||||
FileReader.prototype.addEventListener = function () {
|
||||
// When DirectUploads attempts to add an event listener for "error",
|
||||
// also insert a custom event listener of our that will report errors to Sentry.
|
||||
if (arguments[0] == 'error') {
|
||||
let handler = event => {
|
||||
let handler = (event) => {
|
||||
let message = `FileReader ${event.target.error.name}: ${event.target.error.message}`;
|
||||
fire(document, 'sentry:capture-exception', new Error(message));
|
||||
};
|
||||
|
@ -71,7 +71,7 @@ export default class AutoUploadsControllers {
|
|||
if (this.inFlightUploadsCount == 0 && form) {
|
||||
form
|
||||
.querySelectorAll('button[type=submit]')
|
||||
.forEach(submitButton => Rails.enableElement(submitButton));
|
||||
.forEach((submitButton) => Rails.enableElement(submitButton));
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { delegate } from '@utils';
|
||||
|
||||
delegate('click', 'body', event => {
|
||||
delegate('click', 'body', (event) => {
|
||||
if (!event.target.closest('.dropdown')) {
|
||||
[...document.querySelectorAll('.dropdown')].forEach(element =>
|
||||
[...document.querySelectorAll('.dropdown')].forEach((element) =>
|
||||
element.classList.remove('open', 'fade-in-down')
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
delegate('click', '.dropdown-button', event => {
|
||||
delegate('click', '.dropdown-button', (event) => {
|
||||
event.stopPropagation();
|
||||
const parent = event.target.closest('.dropdown-button').parentElement;
|
||||
if (parent.classList.contains('dropdown')) {
|
||||
|
|
|
@ -5,15 +5,15 @@ import { isNumeric } from '@utils';
|
|||
const { api_geo_url, api_adresse_url } = gon.autocomplete || {};
|
||||
|
||||
const language = {
|
||||
errorLoading: function() {
|
||||
errorLoading: function () {
|
||||
return 'Les résultats ne peuvent pas être chargés.';
|
||||
},
|
||||
inputTooLong: function(args) {
|
||||
inputTooLong: function (args) {
|
||||
var overChars = args.input.length - args.maximum;
|
||||
|
||||
return 'Supprimez ' + overChars + ' caractère' + (overChars > 1 ? 's' : '');
|
||||
},
|
||||
inputTooShort: function(args) {
|
||||
inputTooShort: function (args) {
|
||||
var remainingChars = args.minimum - args.input.length;
|
||||
|
||||
return (
|
||||
|
@ -23,10 +23,10 @@ const language = {
|
|||
(remainingChars > 1 ? 's' : '')
|
||||
);
|
||||
},
|
||||
loadingMore: function() {
|
||||
loadingMore: function () {
|
||||
return 'Chargement de résultats supplémentaires…';
|
||||
},
|
||||
maximumSelected: function(args) {
|
||||
maximumSelected: function (args) {
|
||||
return (
|
||||
'Vous pouvez seulement sélectionner ' +
|
||||
args.maximum +
|
||||
|
@ -34,13 +34,13 @@ const language = {
|
|||
(args.maximum > 1 ? 's' : '')
|
||||
);
|
||||
},
|
||||
noResults: function() {
|
||||
noResults: function () {
|
||||
return 'Aucun résultat trouvé';
|
||||
},
|
||||
searching: function() {
|
||||
searching: function () {
|
||||
return 'Recherche en cours…';
|
||||
},
|
||||
removeAllItems: function() {
|
||||
removeAllItems: function () {
|
||||
return 'Supprimer tous les éléments';
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue