diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book/book.css | 3 | ||||
-rw-r--r-- | modules/book/book.js | 23 | ||||
-rw-r--r-- | modules/book/book.module | 3 | ||||
-rw-r--r-- | modules/comment/comment-node-form.js | 13 | ||||
-rw-r--r-- | modules/comment/comment.module | 2 | ||||
-rw-r--r-- | modules/menu/menu.js | 13 | ||||
-rw-r--r-- | modules/menu/menu.module | 2 | ||||
-rw-r--r-- | modules/node/node.js | 35 | ||||
-rw-r--r-- | modules/node/node.pages.inc | 14 | ||||
-rw-r--r-- | modules/path/path.js | 17 | ||||
-rw-r--r-- | modules/path/path.module | 2 | ||||
-rw-r--r-- | modules/system/system.css | 11 | ||||
-rw-r--r-- | modules/system/system.module | 10 | ||||
-rw-r--r-- | modules/upload/upload.js | 14 | ||||
-rw-r--r-- | modules/upload/upload.module | 4 |
15 files changed, 157 insertions, 9 deletions
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'), ); diff --git a/modules/comment/comment-node-form.js b/modules/comment/comment-node-form.js new file mode 100644 index 000000000..9c7dea7cc --- /dev/null +++ b/modules/comment/comment-node-form.js @@ -0,0 +1,13 @@ +// $Id$ + +(function($) { + +Drupal.behaviors.commentFieldsetSummaries = { + attach: function(context) { + $('fieldset#edit-comment-settings', context).setSummary(function(context) { + return Drupal.checkPlain($('input:checked', context).parent().text()); + }); + } +}; + +})(jQuery); diff --git a/modules/comment/comment.module b/modules/comment/comment.module index e00057506..6c7e582fa 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -580,6 +580,8 @@ function comment_form_alter(&$form, $form_state, $form_id) { '#title' => t('Comment settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, + '#group' => 'additional_settings', + '#attached_js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'), '#weight' => 30, ); $comment_count = isset($node->nid) ? db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array(':nid' => $node->nid))->fetchField() : 0; diff --git a/modules/menu/menu.js b/modules/menu/menu.js new file mode 100644 index 000000000..cc39e7e8e --- /dev/null +++ b/modules/menu/menu.js @@ -0,0 +1,13 @@ +// $Id$ + +(function($) { + +Drupal.behaviors.menuFieldsetSummaries = { + attach: function(context) { + $('fieldset#edit-menu', context).setSummary(function(context) { + return Drupal.checkPlain($('#edit-menu-link-title', context).val()) || Drupal.t('Not in menu'); + }); + } +}; + +})(jQuery); diff --git a/modules/menu/menu.module b/modules/menu/menu.module index 15f20c452..11b5f505d 100644 --- a/modules/menu/menu.module +++ b/modules/menu/menu.module @@ -395,6 +395,8 @@ function menu_form_alter(&$form, $form_state, $form_id) { '#access' => user_access('administer menu'), '#collapsible' => TRUE, '#collapsed' => FALSE, + '#group' => 'additional_settings', + '#attached_js' => array(drupal_get_path('module', 'menu') . '/menu.js'), '#tree' => TRUE, '#weight' => -2, '#attributes' => array('class' => 'menu-item-form'), 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'] = '<div class="body-field-wrapper">'; + $form['#prefix'] = '<div class="body-field-wrapper clearfix">'; $form['#suffix'] = '</div>'; $form['teaser_js'] = array( diff --git a/modules/path/path.js b/modules/path/path.js new file mode 100644 index 000000000..e801a9a26 --- /dev/null +++ b/modules/path/path.js @@ -0,0 +1,17 @@ +// $Id$ + +(function($) { + +Drupal.behaviors.pathFieldsetSummaries = { + attach: function(context) { + $('fieldset#edit-path', context).setSummary(function(context) { + var path = $('#edit-path-1').val(); + + return path ? + Drupal.t('Alias: @alias', { '@alias': path }) : + Drupal.t('No alias'); + }); + } +}; + +})(jQuery); diff --git a/modules/path/path.module b/modules/path/path.module index 6c6af2343..9c813f809 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -194,6 +194,8 @@ function path_form_alter(&$form, $form_state, $form_id) { '#title' => t('URL path settings'), '#collapsible' => TRUE, '#collapsed' => empty($path), + '#group' => 'additional_settings', + '#attached_js' => array(drupal_get_path('module', 'path') . '/path.js'), '#access' => user_access('create url aliases'), '#weight' => 30, ); diff --git a/modules/system/system.css b/modules/system/system.css index abd34d249..1032618ff 100644 --- a/modules/system/system.css +++ b/modules/system/system.css @@ -320,11 +320,19 @@ html.js fieldset.collapsed * { } html.js fieldset.collapsed legend { display: block; + overflow: hidden; } html.js fieldset.collapsible legend a { + display: inline; padding-left: 15px; /* LTR */ background: url(../../misc/menu-expanded.png) 5px 75% no-repeat; /* LTR */ } +html.js fieldset.collapsible legend span.summary { + display: inline; + font-size: 0.9em; + color: #999; + margin-left: 0.5em; +} html.js fieldset.collapsed legend a { background-image: url(../../misc/menu-collapsed.png); /* LTR */ background-position: 5px 50%; /* LTR */ @@ -339,9 +347,6 @@ html.js fieldset.collapsed legend a { html.js fieldset.collapsible { position: relative; } -html.js fieldset.collapsible legend a { - display: block; -} /* Avoid jumping around due to margins collapsing into collapsible fieldset border */ html.js fieldset.collapsible .fieldset-wrapper { overflow: auto; diff --git a/modules/system/system.module b/modules/system/system.module index 528d6c300..5a1297c1f 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -381,6 +381,7 @@ function system_elements() { '#theme' => 'file', '#theme_wrapper' => 'form_element', ); + $type['tableselect'] = array( '#input' => TRUE, '#js_select' => TRUE, @@ -419,10 +420,17 @@ function system_elements() { '#collapsible' => FALSE, '#collapsed' => FALSE, '#value' => NULL, - '#process' => array('form_process_ahah'), + '#process' => array('form_process_fieldset', 'form_process_ahah'), + '#pre_render' => array('form_pre_render_fieldset'), '#theme_wrapper' => 'fieldset', ); + $type['vertical_tabs'] = array( + '#theme_wrapper' => 'vertical_tabs', + '#default_tab' => '', + '#process' => array('form_process_vertical_tabs'), + ); + $type['token'] = array( '#input' => TRUE, '#theme' => array('hidden'), diff --git a/modules/upload/upload.js b/modules/upload/upload.js new file mode 100644 index 000000000..f9d5c9108 --- /dev/null +++ b/modules/upload/upload.js @@ -0,0 +1,14 @@ +// $Id$ + +(function($) { + +Drupal.behaviors.bookFieldsetSummaries = { + attach: function(context) { + $('fieldset#edit-attachments', context).setSummary(function(context) { + var size = $('#upload-attachments tbody tr').size(); + return Drupal.formatPlural(size, '1 attachment', '@count attachments'); + }); + } +}; + +})(jQuery); diff --git a/modules/upload/upload.module b/modules/upload/upload.module index 411bffebe..f5b42c20e 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -231,9 +231,9 @@ function upload_form_alter(&$form, $form_state, $form_id) { '#title' => t('File attachments'), '#collapsible' => TRUE, '#collapsed' => empty($node->files), + '#group' => 'additional_settings', + '#attached_js' => array(drupal_get_path('module', 'upload') . '/upload.js'), '#description' => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'), - '#prefix' => '<div class="attachments">', - '#suffix' => '</div>', '#weight' => 30, ); |