ajax.es6.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * @file
  3. * Ajax theme overrides for Claro.
  4. */
  5. (Drupal => {
  6. /**
  7. * Theme override of the ajax progress indicator for full screen.
  8. *
  9. * @return {string}
  10. * The HTML markup for the throbber.
  11. */
  12. Drupal.theme.ajaxProgressIndicatorFullscreen = () =>
  13. '<div class="ajax-progress ajax-progress--fullscreen"><div class="ajax-progress__throbber ajax-progress__throbber--fullscreen">&nbsp;</div></div>';
  14. /**
  15. * Theme override of the ajax progress indicator.
  16. *
  17. * @param {string} message
  18. * The message shown on the UI.
  19. * @return {string}
  20. * The HTML markup for the throbber.
  21. */
  22. Drupal.theme.ajaxProgressThrobber = message => {
  23. // Build markup without adding extra white space since it affects rendering.
  24. const messageMarkup =
  25. typeof message === 'string'
  26. ? Drupal.theme('ajaxProgressMessage', message)
  27. : '';
  28. const throbber = '<div class="ajax-progress__throbber">&nbsp;</div>';
  29. return `<div class="ajax-progress ajax-progress--throbber">${throbber}${messageMarkup}</div>`;
  30. };
  31. /**
  32. * Theme override of the ajax progress message.
  33. *
  34. * @param {string} message
  35. * The message shown on the UI.
  36. * @return {string}
  37. * The HTML markup for the throbber.
  38. */
  39. Drupal.theme.ajaxProgressMessage = message =>
  40. `<div class="ajax-progress__message">${message}</div>`;
  41. })(Drupal);