comparison core/modules/node/node.es6.js @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
1 /** 1 /**
2 * @file 2 * @file
3 * Defines Javascript behaviors for the node module. 3 * Defines Javascript behaviors for the node module.
4 */ 4 */
5 5
6 (function ($, Drupal, drupalSettings) { 6 (function($, Drupal, drupalSettings) {
7 /** 7 /**
8 * Behaviors for tabs in the node edit form. 8 * Behaviors for tabs in the node edit form.
9 * 9 *
10 * @type {Drupal~behavior} 10 * @type {Drupal~behavior}
11 * 11 *
14 */ 14 */
15 Drupal.behaviors.nodeDetailsSummaries = { 15 Drupal.behaviors.nodeDetailsSummaries = {
16 attach(context) { 16 attach(context) {
17 const $context = $(context); 17 const $context = $(context);
18 18
19 $context.find('.node-form-author').drupalSetSummary((context) => { 19 $context.find('.node-form-author').drupalSetSummary(context => {
20 const $authorContext = $(context); 20 const $authorContext = $(context);
21 const name = $authorContext.find('.field--name-uid input').val(); 21 const name = $authorContext.find('.field--name-uid input').val();
22 const date = $authorContext.find('.field--name-created input').val(); 22 const date = $authorContext.find('.field--name-created input').val();
23 23
24 if (name && date) { 24 if (name && date) {
25 return Drupal.t('By @name on @date', { '@name': name, '@date': date }); 25 return Drupal.t('By @name on @date', {
26 '@name': name,
27 '@date': date,
28 });
26 } 29 }
27 else if (name) { 30 if (name) {
28 return Drupal.t('By @name', { '@name': name }); 31 return Drupal.t('By @name', { '@name': name });
29 } 32 }
30 else if (date) { 33 if (date) {
31 return Drupal.t('Authored on @date', { '@date': date }); 34 return Drupal.t('Authored on @date', { '@date': date });
32 } 35 }
33 }); 36 });
34 37
35 $context.find('.node-form-options').drupalSetSummary((context) => { 38 $context.find('.node-form-options').drupalSetSummary(context => {
36 const $optionsContext = $(context); 39 const $optionsContext = $(context);
37 const vals = []; 40 const vals = [];
38 41
39 if ($optionsContext.find('input').is(':checked')) { 42 if ($optionsContext.find('input').is(':checked')) {
40 $optionsContext.find('input:checked').next('label').each(function () { 43 $optionsContext
41 vals.push(Drupal.checkPlain($.trim($(this).text()))); 44 .find('input:checked')
42 }); 45 .next('label')
46 .each(function() {
47 vals.push(Drupal.checkPlain($.trim($(this).text())));
48 });
43 return vals.join(', '); 49 return vals.join(', ');
44 } 50 }
45 51
46 return Drupal.t('Not promoted'); 52 return Drupal.t('Not promoted');
47 }); 53 });
48 }, 54 },
49 }; 55 };
50 }(jQuery, Drupal, drupalSettings)); 56 })(jQuery, Drupal, drupalSettings);