From 84b815d0a06dd71dc246726d041d08a08b8e6c1f Mon Sep 17 00:00:00 2001
From: Sabina Talipova <87288324+sabina-talipova@users.noreply.github.com>
Date: Mon, 10 Jul 2023 09:47:20 +1200
Subject: [PATCH] MNT ESLint issues (#714)
---
client/src/bundles/cms.js | 178 ++++++++++----------
client/src/bundles/gridfieldaddbydbfield.js | 20 +--
2 files changed, 99 insertions(+), 99 deletions(-)
diff --git a/client/src/bundles/cms.js b/client/src/bundles/cms.js
index 1729370..dc57629 100644
--- a/client/src/bundles/cms.js
+++ b/client/src/bundles/cms.js
@@ -2,141 +2,141 @@
import jQuery from 'jquery';
jQuery.entwine('ss', ($) => {
- /**
+ /**
* The page success/error message sits outside of the html block
* containing the sidebar and cms fields. This means it overflows
* underneath the sidebar.
*
* @see https://github.com/silverstripe/silverstripe-blog/issues/210
*/
- $('.cms-content-fields > #Form_EditForm_error').entwine({
- onadd() {
- const $target = $('.blog-admin-outer');
- if ($target.length === 1) {
- $target.prepend(this);
- }
- }
- });
+ $('.cms-content-fields > #Form_EditForm_error').entwine({
+ onadd() {
+ const $target = $('.blog-admin-outer');
+ if ($target.length === 1) {
+ $target.prepend(this);
+ }
+ }
+ });
- /**
+ /**
* Register expandable help text functions with fields.
*/
- $('.toggle-description').entwine({
- onadd() {
- const $this = $(this);
+ $('.toggle-description').entwine({
+ onadd() {
+ const $this = $(this);
- /**
+ /**
* Prevent multiple events being added.
*/
- if ($this.hasClass('toggle-description-enabled')) {
- return;
- }
+ if ($this.hasClass('toggle-description-enabled')) {
+ return;
+ }
- $this.addClass('toggle-description-enabled');
+ $this.addClass('toggle-description-enabled');
- /**
+ /**
* Toggle next description when button is clicked.
*/
- let shown = false;
- const $helpInfo = $this.closest('.field').find('.form-text');
+ let shown = false;
+ const $helpInfo = $this.closest('.field').find('.form-text');
- $this.on('click', () => {
- $helpInfo[shown ? 'hide' : 'show']();
- $this.toggleClass('toggle-description-shown');
- shown = !shown;
- });
+ $this.on('click', () => {
+ $helpInfo[shown ? 'hide' : 'show']();
+ $this.toggleClass('toggle-description-shown');
+ shown = !shown;
+ });
- /**
+ /**
* Hide next description by default.
*/
- $helpInfo.hide();
+ $helpInfo.hide();
- /**
+ /**
* Add classes to correct inherited layout issues in a small context.
*/
- $this.parent().addClass('toggle-description-correct-right');
- $this.parent().prev('.middleColumn').addClass('toggle-description-correct-middle');
- $this.parent().next('.description').addClass('toggle-description-correct-description');
- }
- });
+ $this.parent().addClass('toggle-description-correct-right');
+ $this.parent().prev('.middleColumn').addClass('toggle-description-correct-middle');
+ $this.parent().next('.description').addClass('toggle-description-correct-description');
+ }
+ });
- /**
+ /**
* Custom merge actions for tags and categories
*/
- $('.MergeAction').entwine({
- onadd() {
- const $this = $(this);
+ $('.MergeAction').entwine({
+ onadd() {
+ const $this = $(this);
- $this.on('click', 'select', () => false);
+ $this.on('click', 'select', () => false);
- $this.children('button').each((i, button) => {
- const $button = $(button);
- const $select = $button.prev('select');
+ $this.children('button').each((i, button) => {
+ const $button = $(button);
+ const $select = $button.prev('select');
- $button.before(``);
- });
+ $button.before(``);
+ });
- $this.on('change', 'select', (e) => {
- const $target = $(e.target);
+ $this.on('change', 'select', (e) => {
+ const $target = $(e.target);
- $target.next('input').val($target.val());
- });
+ $target.next('input').val($target.val());
+ });
- $this.children('button, select').hide();
+ $this.children('button, select').hide();
- $this.on('click', '.MergeActionReveal', (e) => {
- const $target = $(e.target);
+ $this.on('click', '.MergeActionReveal', (e) => {
+ const $target = $(e.target);
- $target.parent().children('button, select').show();
- $target.hide();
+ $target.parent().children('button, select').show();
+ $target.hide();
- return false;
- });
- }
- });
+ return false;
+ });
+ }
+ });
- /**
+ /**
* Customise the cms-panel behaviour for blog sidebar
*
* see LeftAndMain.Panel.js for base behaviour
*/
- $('.blog-admin-sidebar.cms-panel').entwine({
- MinInnerWidth: 620,
- onadd() {
- this._super();
- this.updateLayout();
+ $('.blog-admin-sidebar.cms-panel').entwine({
+ MinInnerWidth: 620,
+ onadd() {
+ this._super();
+ this.updateLayout();
- // Contract panel if it's open and the left hand column is smaller than the minimum
- if (!this.hasClass('collapsed') && ($('.blog-admin-outer').width() < this.getMinInnerWidth())) {
- this.collapsePanel();
- }
+ // Contract panel if it's open and the left hand column is smaller than the minimum
+ if (!this.hasClass('collapsed') && ($('.blog-admin-outer').width() < this.getMinInnerWidth())) {
+ this.collapsePanel();
+ }
- const onresize = () => {
- this.updateLayout();
- };
- onresize.bind(this);
+ const onresize = () => {
+ this.updateLayout();
+ };
+ onresize.bind(this);
- window.onresize = onresize;
- },
- togglePanel(bool, silent) {
- this._super(bool, silent);
- this.updateLayout();
- },
- /**
+ window.onresize = onresize;
+ },
+ togglePanel(bool, silent) {
+ this._super(bool, silent);
+ this.updateLayout();
+ },
+ /**
* Adjust minimum width of content to account for extra panel
*
* @returns {undefined}
*/
- updateLayout() {
- $(this).css('height', '100%');
- const currentHeight = $(this).outerHeight();
- const bottomHeight = $('.cms-content-actions').eq(0).outerHeight();
- $(this).css('height', `${currentHeight - bottomHeight}px`);
- $(this).css('bottom', `${bottomHeight}px`);
+ updateLayout() {
+ $(this).css('height', '100%');
+ const currentHeight = $(this).outerHeight();
+ const bottomHeight = $('.cms-content-actions').eq(0).outerHeight();
+ $(this).css('height', `${currentHeight - bottomHeight}px`);
+ $(this).css('bottom', `${bottomHeight}px`);
- $('.cms-container').updateLayoutOptions({
- minContentWidth: 820 + this.width()
- });
- }
- });
+ $('.cms-container').updateLayoutOptions({
+ minContentWidth: 820 + this.width()
+ });
+ }
+ });
});
diff --git a/client/src/bundles/gridfieldaddbydbfield.js b/client/src/bundles/gridfieldaddbydbfield.js
index c9acbdb..1fbfcfa 100644
--- a/client/src/bundles/gridfieldaddbydbfield.js
+++ b/client/src/bundles/gridfieldaddbydbfield.js
@@ -1,16 +1,16 @@
import jQuery from 'jquery';
jQuery.entwine('ss', ($) => {
- /**
+ /**
* Prevent the CMS hijacking the return key
*/
- $('.add-existing-autocompleter input.text').entwine({
- onkeydown(e) {
- if (e.which === 13) {
- const $parent = $(this).parents('.add-existing-autocompleter');
- $parent.find('button[type="submit"]').click();
- e.preventDefault();
- }
- }
- });
+ $('.add-existing-autocompleter input.text').entwine({
+ onkeydown(e) {
+ if (e.which === 13) {
+ const $parent = $(this).parents('.add-existing-autocompleter');
+ $parent.find('button[type="submit"]').click();
+ e.preventDefault();
+ }
+ }
+ });
});