From e888f0061cb7ca2f07b38ad4ff09da99faa75580 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sat, 11 Apr 2009 22:19:46 +0000 Subject: #323112 by dmitrig01, kkaefer, quicksketch, frando and many many more: Now presenting... Vertical Tabs. Fantastic new UI improvement for node forms and hopefully more in the future. --- modules/book/book.css | 3 +++ modules/book/book.js | 23 +++++++++++++++++++++++ modules/book/book.module | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 modules/book/book.js (limited to 'modules/book') diff --git a/modules/book/book.css b/modules/book/book.css index d66cae18d..4c1ee0e2e 100644 --- a/modules/book/book.css +++ b/modules/book/book.css @@ -35,6 +35,9 @@ margin-top: 0; margin-bottom: 0; } +html.js #edit-book-pick-book { + display: none; +} #edit-book-bid-wrapper .description { clear: both; } diff --git a/modules/book/book.js b/modules/book/book.js new file mode 100644 index 000000000..74baffccf --- /dev/null +++ b/modules/book/book.js @@ -0,0 +1,23 @@ +// $Id$ + +(function($) { + +Drupal.behaviors.bookFieldsetSummaries = { + attach: function(context) { + $('fieldset#edit-book', context).setSummary(function(context) { + var val = $('#edit-book-bid').val(); + + if (val === '0') { + return Drupal.t('Not in book'); + } + else if (val === 'new') { + return Drupal.t('New book'); + } + else { + return Drupal.checkPlain($('#edit-book-bid :selected').text()); + } + }); + } +}; + +})(jQuery); diff --git a/modules/book/book.module b/modules/book/book.module index 717bcd185..be1f7138d 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -415,7 +415,6 @@ function _book_parent_select($book_link) { function _book_add_form_elements(&$form, $node) { // Need this for AJAX. $form['#cache'] = TRUE; - drupal_add_js("if (Drupal.jsEnabled) { jQuery(function() { jQuery('#edit-book-pick-book').css('display', 'none'); }); }", 'inline'); $form['book'] = array( '#type' => 'fieldset', @@ -423,6 +422,8 @@ function _book_add_form_elements(&$form, $node) { '#weight' => 10, '#collapsible' => TRUE, '#collapsed' => TRUE, + '#group' => 'additional_settings', + '#attached_js' => array(drupal_get_path('module', 'book') . '/book.js'), '#tree' => TRUE, '#attributes' => array('class' => 'book-outline-form'), ); -- cgit v1.2.3