Issue #3091672 by alexpott: Fix javascript coding standards

(cherry picked from commit 0a69c9c580)
merge-requests/64/head
Lee Rowlands 2019-11-01 15:39:25 +10:00
parent 0712474d54
commit 98e3cac2a9
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
8 changed files with 12 additions and 26 deletions

View File

@ -231,9 +231,7 @@
* A string representing a DOM fragment. * A string representing a DOM fragment.
*/ */
dropbuttonToggle(options) { dropbuttonToggle(options) {
return `<li class="dropbutton-toggle"><button type="button"><span class="dropbutton-arrow"><span class="visually-hidden">${ return `<li class="dropbutton-toggle"><button type="button"><span class="dropbutton-arrow"><span class="visually-hidden">${options.title}</span></span></button></li>`;
options.title
}</span></span></button></li>`;
}, },
}, },
); );

View File

@ -56,11 +56,10 @@
// Attach summary for configurable filters (only for screen readers). // Attach summary for configurable filters (only for screen readers).
if (filterSettingsTab) { if (filterSettingsTab) {
filterSettingsTab.details.drupalSetSummary( filterSettingsTab.details.drupalSetSummary(() =>
() => $checkbox.is(':checked')
$checkbox.is(':checked') ? Drupal.t('Enabled')
? Drupal.t('Enabled') : Drupal.t('Disabled'),
: Drupal.t('Disabled'),
); );
} }

View File

@ -34,9 +34,7 @@
*/ */
Drupal.theme.quickeditEntityToolbar = function(settings) { Drupal.theme.quickeditEntityToolbar = function(settings) {
let html = ''; let html = '';
html += `<div id="${ html += `<div id="${settings.id}" class="quickedit quickedit-toolbar-container clearfix">`;
settings.id
}" class="quickedit quickedit-toolbar-container clearfix">`;
html += '<i class="quickedit-toolbar-pointer"></i>'; html += '<i class="quickedit-toolbar-pointer"></i>';
html += '<div class="quickedit-toolbar-content">'; html += '<div class="quickedit-toolbar-content">';
html += html +=

View File

@ -38,9 +38,8 @@
*/ */
function dateFormatHandler(e) { function dateFormatHandler(e) {
const baseValue = $(e.target).val() || ''; const baseValue = $(e.target).val() || '';
const dateString = baseValue.replace( const dateString = baseValue.replace(/\\?(.?)/gi, (key, value) =>
/\\?(.?)/gi, dateFormats[key] ? dateFormats[key] : value,
(key, value) => (dateFormats[key] ? dateFormats[key] : value),
); );
$preview.text(dateString); $preview.text(dateString);

View File

@ -197,8 +197,6 @@
* A string representing a DOM fragment. * A string representing a DOM fragment.
*/ */
Drupal.theme.toolbarMenuItemToggle = function(options) { Drupal.theme.toolbarMenuItemToggle = function(options) {
return `<button class="${options.class}"><span class="action">${ return `<button class="${options.class}"><span class="action">${options.action}</span> <span class="label">${options.text}</span></button>`;
options.action
}</span> <span class="label">${options.text}</span></button>`;
}; };
})(jQuery, Drupal, drupalSettings); })(jQuery, Drupal, drupalSettings);

View File

@ -47,9 +47,7 @@
// If the password strength indicator is enabled, add its markup. // If the password strength indicator is enabled, add its markup.
if (settings.password.showStrengthIndicator) { if (settings.password.showStrengthIndicator) {
const passwordMeter = `<div class="password-strength"><div class="password-strength__meter"><div class="password-strength__indicator js-password-strength__indicator"></div></div><div aria-live="polite" aria-atomic="true" class="password-strength__title">${ const passwordMeter = `<div class="password-strength"><div class="password-strength__meter"><div class="password-strength__indicator js-password-strength__indicator"></div></div><div aria-live="polite" aria-atomic="true" class="password-strength__title">${translate.strengthTitle} <span class="password-strength__text js-password-strength__text"></span></div></div>`;
translate.strengthTitle
} <span class="password-strength__text js-password-strength__text"></span></div></div>`;
$confirmInput $confirmInput
.parent() .parent()
.after('<div class="password-suggestions description"></div>'); .after('<div class="password-suggestions description"></div>');

View File

@ -11,7 +11,5 @@
* A string representing a DOM fragment. * A string representing a DOM fragment.
*/ */
Drupal.theme.passwordConfirmMessage = translate => Drupal.theme.passwordConfirmMessage = translate =>
`<div aria-live="polite" aria-atomic="true" class="password-confirm-message js-password-confirm-message">${ `<div aria-live="polite" aria-atomic="true" class="password-confirm-message js-password-confirm-message">${translate.confirmTitle} <span></span></div>`;
translate.confirmTitle
} <span></span></div>`;
})(Drupal); })(Drupal);

View File

@ -11,7 +11,5 @@
* A string representing a DOM fragment. * A string representing a DOM fragment.
*/ */
Drupal.theme.passwordConfirmMessage = translate => Drupal.theme.passwordConfirmMessage = translate =>
`<div aria-live="polite" aria-atomic="true" class="password-confirm js-password-confirm js-password-confirm-message">${ `<div aria-live="polite" aria-atomic="true" class="password-confirm js-password-confirm js-password-confirm-message">${translate.confirmTitle} <span></span></div>`;
translate.confirmTitle
} <span></span></div>`;
})(Drupal); })(Drupal);