fix eslint warnings

This commit is contained in:
Simon Vieille 2021-06-23 09:39:51 +02:00
parent f0cfef5b94
commit 3b9a2dd46b
9 changed files with 31 additions and 29 deletions

View File

@ -17,7 +17,7 @@ module.exports = () => {
$.post(route, datas)
.always(() => {
document.location.href = document.location.href
document.location.reload()
})
})
}

View File

@ -3,6 +3,6 @@ const $ = require('jquery')
module.exports = function () {
$('*[data-jschoice]').each(function (key, item) {
new Choices(item)
return new Choices(item)
})
}

View File

@ -10,6 +10,12 @@ const isDateSupported = () => {
return input.value !== value
}
const createDatePicker = (input) => {
return new Datepicker.Datepicker(input, {
format: 'yyyy-mm-dd'
})
}
module.exports = () => {
if (isDateSupported()) {
return
@ -18,9 +24,7 @@ module.exports = () => {
const inputs = document.querySelectorAll('input[type="date"]')
const size = inputs.length
for (let i = 0, c = inputs.length; i < c; i++) {
new Datepicker.Datepicker(inputs[i], {
format: 'yyyy-mm-dd'
})
for (let i = 0, c = size; i < c; i++) {
createDatePicker(inputs[i])
}
}

View File

@ -2,7 +2,6 @@ const $ = require('jquery')
const DocumentSelector = () => {
const forms = $('.document-selector-form')
const btnSubmit = $('#download-archive-form button')
const handler = function () {
forms.each((fi, f) => {

View File

@ -44,7 +44,7 @@ const fileManagerBrowser = function (callback) {
$('body').on('click', '#file-manager-insert', clickCallback)
new Vue({
return new Vue({
el: '#fm-modal-content',
template: '<FileManager context="tinymce" />',
components: {
@ -53,10 +53,10 @@ const fileManagerBrowser = function (callback) {
})
}
if (typeof tinymce !== 'undefined') {
tinymce.murph = tinymce.murph || {}
tinymce.murph.selector = tinymce.murph.selector || '*[data-tinymce]'
tinymce.murph.configurationBase = tinymce.murph.configurationBase || {
if (typeof window.tinymce !== 'undefined') {
window.tinymce.murph = window.tinymce.murph || {}
window.tinymce.murph.selector = window.tinymce.murph.selector || '*[data-tinymce]'
window.tinymce.murph.configurationBase = window.tinymce.murph.configurationBase || {
base_url: '/vendor/tinymce/',
cache_suffix: '?v=4.1.6',
importcss_append: true,
@ -70,18 +70,18 @@ if (typeof tinymce !== 'undefined') {
file_picker_types: 'image',
init_instance_callback: function (editor) {
editor.on('SetContent', () => {
tinymce.triggerSave(false, true)
window.tinymce.triggerSave(false, true)
})
editor.on('Change', () => {
tinymce.triggerSave(false, true)
window.tinymce.triggerSave(false, true)
})
}
}
tinymce.murph.modes = tinymce.murph.modes || {}
window.tinymce.murph.modes = window.tinymce.murph.modes || {}
tinymce.murph.modes.default = tinymce.murph.modes.default || {
window.tinymce.murph.modes.default = window.tinymce.murph.modes.default || {
plugins: 'print preview importcss searchreplace visualblocks visualchars fullscreen template table charmap hr pagebreak nonbreaking toc insertdatetime advlist lists wordcount textpattern noneditable help charmap quickbars link image code autoresize',
menubar: 'file edit view insert format tools table tc help',
toolbar: 'undo redo | bold italic underline strikethrough | link image | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist checklist | forecolor backcolor casechange permanentpen formatpainter removeformat | pagebreak | charmap | fullscreen preview',
@ -89,7 +89,7 @@ if (typeof tinymce !== 'undefined') {
contextmenu: 'link image imagetools table configurepermanentpen'
}
tinymce.murph.modes.light = tinymce.murph.modes.light || {
window.tinymce.murph.modes.light = window.tinymce.murph.modes.light || {
contextmenu: 'link image imagetools table configurepermanentpen',
quickbars_selection_toolbar: 'bold italic',
toolbar: 'undo redo | bold italic underline'
@ -97,7 +97,7 @@ if (typeof tinymce !== 'undefined') {
}
const buildConfiguration = (conf) => {
return Object.assign({}, tinymce.murph.configurationBase, conf)
return Object.assign({}, window.tinymce.murph.configurationBase, conf)
}
const makeId = () => {
@ -113,7 +113,7 @@ const makeId = () => {
}
const doInitEditor = () => {
$(tinymce.murph.selector).each((i, v) => {
$(window.tinymce.murph.selector).each((i, v) => {
const element = $(v)
let id = null
@ -130,15 +130,15 @@ const doInitEditor = () => {
mode = 'default'
}
if (!tinymce.murph.modes.hasOwnProperty(mode)) {
if (!Object.prototype.hasOwnProperty.call(window.tinymce.murph.modes, mode)) {
return
}
const conf = buildConfiguration(tinymce.murph.modes[mode])
const conf = buildConfiguration(window.tinymce.murph.modes[mode])
conf.mode = 'exact'
conf.elements = id
tinymce.init(conf)
window.tinymce.init(conf)
})
}

View File

@ -7,7 +7,7 @@ module.exports = () => {
return
}
new Vue({
return new Vue({
el: '#file-manager',
template: '<FileManager context="crud" />',
components: {

View File

@ -44,7 +44,7 @@ const fileManagerBrowser = function (callback) {
$('body').on('click', '#file-manager-insert', clickCallback)
new Vue({
return new Vue({
el: '#fm-modal-content',
template: '<FileManager context="tinymce" />',
components: {

View File

@ -7,7 +7,6 @@ module.exports = function () {
const target = e.target
const form = $(target)
const data = new FormData(target)
const type = form.attr('enctype')
const method = form.attr('method')
const files = form.find('input[type=file]')
@ -22,11 +21,11 @@ module.exports = function () {
contentType: false,
type: method || 'GET',
success: function (data) {
if (data.hasOwnProperty('_dispatch')) {
if (Object.prototype.hasOwnProperty.call(data, '_dispatch')) {
$('body').trigger(data._dispatch)
}
if (data.hasOwnProperty('_message') && data.hasOwnProperty('_level')) {
if (Object.prototype.hasOwnProperty.call(data, '_message') && Object.prototype.hasOwnProperty.call(data, '_level')) {
const message = data._message
const level = data._level
const titles = {

View File

@ -6,7 +6,7 @@ module.exports = () => {
const element = $(list)
const route = element.attr('data-sortable-route')
new Sortable(list, {
return new Sortable(list, {
handle: '*[data-sortable-item]',
sort: true,
animation: 150,
@ -25,7 +25,7 @@ module.exports = () => {
$.post(route, datas)
.always((data) => {
document.location.href = document.location.href
document.location.reload()
})
}
})