From 4efafd31e2d14232c6be747a40924aa93ee8b89d Mon, 14 Jan 2013 01:10:35 +0100
From: hass <hass@85918.no-reply.drupal.org>
Date: Mon, 14 Jan 2013 01:10:23 +0100
Subject: [PATCH] #1615562: Update the summary in the vertical tabs

diff --git a/js/workbench_moderation.js b/js/workbench_moderation.js
new file mode 100644
index 0000000..31fc512
--- /dev/null
+++ b/js/workbench_moderation.js
@@ -0,0 +1,25 @@
+/**
+ * @file
+ * Sets the summary for Workbench moderation on vertical tabs.
+ */
+
+(function ($) {
+
+Drupal.behaviors.workbenchModerationSettingsSummary = {
+  attach: function(context) {
+    $('fieldset.node-form-options', context).drupalSetSummary(function (context) {
+      var vals = [];
+
+      $('input:checked', context).parent().each(function () {
+        vals.push(Drupal.checkPlain($.trim($(this).text())));
+      });
+
+      if ($('select[name="workbench_moderation_state_new"]', context).val()) {
+        vals.push(Drupal.checkPlain($('select[name="workbench_moderation_state_new"] option:selected').text()));
+      }
+      return vals.join(', ');
+    });
+  }
+};
+
+})(jQuery);
diff --git a/workbench_moderation.module b/workbench_moderation.module
index 3f834be..024bef8 100644
--- a/workbench_moderation.module
+++ b/workbench_moderation.module
@@ -874,6 +874,12 @@
     $form['revision_information']['#access'] = FALSE;
   }
 
+  // Setup the JS for the vertical tabs summary. The heavy weight allows this
+  // script to replace the default node summary callbacks that get registered by
+  // "lighter" scripts.
+  // Note: Form API '#attached' does not allow to set a weight.
+  drupal_add_js(drupal_get_path('module', 'workbench_moderation') . '/js/workbench_moderation.js', array('weight' => 90));
+
   // Users can not choose to publish content; content can only be published by
   // setting the content's moderation state to "Published".
   $form['options']['status']['#access'] = FALSE;
