content_type_extras.vertical_tabs.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. (function ($) {
  2. Drupal.behaviors.content_type_extras_vertical_tabs = {
  3. attach: function (context) {
  4. $('fieldset#edit-submission', context).drupalSetSummary(function (context) {
  5. var vals = [];
  6. var title = $('#edit-title-label').val();
  7. title = Drupal.t('Title: @title' , { '@title': title });
  8. // Preview
  9. var preview = $('#edit-node-preview input[type=radio]:checked').val();
  10. if (preview != 0) {
  11. vals.push(Drupal.t('Preview'));
  12. }
  13. // Save and New
  14. var save_and_new = $('#edit-node-save-and-new input[type=radio]:checked').val();
  15. if (save_and_new != 0) {
  16. vals.push(Drupal.t('Save and New'));
  17. }
  18. // Save and Edit
  19. var save_and_edit = $('#edit-node-save-and-edit input[type=radio]:checked').val();
  20. if (save_and_edit != 0) {
  21. vals.push(Drupal.t('Save and Edit'));
  22. }
  23. // Cancel
  24. var cancel = $('#edit-node-cancel input[type=radio]:checked').val();
  25. if (cancel != 0) {
  26. vals.push(Drupal.t('Cancel'));
  27. }
  28. var options = '';
  29. if (vals.length > 0) {
  30. options = Drupal.t('Options: @options', { '@options': vals.join(', ')});
  31. }
  32. return title + '<br>' + options;
  33. });
  34. // Copied from /modules/node/content_types.js
  35. $('fieldset#edit-workflow', context).drupalSetSummary(function(context) {
  36. var vals = [];
  37. $("input[name^='node_options']:checked", context).parent().each(function() {
  38. vals.push(Drupal.checkPlain($(this).text()));
  39. });
  40. if (!$('#edit-node-options-status', context).is(':checked')) {
  41. vals.unshift(Drupal.t('Not published'));
  42. }
  43. return vals.join(', ');
  44. });
  45. $('fieldset#edit-display', context).drupalSetSummary(function(context) {
  46. var vals = [];
  47. $('input:checked', context).next('label').each(function() {
  48. vals.push(Drupal.checkPlain($(this).text()));
  49. });
  50. if (!$('#edit-node-submitted', context).is(':checked')) {
  51. vals.unshift(Drupal.t("Don't display post information"));
  52. }
  53. return vals.join(', ');
  54. });
  55. // Copied from xmlsitemap/xmlsitemap.js
  56. $('fieldset#edit-xmlsitemap', context).drupalSetSummary(function (context) {
  57. var vals = [];
  58. // Inclusion select field.
  59. var status = $('#edit-xmlsitemap-status option:selected').text();
  60. vals.push(Drupal.t('Inclusion: @value', { '@value': status }));
  61. // Priority select field.
  62. var priority = $('#edit-xmlsitemap-priority option:selected').text();
  63. vals.push(Drupal.t('Priority: @value', { '@value': priority }));
  64. return vals.join('<br />');
  65. });
  66. $('fieldset#edit-extras', context).drupalSetSummary(function (context) {
  67. var vals = [];
  68. $('input:checked', context).next('label').each(function() {
  69. vals.push(Drupal.checkPlain($(this).text()));
  70. });
  71. return vals.join(', ');
  72. });
  73. }
  74. };
  75. })(jQuery);