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/node/node.js | 35 +++++++++++++++++++++++++++++++++++ modules/node/node.pages.inc | 14 ++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 modules/node/node.js (limited to 'modules/node') diff --git a/modules/node/node.js b/modules/node/node.js new file mode 100644 index 000000000..59647b34e --- /dev/null +++ b/modules/node/node.js @@ -0,0 +1,35 @@ +// $Id$ + +(function($) { + +Drupal.behaviors.nodeFieldsetSummaries = { + attach: function(context) { + $('fieldset#edit-revision-information', context).setSummary(function(context) { + return $('#edit-revision', context).is(':checked') ? + Drupal.t('New revision') : + Drupal.t('No revision'); + }); + + $('fieldset#edit-author', context).setSummary(function(context) { + var name = $('#edit-name').val(), date = $('#edit-date').val(); + return date ? + Drupal.t('By @name on @date', { '@name': name, '@date': date }) : + Drupal.t('By @name', { '@name': name }); + }); + + $('fieldset#edit-options', context).setSummary(function(context) { + var vals = []; + + $('input:checked', context).parent().each(function() { + vals.push(Drupal.checkPlain($.trim($(this).text()))); + }); + + if (!$('#edit-status', context).is(':checked')) { + vals.unshift(Drupal.t('Not published')); + } + return vals.join(', '); + }); + } +}; + +})(jQuery); diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc index b77c3801c..c02d70fe5 100644 --- a/modules/node/node.pages.inc +++ b/modules/node/node.pages.inc @@ -152,6 +152,10 @@ function node_form(&$form_state, $node) { $form['#node'] = $node; + $form['additional_settings'] = array( + '#type' => 'vertical_tabs', + ); + // Add a log field if the "Create new revision" option is checked, or if the // current user has the ability to check that option. if (!empty($node->revision) || user_access('administer nodes')) { @@ -161,6 +165,8 @@ function node_form(&$form_state, $node) { '#collapsible' => TRUE, // Collapsed by default when "Create new revision" is unchecked '#collapsed' => !$node->revision, + '#group' => 'additional_settings', + '#attached_js' => array(drupal_get_path('module', 'node') . '/node.js'), '#weight' => 20, ); $form['revision_information']['revision'] = array( @@ -172,7 +178,7 @@ function node_form(&$form_state, $node) { $form['revision_information']['log'] = array( '#type' => 'textarea', '#title' => t('Revision log message'), - '#rows' => 2, + '#rows' => 4, '#description' => t('Provide an explanation of the changes you are making. This will help other authors understand your motivations.'), ); } @@ -184,6 +190,8 @@ function node_form(&$form_state, $node) { '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, + '#group' => 'additional_settings', + '#attached_js' => array(drupal_get_path('module', 'node') . '/node.js'), '#weight' => 90, ); $form['author']['name'] = array( @@ -213,6 +221,8 @@ function node_form(&$form_state, $node) { '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, + '#group' => 'additional_settings', + '#attached_js' => array(drupal_get_path('module', 'node') . '/node.js'), '#weight' => 95, ); $form['options']['status'] = array( @@ -283,7 +293,7 @@ function node_body_field(&$node, $label, $word_count) { $form = array( '#after_build' => array('node_teaser_js', 'node_teaser_include_verify')); - $form['#prefix'] = '
'; + $form['#prefix'] = '
'; $form['#suffix'] = '
'; $form['teaser_js'] = array( -- cgit v1.2.3