summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-21 00:21:48 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-21 00:21:48 +0000
commitdb61b2603918d582afad82b8036fac7f5240a627 (patch)
tree7d5cc8f01eb970dc80e65fc4fdf9bfa9c1c59cd5
parentbf49ab721394036a9e3396236cab76ae6db0594f (diff)
downloadbrdo-db61b2603918d582afad82b8036fac7f5240a627.tar.gz
brdo-db61b2603918d582afad82b8036fac7f5240a627.tar.bz2
#439798 by Rob Loach: Added Vertical Tabs to the Node Type Form.
-rw-r--r--modules/comment/comment-node-form.js19
-rw-r--r--modules/comment/comment.module2
-rw-r--r--modules/node/content_types.inc9
-rw-r--r--modules/node/content_types.js35
4 files changed, 61 insertions, 4 deletions
diff --git a/modules/comment/comment-node-form.js b/modules/comment/comment-node-form.js
index 20d8729f4..0f51884a2 100644
--- a/modules/comment/comment-node-form.js
+++ b/modules/comment/comment-node-form.js
@@ -7,6 +7,25 @@ Drupal.behaviors.commentFieldsetSummaries = {
$('fieldset#edit-comment-settings', context).setSummary(function (context) {
return Drupal.checkPlain($('input:checked', context).parent().text());
});
+ // Provide the summary for the node type form.
+ $('fieldset#edit-comment', context).setSummary(function(context) {
+ var vals = [];
+
+ // Default comment setting.
+ vals.push($("select[name='comment'] option:selected", context).text());
+
+ // Threading.
+ var threading = $("input[name='comment_default_mode']:checked", context).parent().text();
+ if (threading) {
+ vals.push(threading);
+ }
+
+ // Comments per page.
+ var number = $("select[name='comment_default_per_page'] option:selected", context).val();
+ vals.push(Drupal.t('@number comments per page', {'@number': number}));
+
+ return Drupal.checkPlain(vals.join(', '));
+ });
}
};
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 18653611c..b06b186a4 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -932,6 +932,8 @@ function comment_form_node_type_form_alter(&$form, $form_state) {
'#title' => t('Comment settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
+ '#group' => 'additional_settings',
+ '#attached_js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'),
);
$form['comment']['comment_default_mode'] = array(
'#type' => 'checkbox',
diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc
index af6cbbcb4..bd68d05e3 100644
--- a/modules/node/content_types.inc
+++ b/modules/node/content_types.inc
@@ -108,12 +108,17 @@ function node_type_form(&$form_state, $type = NULL) {
'#title' => t('Description'),
'#type' => 'textarea',
'#default_value' => $type->description,
- );
+ );
+
+ $form['additional_settings'] = array(
+ '#type' => 'vertical_tabs',
+ );
$form['submission'] = array(
'#type' => 'fieldset',
'#title' => t('Submission form settings'),
'#collapsible' => TRUE,
+ '#group' => 'additional_settings',
);
$form['submission']['title_label'] = array(
'#title' => t('Title field label'),
@@ -155,6 +160,7 @@ function node_type_form(&$form_state, $type = NULL) {
'#title' => t('Publishing options'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
+ '#group' => 'additional_settings',
);
$form['workflow']['node_options'] = array('#type' => 'checkboxes',
'#title' => t('Default options'),
@@ -172,6 +178,7 @@ function node_type_form(&$form_state, $type = NULL) {
'#title' => t('Display settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
+ '#group' => 'additional_settings',
);
$form['display']['node_submitted'] = array(
'#type' => 'checkbox',
diff --git a/modules/node/content_types.js b/modules/node/content_types.js
index e182d3452..98a0baed1 100644
--- a/modules/node/content_types.js
+++ b/modules/node/content_types.js
@@ -2,15 +2,44 @@
(function ($) {
Drupal.behaviors.contentTypes = {
- attach: function () {
+ attach: function (context) {
+ // Provide the vertical tab summaries.
+ $('fieldset#edit-submission', context).setSummary(function(context) {
+ var vals = [];
+ vals.push(Drupal.checkPlain($('#edit-title-label', context).val()) || Drupal.t('Requires a title'));
+ vals.push(Drupal.checkPlain($('#edit-body-label', context).val()) || Drupal.t('No body'));
+ return vals.join(', ');
+ });
+ $('fieldset#edit-workflow', context).setSummary(function(context) {
+ var vals = [];
+ $("input[name^='node_options']:checked", context).parent().each(function() {
+ vals.push(Drupal.checkPlain($(this).text()));
+ });
+ if (!$('#edit-node-options-status', context).is(':checked')) {
+ vals.unshift(Drupal.t('Not published'));
+ }
+ return vals.join(', ');
+ });
+ $('fieldset#edit-display', context).setSummary(function(context) {
+ var vals = [];
+ $('input:checked', context).parent().each(function() {
+ vals.push(Drupal.checkPlain($(this).text()));
+ });
+ if (!$('#edit-node-submitted', context).is(':checked')) {
+ vals.unshift(Drupal.t("Don't display post information"));
+ }
+ return vals.join(', ');
+ });
+
+ // Process the machine name.
if ($('#edit-type').val() == $('#edit-name').val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_') || $('#edit-type').val() == '') {
- $('.form-item-type-wrapper').hide();
+ $('.form-item.type-wrapper').hide();
$('#edit-name').keyup(function () {
var machine = $(this).val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_');
if (machine != '_' && machine != '') {
$('#edit-type').val(machine);
$('#node-type-name-suffix').empty().append(' Machine name: ' + machine + ' [').append($('<a href="#">' + Drupal.t('Edit') + '</a>').click(function () {
- $('.form-item-type-wrapper').show();
+ $('.form-item-textfield.type-wrapper').show();
$('#node-type-name-suffix').hide();
$('#edit-name').unbind('keyup');
return false;