X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fquickedit%2Fjs%2Ftheme.js;h=8b12cd7651d1ad8dda313a5116a16ad6c8eaa96e;hb=f3baf763d342a5f82576890e2a8111a5aaf139dc;hp=93dc3f238df22609240c8113b3d3a58140ee8d04;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website
diff --git a/web/core/modules/quickedit/js/theme.js b/web/core/modules/quickedit/js/theme.js
index 93dc3f238..8b12cd765 100644
--- a/web/core/modules/quickedit/js/theme.js
+++ b/web/core/modules/quickedit/js/theme.js
@@ -1,40 +1,17 @@
/**
- * @file
- * Provides theme functions for all of Quick Edit's client-side HTML.
- */
+* DO NOT EDIT THIS FILE.
+* See the following change record for more information,
+* https://www.drupal.org/node/2815083
+* @preserve
+**/
(function ($, Drupal) {
-
- 'use strict';
-
- /**
- * Theme function for a "backstage" for the Quick Edit module.
- *
- * @param {object} settings
- * Settings object used to construct the markup.
- * @param {string} settings.id
- * The id to apply to the backstage.
- *
- * @return {string}
- * The corresponding HTML.
- */
Drupal.theme.quickeditBackstage = function (settings) {
var html = '';
html += '
';
return html;
};
- /**
- * Theme function for a toolbar container of the Quick Edit module.
- *
- * @param {object} settings
- * Settings object used to construct the markup.
- * @param {string} settings.id
- * the id to apply to the backstage.
- *
- * @return {string}
- * The corresponding HTML.
- */
Drupal.theme.quickeditEntityToolbar = function (settings) {
var html = '';
html += '
';
@@ -48,67 +25,20 @@
return html;
};
- /**
- * Theme function for a toolbar container of the Quick Edit module.
- *
- * @param {object} settings
- * Settings object used to construct the markup.
- * @param {string} settings.entityLabel
- * The title of the active entity.
- * @param {string} settings.fieldLabel
- * The label of the highlighted or active field.
- *
- * @return {string}
- * The corresponding HTML.
- */
Drupal.theme.quickeditEntityToolbarLabel = function (settings) {
- // @todo Add XSS regression test coverage in https://www.drupal.org/node/2547437
return '' + Drupal.checkPlain(settings.fieldLabel) + '' + Drupal.checkPlain(settings.entityLabel);
};
- /**
- * Element defining a containing box for the placement of the entity toolbar.
- *
- * @return {string}
- * The corresponding HTML.
- */
Drupal.theme.quickeditEntityToolbarFence = function () {
return '';
};
- /**
- * Theme function for a toolbar container of the Quick Edit module.
- *
- * @param {object} settings
- * Settings object used to construct the markup.
- * @param {string} settings.id
- * The id to apply to the toolbar container.
- *
- * @return {string}
- * The corresponding HTML.
- */
Drupal.theme.quickeditFieldToolbar = function (settings) {
return '';
};
- /**
- * Theme function for a toolbar toolgroup of the Quick Edit module.
- *
- * @param {object} settings
- * Settings object used to construct the markup.
- * @param {string} [settings.id]
- * The id of the toolgroup.
- * @param {string} settings.classes
- * The class of the toolgroup.
- * @param {Array} settings.buttons
- * See {@link Drupal.theme.quickeditButtons}.
- *
- * @return {string}
- * The corresponding HTML.
- */
Drupal.theme.quickeditToolgroup = function (settings) {
- // Classes.
- var classes = (settings.classes || []);
+ var classes = settings.classes || [];
classes.unshift('quickedit-toolgroup');
var html = '';
html += '
';
- html += Drupal.theme('quickeditButtons', {buttons: settings.buttons});
+ html += Drupal.theme('quickeditButtons', { buttons: settings.buttons });
html += '
';
return html;
};
- /**
- * Theme function for buttons of the Quick Edit module.
- *
- * Can be used for the buttons both in the toolbar toolgroups and in the
- * modal.
- *
- * @param {object} settings
- * Settings object used to construct the markup.
- * @param {Array} settings.buttons
- * - String type: the type of the button (defaults to 'button')
- * - Array classes: the classes of the button.
- * - String label: the label of the button.
- *
- * @return {string}
- * The corresponding HTML.
- */
Drupal.theme.quickeditButtons = function (settings) {
var html = '';
- for (var i = 0; i < settings.buttons.length; i++) {
+
+ var _loop = function _loop(i) {
var button = settings.buttons[i];
if (!button.hasOwnProperty('type')) {
button.type = 'button';
}
- // Attributes.
+
var attributes = [];
var attrMap = settings.buttons[i].attributes || {};
- for (var attr in attrMap) {
- if (attrMap.hasOwnProperty(attr)) {
- attributes.push(attr + ((attrMap[attr]) ? '="' + attrMap[attr] + '"' : ''));
- }
- }
- html += '';
+ Object.keys(attrMap).forEach(function (attr) {
+ attributes.push(attr + (attrMap[attr] ? '="' + attrMap[attr] + '"' : ''));
+ });
+ html += '';
+ };
+
+ for (var i = 0; i < settings.buttons.length; i++) {
+ _loop(i);
}
return html;
};
- /**
- * Theme function for a form container of the Quick Edit module.
- *
- * @param {object} settings
- * Settings object used to construct the markup.
- * @param {string} settings.id
- * The id to apply to the toolbar container.
- * @param {string} settings.loadingMsg
- * The message to show while loading.
- *
- * @return {string}
- * The corresponding HTML.
- */
Drupal.theme.quickeditFormContainer = function (settings) {
var html = '';
html += '
';
@@ -183,5 +85,4 @@
html += '
';
return html;
};
-
-})(jQuery, Drupal);
+})(jQuery, Drupal);
\ No newline at end of file