menu_attributes.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. (function ($) {
  2. /**
  3. * Provide the summary information for the menu attributes vertical tabs.
  4. */
  5. Drupal.behaviors.menuAttributesOptionsSummary = {
  6. attach: function (context) {
  7. // Menu item title.
  8. $('fieldset#edit-title', context).drupalSetSummary(function (context) {
  9. if (!$('input[type="checkbox"]:checked', context).val()) {
  10. return Drupal.t('Disabled');
  11. }
  12. var value = $('.form-textarea', context).val();
  13. if (!value) {
  14. return Drupal.t('No title');
  15. }
  16. else {
  17. return Drupal.checkPlain(value);
  18. }
  19. });
  20. // Menu item ID.
  21. $('fieldset#edit-id', context).drupalSetSummary(function (context) {
  22. if (!$('input[type="checkbox"]:checked', context).val()) {
  23. return Drupal.t('Disabled');
  24. }
  25. var value = $('.form-text', context).val();
  26. if (!value) {
  27. return Drupal.t('No ID');
  28. }
  29. else {
  30. return Drupal.checkPlain(value);
  31. }
  32. });
  33. // Menu item name.
  34. $('fieldset#edit-name', context).drupalSetSummary(function (context) {
  35. if (!$('input[type="checkbox"]:checked', context).val()) {
  36. return Drupal.t('Disabled');
  37. }
  38. var value = $('.form-text', context).val();
  39. if (!value) {
  40. return Drupal.t('No name');
  41. }
  42. else {
  43. return Drupal.checkPlain(value);
  44. }
  45. });
  46. // Menu item relationship.
  47. $('fieldset#edit-rel', context).drupalSetSummary(function (context) {
  48. if (!$('input[type="checkbox"]:checked', context).val()) {
  49. return Drupal.t('Disabled');
  50. }
  51. var value = $('.form-text', context).val();
  52. if (!value) {
  53. return Drupal.t('No relationship');
  54. }
  55. else {
  56. return Drupal.checkPlain(value);
  57. }
  58. });
  59. // Menu item classes.
  60. $('fieldset#edit-class', context).drupalSetSummary(function (context) {
  61. if (!$('input[type="checkbox"]:checked', context).val()) {
  62. return Drupal.t('Disabled');
  63. }
  64. var value = $('.form-text', context).val();
  65. if (!value) {
  66. return Drupal.t('No classes');
  67. }
  68. else {
  69. return Drupal.checkPlain(value.replace(/\s/g, ', '));
  70. }
  71. });
  72. // Menu item style.
  73. $('fieldset#edit-style', context).drupalSetSummary(function (context) {
  74. if (!$('input[type="checkbox"]:checked', context).val()) {
  75. return Drupal.t('Disabled');
  76. }
  77. var value = $('.form-text', context).val();
  78. if (!value) {
  79. return Drupal.t('No style');
  80. }
  81. else {
  82. return Drupal.checkPlain(value);
  83. }
  84. });
  85. // Menu item target.
  86. $('fieldset#edit-target', context).drupalSetSummary(function (context) {
  87. if (!$('input[type="checkbox"]:checked', context).val()) {
  88. return Drupal.t('Disabled');
  89. }
  90. var value = $('.form-select option:selected', context).text();
  91. return Drupal.checkPlain(value);
  92. });
  93. // Menu item access key.
  94. $('fieldset#edit-accesskey', context).drupalSetSummary(function (context) {
  95. if (!$('input[type="checkbox"]:checked', context).val()) {
  96. return Drupal.t('Disabled');
  97. }
  98. var value = $('.form-text', context).val();
  99. if (!value) {
  100. return Drupal.t('No access key');
  101. }
  102. else {
  103. return Drupal.checkPlain(value);
  104. }
  105. });
  106. }
  107. };
  108. })(jQuery);