node.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/2815083
  5. * @preserve
  6. **/
  7. (function ($, Drupal, drupalSettings) {
  8. Drupal.behaviors.nodeDetailsSummaries = {
  9. attach: function attach(context) {
  10. var $context = $(context);
  11. $context.find('.node-form-author').drupalSetSummary(function (context) {
  12. var $authorContext = $(context);
  13. var name = $authorContext.find('.field--name-uid input').val();
  14. var date = $authorContext.find('.field--name-created input').val();
  15. if (name && date) {
  16. return Drupal.t('By @name on @date', { '@name': name, '@date': date });
  17. } else if (name) {
  18. return Drupal.t('By @name', { '@name': name });
  19. } else if (date) {
  20. return Drupal.t('Authored on @date', { '@date': date });
  21. }
  22. });
  23. $context.find('.node-form-options').drupalSetSummary(function (context) {
  24. var $optionsContext = $(context);
  25. var vals = [];
  26. if ($optionsContext.find('input').is(':checked')) {
  27. $optionsContext.find('input:checked').next('label').each(function () {
  28. vals.push(Drupal.checkPlain($.trim($(this).text())));
  29. });
  30. return vals.join(', ');
  31. }
  32. return Drupal.t('Not promoted');
  33. });
  34. }
  35. };
  36. })(jQuery, Drupal, drupalSettings);