Skip to content

Commit e65f446

Browse files
committed
ESLint update
1 parent aca4b12 commit e65f446

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+169
-195
lines changed

assets/js/app/common.js

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Popover } from 'bootstrap';
55
import { version } from '../version';
66
window.assetsVersion = version;
77

8-
$(document).ready(function() {
8+
$(document).ready(function () {
99
// add a js class to indicate we have JS enabled. Might need a change to either modernizr or somethng comparable
1010
$('html').addClass('js');
1111

@@ -17,16 +17,12 @@ $(document).ready(function() {
1717
*/
1818
$('.admin__sidebar').addClass('admin__sidebar--is-collapsed');
1919

20-
$('.admin-sidebar-toggler').on('click', function() {
20+
$('.admin-sidebar-toggler').on('click', function () {
2121
if ($('.admin__sidebar').hasClass('admin__sidebar--is-collapsed')) {
22-
$('.admin__sidebar')
23-
.addClass('admin__sidebar--is-expanded')
24-
.removeClass('admin__sidebar--is-collapsed');
22+
$('.admin__sidebar').addClass('admin__sidebar--is-expanded').removeClass('admin__sidebar--is-collapsed');
2523
$(this).toggleClass('is-active');
2624
} else {
27-
$('.admin__sidebar')
28-
.addClass('admin__sidebar--is-collapsed')
29-
.removeClass('admin__sidebar--is-expanded');
25+
$('.admin__sidebar').addClass('admin__sidebar--is-collapsed').removeClass('admin__sidebar--is-expanded');
3026
$(this).toggleClass('is-active');
3127
}
3228
});
@@ -46,7 +42,7 @@ $(document).ready(function() {
4642
}, 50);
4743
}
4844

49-
$('a[data-toggle="pill"]').on('click', function() {
45+
$('a[data-toggle="pill"]').on('click', function () {
5046
let newUrl;
5147
const hash = $(this).attr('href');
5248
newUrl = url.split('#')[0] + hash;
@@ -56,23 +52,23 @@ $(document).ready(function() {
5652
/*
5753
** Convert all ISO dates with class .datetime-relative to relative time
5854
*/
59-
$('.datetime-relative').each(function() {
55+
$('.datetime-relative').each(function () {
6056
$(this).text(DateTime.fromISO($(this).text()).toRelative());
6157
});
6258

6359
/*
6460
** Initialise all popover elements
6561
*/
66-
62+
6763
var popoverEl = document.getElementsByClassName('.fa.fa-info-circle');
6864
if (popoverEl > 0) {
6965
new Popover(popoverEl);
7066
}
7167
/*
7268
** When a field from another group is invalid, show it.
7369
*/
74-
$('#editor button[type="submit"]').click(function() {
75-
$('input:invalid').each(function() {
70+
$('#editor button[type="submit"]').click(function () {
71+
$('input:invalid').each(function () {
7672
// Find the tab-pane that this element is inside, and get the id
7773
var $closest = $(this).closest('.tab-pane');
7874
var id = $closest.attr('id');
@@ -89,20 +85,15 @@ $(document).ready(function() {
8985
** Simulates disabled behavior for elements with data-readonly attribute.
9086
* This is needed, because a disabled input cannot be required.
9187
*/
92-
$('[data-readonly]').on('keydown paste', function(e) {
88+
$('[data-readonly]').on('keydown paste', function (e) {
9389
e.preventDefault();
9490
});
9591
/* Part of the code above, however make sure flatpickr is not readonly
9692
* and that its validation works.
9793
*/
98-
$('.editor--date')
99-
.siblings()
100-
.prop('readonly', false)
101-
.attr('data-readonly', 'readonly');
102-
$('.editor--date').on('change', e => {
103-
const target = $(e.target)
104-
.parent()
105-
.find('input[data-readonly="readonly"]');
94+
$('.editor--date').siblings().prop('readonly', false).attr('data-readonly', 'readonly');
95+
$('.editor--date').on('change', (e) => {
96+
const target = $(e.target).parent().find('input[data-readonly="readonly"]');
10697
if (target.val()) {
10798
target[0].setCustomValidity('');
10899
} else {
@@ -128,23 +119,20 @@ $(document).ready(function() {
128119
$('[data-errormessage]').on('input', handleInput);
129120

130121
/* Set the errormessage on the correct editor--date field */
131-
$('.editor--date').each(function() {
122+
$('.editor--date').each(function () {
132123
let siblings = $(this).siblings();
133124
const errormessage = $(this).attr('data-errormessage');
134125

135-
siblings.each(function() {
136-
$(this)
137-
.attr('data-errormessage', errormessage)
138-
.on('invalid', handleInvalid)
139-
.on('input', handleInput);
126+
siblings.each(function () {
127+
$(this).attr('data-errormessage', errormessage).on('invalid', handleInvalid).on('input', handleInput);
140128
});
141129
});
142130
/* End of custom error message */
143131

144132
/*
145133
** Copy text to clipboard. Used in filemanager actions.
146134
*/
147-
$('[data-copy-to-clipboard]').on('click', function(e) {
135+
$('[data-copy-to-clipboard]').on('click', function (e) {
148136
const target = $(e.target);
149137

150138
var input = document.createElement('input');
@@ -155,10 +143,7 @@ $(document).ready(function() {
155143
input.focus();
156144
input.select();
157145
document.execCommand('copy');
158-
target
159-
.parent()
160-
.find('#copy')
161-
.remove();
146+
target.parent().find('#copy').remove();
162147
});
163148
/* End of copy text to clipboard */
164149
});

assets/js/app/confirmation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ if (locale) {
1313
bootbox.setLocale(locale);
1414
}
1515

16-
$('*[data-confirmation]').on('click', function() {
16+
$('*[data-confirmation]').on('click', function () {
1717
const thisElem = $(this);
1818
const thisHref = $(this).attr('href');
1919
const confirmation = $(this).data('confirmation');
2020

2121
if (!thisElem.data('confirmed')) {
22-
bootbox.confirm(confirmation, function(result) {
22+
bootbox.confirm(confirmation, function (result) {
2323
if (result && thisHref) {
2424
window.location = thisHref;
2525
}

assets/js/app/editor/Components/Embed.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ export default {
147147
};
148148
},
149149
watch: {
150-
urlData: function() {
150+
urlData: function () {
151151
this.updateEmbed();
152152
},
153153
},
154154
mounted() {
155155
this.previewImage = this.thumbnail;
156156
},
157-
created: function() {
157+
created: function () {
158158
this.debouncedFetchEmbed = _.debounce(this.fetchEmbed, 500);
159159
if (this.urlData) {
160160
this.updateEmbed();
@@ -172,21 +172,21 @@ export default {
172172
});
173173
},
174174
methods: {
175-
updateEmbed: function() {
175+
updateEmbed: function () {
176176
this.loading = true;
177177
this.debouncedFetchEmbed();
178178
},
179-
clearEmbed: function() {
179+
clearEmbed: function () {
180180
this.urlData = '';
181181
},
182-
fetchEmbed: function() {
182+
fetchEmbed: function () {
183183
const body = new FormData();
184184
body.append('url', this.urlData);
185185
body.append('_csrf_token', document.getElementsByName('_csrf_token')[0].value);
186186
187187
fetch(this.embedapi, { method: 'POST', body: body })
188-
.then(response => response.json())
189-
.then(json => {
188+
.then((response) => response.json())
189+
.then((json) => {
190190
this.authorurlData = json.author_url;
191191
this.authornameData = json.author_name;
192192
this.heightData = json.height;
@@ -197,7 +197,7 @@ export default {
197197
this.widthData = json.width;
198198
this.previewImage = json.thumbnail_url;
199199
})
200-
.catch(err => {
200+
.catch((err) => {
201201
console.warn(err);
202202
})
203203
.finally(() => {

assets/js/app/editor/Components/File.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export default {
184184
return this.csrfToken;
185185
},
186186
acceptedExtensions() {
187-
return this.extensions.map(ext => '.' + ext).join();
187+
return this.extensions.map((ext) => '.' + ext).join();
188188
},
189189
getPlaceholder() {
190190
if (this.placeholder) {
@@ -212,12 +212,12 @@ export default {
212212
selectServerFile() {
213213
let thisField = this;
214214
Axios.get(this.filelist)
215-
.then(res => {
215+
.then((res) => {
216216
bootbox.prompt({
217217
title: 'Select a file',
218218
inputType: 'select',
219219
inputOptions: this.filterServerFiles(res.data),
220-
callback: function(result) {
220+
callback: function (result) {
221221
if (result) {
222222
thisField.filenameData = result;
223223
}
@@ -226,7 +226,7 @@ export default {
226226
window.$('.bootbox-input').attr('name', 'bootbox-input');
227227
window.reEnablePatientButtons();
228228
})
229-
.catch(err => {
229+
.catch((err) => {
230230
console.warn(err);
231231
window.reEnablePatientButtons();
232232
});
@@ -253,7 +253,7 @@ export default {
253253
uploadFile(file) {
254254
const fd = new FormData();
255255
const config = {
256-
onUploadProgress: progressEvent => {
256+
onUploadProgress: (progressEvent) => {
257257
const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
258258
this.progress = percentCompleted;
259259
},
@@ -264,11 +264,11 @@ export default {
264264
fd.append('file', file);
265265
fd.append('_csrf_token', this.token);
266266
Axios.post(this.directory, fd, config)
267-
.then(res => {
267+
.then((res) => {
268268
this.filenameData = res.data;
269269
this.progress = 0;
270270
})
271-
.catch(err => {
271+
.catch((err) => {
272272
const responseData = err.response.data;
273273
let errorMessage = 'unknown error';
274274
if (typeof responseData === 'string' || responseData instanceof String) {
@@ -283,7 +283,7 @@ export default {
283283
},
284284
filterServerFiles(files) {
285285
let self = this;
286-
return files.filter(function(file) {
286+
return files.filter(function (file) {
287287
let ext = /(?:\.([^.]+))?$/.exec(file.text)[1];
288288
return self.extensions.includes(ext);
289289
});

assets/js/app/editor/Components/Filelist.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import File from './File';
3939
4040
export default {
4141
name: 'EditorFileList',
42-
components: { 'EditorFile': File },
42+
components: { EditorFile: File },
4343
props: {
4444
files: Array,
4545
directory: String,
@@ -52,10 +52,10 @@ export default {
5252
limit: Number,
5353
readonly: Boolean,
5454
},
55-
data: function() {
55+
data: function () {
5656
let counter = 0;
5757
let containerFiles = this.files;
58-
containerFiles.forEach(function(file, index, theContainerFilesArray) {
58+
containerFiles.forEach(function (file, index, theContainerFilesArray) {
5959
theContainerFilesArray[index].id = index;
6060
counter++;
6161
});
@@ -66,7 +66,7 @@ export default {
6666
};
6767
},
6868
computed: {
69-
allowMore: function() {
69+
allowMore: function () {
7070
if (this.readonly) {
7171
return false;
7272
}

assets/js/app/editor/Components/Html.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<script>
88
import trumbowyg from 'vue-trumbowyg';
9-
import { formatStrip } from '../../../filters/string'
9+
import { formatStrip } from '../../../filters/string';
1010
import 'trumbowyg/dist/ui/trumbowyg.css';
1111
1212
export default {

0 commit comments

Comments
 (0)