node.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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', {
  17. '@name': name,
  18. '@date': date
  19. });
  20. }
  21. if (name) {
  22. return Drupal.t('By @name', { '@name': name });
  23. }
  24. if (date) {
  25. return Drupal.t('Authored on @date', { '@date': date });
  26. }
  27. });
  28. $context.find('.node-form-options').drupalSetSummary(function (context) {
  29. var $optionsContext = $(context);
  30. var vals = [];
  31. if ($optionsContext.find('input').is(':checked')) {
  32. $optionsContext.find('input:checked').next('label').each(function () {
  33. vals.push(Drupal.checkPlain($.trim($(this).text())));
  34. });
  35. return vals.join(', ');
  36. }
  37. return Drupal.t('Not promoted');
  38. });
  39. }
  40. };
  41. })(jQuery, Drupal, drupalSettings);