X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Flocale%2Flocale.admin.es6.js;h=47db4bd650c4d682eb74d44b2eb71189bbdd4656;hb=9424afc6c1f518c301bf87a23c047d1873435d05;hp=90b983e9fa2fc524fe0057ad4a0c1c3336ec565d;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/web/core/modules/locale/locale.admin.es6.js b/web/core/modules/locale/locale.admin.es6.js index 90b983e9f..47db4bd65 100644 --- a/web/core/modules/locale/locale.admin.es6.js +++ b/web/core/modules/locale/locale.admin.es6.js @@ -3,7 +3,7 @@ * Locale admin behavior. */ -(function ($, Drupal) { +(function($, Drupal) { /** * Marks changes of translations. * @@ -16,16 +16,22 @@ */ Drupal.behaviors.localeTranslateDirty = { attach() { - const $form = $('#locale-translate-edit-form').once('localetranslatedirty'); + const $form = $('#locale-translate-edit-form').once( + 'localetranslatedirty', + ); if ($form.length) { // Display a notice if any row changed. - $form.one('formUpdated.localeTranslateDirty', 'table', function () { - const $marker = $(Drupal.theme('localeTranslateChangedWarning')).hide(); - $(this).addClass('changed').before($marker); + $form.one('formUpdated.localeTranslateDirty', 'table', function() { + const $marker = $( + Drupal.theme('localeTranslateChangedWarning'), + ).hide(); + $(this) + .addClass('changed') + .before($marker); $marker.fadeIn('slow'); }); // Highlight changed row. - $form.on('formUpdated.localeTranslateDirty', 'tr', function () { + $form.on('formUpdated.localeTranslateDirty', 'tr', function() { const $row = $(this); const $rowToMark = $row.once('localemark'); const marker = Drupal.theme('localeTranslateChangedMarker'); @@ -40,7 +46,9 @@ }, detach(context, settings, trigger) { if (trigger === 'unload') { - const $form = $('#locale-translate-edit-form').removeOnce('localetranslatedirty'); + const $form = $('#locale-translate-edit-form').removeOnce( + 'localetranslatedirty', + ); if ($form.length) { $form.off('formUpdated.localeTranslateDirty'); } @@ -58,12 +66,14 @@ */ Drupal.behaviors.hideUpdateInformation = { attach(context, settings) { - const $table = $('#locale-translation-status-form').once('expand-updates'); + const $table = $('#locale-translation-status-form').once( + 'expand-updates', + ); if ($table.length) { const $tbodies = $table.find('tbody'); // Open/close the description details by toggling a tr class. - $tbodies.on('click keydown', '.description', function (e) { + $tbodies.on('click keydown', '.description', function(e) { if (e.keyCode && (e.keyCode !== 13 && e.keyCode !== 32)) { return; } @@ -86,26 +96,34 @@ }, }; - $.extend(Drupal.theme, /** @lends Drupal.theme */{ + $.extend( + Drupal.theme, + /** @lends Drupal.theme */ { + /** + * Creates markup for a changed translation marker. + * + * @return {string} + * Markup for the marker. + */ + localeTranslateChangedMarker() { + return `*`; + }, - /** - * Creates markup for a changed translation marker. - * - * @return {string} - * Markup for the marker. - */ - localeTranslateChangedMarker() { - return `*`; + /** + * Creates markup for the translation changed warning. + * + * @return {string} + * Markup for the warning. + */ + localeTranslateChangedWarning() { + return `
${Drupal.theme( + 'localeTranslateChangedMarker', + )} ${Drupal.t( + 'Changes made in this table will not be saved until the form is submitted.', + )}
`; + }, }, - - /** - * Creates markup for the translation changed warning. - * - * @return {string} - * Markup for the warning. - */ - localeTranslateChangedWarning() { - return `
${Drupal.theme('localeTranslateChangedMarker')} ${Drupal.t('Changes made in this table will not be saved until the form is submitted.')}
`; - }, - }); -}(jQuery, Drupal)); + ); +})(jQuery, Drupal);