diff --git a/.eslintrc.js b/.eslintrc.js index 2a31d7ed1..222015c99 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -13,7 +13,6 @@ module.exports = { "plugin:vue/recommended", "plugin:prettier/recommended", "prettier", - "prettier/vue", ], rules: { "no-console": ["error", {allow: ["error", "warn"]}], @@ -34,4 +33,4 @@ module.exports = { } } } -}; \ No newline at end of file +}; diff --git a/assets/js/app/common.js b/assets/js/app/common.js index 7c89f8372..9ce714150 100644 --- a/assets/js/app/common.js +++ b/assets/js/app/common.js @@ -1,10 +1,11 @@ import $ from 'jquery'; import { DateTime } from 'luxon'; +import { Popover } from 'bootstrap'; import { version } from '../version'; window.assetsVersion = version; -$(document).ready(function() { +$(document).ready(function () { // add a js class to indicate we have JS enabled. Might need a change to either modernizr or somethng comparable $('html').addClass('js'); @@ -16,16 +17,12 @@ $(document).ready(function() { */ $('.admin__sidebar').addClass('admin__sidebar--is-collapsed'); - $('.admin-sidebar-toggler').on('click', function() { + $('.admin-sidebar-toggler').on('click', function () { if ($('.admin__sidebar').hasClass('admin__sidebar--is-collapsed')) { - $('.admin__sidebar') - .addClass('admin__sidebar--is-expanded') - .removeClass('admin__sidebar--is-collapsed'); + $('.admin__sidebar').addClass('admin__sidebar--is-expanded').removeClass('admin__sidebar--is-collapsed'); $(this).toggleClass('is-active'); } else { - $('.admin__sidebar') - .addClass('admin__sidebar--is-collapsed') - .removeClass('admin__sidebar--is-expanded'); + $('.admin__sidebar').addClass('admin__sidebar--is-collapsed').removeClass('admin__sidebar--is-expanded'); $(this).toggleClass('is-active'); } }); @@ -45,7 +42,7 @@ $(document).ready(function() { }, 50); } - $('a[data-toggle="pill"]').on('click', function() { + $('a[data-toggle="pill"]').on('click', function () { let newUrl; const hash = $(this).attr('href'); newUrl = url.split('#')[0] + hash; @@ -55,20 +52,23 @@ $(document).ready(function() { /* ** Convert all ISO dates with class .datetime-relative to relative time */ - $('.datetime-relative').each(function() { + $('.datetime-relative').each(function () { $(this).text(DateTime.fromISO($(this).text()).toRelative()); }); /* ** Initialise all popover elements */ - $('[data-toggle="popover"]').popover(); + var popoverEl = document.getElementsByClassName('.fa.fa-info-circle'); + if (popoverEl > 0) { + new Popover(popoverEl); + } /* ** When a field from another group is invalid, show it. */ - $('#editor button[type="submit"]').click(function() { - $('input:invalid').each(function() { + $('#editor button[type="submit"]').click(function () { + $('input:invalid').each(function () { // Find the tab-pane that this element is inside, and get the id var $closest = $(this).closest('.tab-pane'); var id = $closest.attr('id'); @@ -85,20 +85,15 @@ $(document).ready(function() { ** Simulates disabled behavior for elements with data-readonly attribute. * This is needed, because a disabled input cannot be required. */ - $('[data-readonly]').on('keydown paste', function(e) { + $('[data-readonly]').on('keydown paste', function (e) { e.preventDefault(); }); /* Part of the code above, however make sure flatpickr is not readonly * and that its validation works. */ - $('.editor--date') - .siblings() - .prop('readonly', false) - .attr('data-readonly', 'readonly'); - $('.editor--date').on('change', e => { - const target = $(e.target) - .parent() - .find('input[data-readonly="readonly"]'); + $('.editor--date').siblings().prop('readonly', false).attr('data-readonly', 'readonly'); + $('.editor--date').on('change', (e) => { + const target = $(e.target).parent().find('input[data-readonly="readonly"]'); if (target.val()) { target[0].setCustomValidity(''); } else { @@ -124,15 +119,12 @@ $(document).ready(function() { $('[data-errormessage]').on('input', handleInput); /* Set the errormessage on the correct editor--date field */ - $('.editor--date').each(function() { + $('.editor--date').each(function () { let siblings = $(this).siblings(); const errormessage = $(this).attr('data-errormessage'); - siblings.each(function() { - $(this) - .attr('data-errormessage', errormessage) - .on('invalid', handleInvalid) - .on('input', handleInput); + siblings.each(function () { + $(this).attr('data-errormessage', errormessage).on('invalid', handleInvalid).on('input', handleInput); }); }); /* End of custom error message */ @@ -140,7 +132,7 @@ $(document).ready(function() { /* ** Copy text to clipboard. Used in filemanager actions. */ - $('[data-copy-to-clipboard]').on('click', function(e) { + $('[data-copy-to-clipboard]').on('click', function (e) { const target = $(e.target); var input = document.createElement('input'); @@ -151,10 +143,7 @@ $(document).ready(function() { input.focus(); input.select(); document.execCommand('copy'); - target - .parent() - .find('#copy') - .remove(); + target.parent().find('#copy').remove(); }); /* End of copy text to clipboard */ }); diff --git a/assets/js/app/confirmation.js b/assets/js/app/confirmation.js index 386561d01..30964bca0 100644 --- a/assets/js/app/confirmation.js +++ b/assets/js/app/confirmation.js @@ -13,13 +13,13 @@ if (locale) { bootbox.setLocale(locale); } -$('*[data-confirmation]').on('click', function() { +$('*[data-confirmation]').on('click', function () { const thisElem = $(this); const thisHref = $(this).attr('href'); const confirmation = $(this).data('confirmation'); if (!thisElem.data('confirmed')) { - bootbox.confirm(confirmation, function(result) { + bootbox.confirm(confirmation, function (result) { if (result && thisHref) { window.location = thisHref; } diff --git a/assets/js/app/editor/Components/Collection.vue b/assets/js/app/editor/Components/Collection.vue index ad9ecfec5..9f8c2d2f0 100644 --- a/assets/js/app/editor/Components/Collection.vue +++ b/assets/js/app/editor/Components/Collection.vue @@ -14,7 +14,7 @@ - + {{ log(elements) }}
-
+
+ + + +
-
-

{{ labels.add_collection_item }}:

- @@ -85,9 +104,32 @@ diff --git a/assets/js/app/editor/Components/Email.vue b/assets/js/app/editor/Components/Email.vue index 982a5c973..ee9dbccb2 100644 --- a/assets/js/app/editor/Components/Email.vue +++ b/assets/js/app/editor/Components/Email.vue @@ -13,7 +13,7 @@ :required="required" :readonly="readonly" :data-errormessage="errormessage" - :pattern="pattern" + :pattern="pattern ? pattern : null" :placeholder="placeholder" />
@@ -39,13 +39,9 @@ export default { readonly: { type: Boolean, }, - errormessage: { - type: String | Boolean, //string if errormessage is set, and false otherwise - }, - pattern: { - type: String | Boolean, - }, - placeholder: String | Boolean, + errormessage: [String, Boolean], + pattern: [String, Boolean], + placeholder: [String, Boolean], }, }; diff --git a/assets/js/app/editor/Components/Embed.vue b/assets/js/app/editor/Components/Embed.vue index 3e9c4010d..ab2deda92 100644 --- a/assets/js/app/editor/Components/Embed.vue +++ b/assets/js/app/editor/Components/Embed.vue @@ -17,7 +17,7 @@ :required="required" :readonly="readonly" :data-errormessage="errormessage" - :pattern="pattern" + :pattern="pattern ? pattern : null" />