Commit db61b260 authored by webchick's avatar webchick
Browse files

#439798 by Rob Loach: Added Vertical Tabs to the Node Type Form.

parent bf49ab72
......@@ -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(', '));
});
}
};
......
......@@ -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',
......
......@@ -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',
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment