summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/book/book.js6
-rw-r--r--modules/book/book.module3
-rw-r--r--modules/comment/comment-node-form.js13
-rw-r--r--modules/comment/comment.module9
-rw-r--r--modules/menu/menu.js78
-rw-r--r--modules/node/node.js14
-rw-r--r--modules/node/node.pages.inc9
-rw-r--r--modules/path/path.js4
-rw-r--r--modules/path/path.module3
9 files changed, 80 insertions, 59 deletions
diff --git a/modules/book/book.js b/modules/book/book.js
index 66bb39288..c529e5821 100644
--- a/modules/book/book.js
+++ b/modules/book/book.js
@@ -4,8 +4,8 @@
Drupal.behaviors.bookFieldsetSummaries = {
attach: function (context) {
- $('fieldset#edit-book', context).drupalSetSummary(function (context) {
- var val = $('#edit-book-bid').val();
+ $('fieldset.book-form', context).drupalSetSummary(function (context) {
+ var val = $('.form-item-book-bid select').val();
if (val === '0') {
return Drupal.t('Not in book');
@@ -14,7 +14,7 @@ Drupal.behaviors.bookFieldsetSummaries = {
return Drupal.t('New book');
}
else {
- return Drupal.checkPlain($('#edit-book-bid :selected').text());
+ return Drupal.checkPlain($('.form-item-book-bid select :selected').text());
}
});
}
diff --git a/modules/book/book.module b/modules/book/book.module
index 517d25ca0..fa59a1bd9 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -488,6 +488,9 @@ function _book_add_form_elements(&$form, &$form_state, $node) {
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
+ '#attributes' => array(
+ 'class' => array('book-form'),
+ ),
'#attached' => array(
'js' => array(drupal_get_path('module', 'book') . '/book.js'),
),
diff --git a/modules/comment/comment-node-form.js b/modules/comment/comment-node-form.js
index 59edf6d48..3550d6ee7 100644
--- a/modules/comment/comment-node-form.js
+++ b/modules/comment/comment-node-form.js
@@ -4,24 +4,25 @@
Drupal.behaviors.commentFieldsetSummaries = {
attach: function (context) {
- $('fieldset#edit-comment-settings', context).drupalSetSummary(function (context) {
- return Drupal.checkPlain($('input:checked', context).next('label').text());
+ $('fieldset.comment-node-settings-form', context).drupalSetSummary(function (context) {
+ return Drupal.checkPlain($('.form-item-comment input:checked', context).next('label').text());
});
+
// Provide the summary for the node type form.
- $('fieldset#edit-comment', context).drupalSetSummary(function(context) {
+ $('fieldset.comment-node-type-settings-form', context).drupalSetSummary(function(context) {
var vals = [];
// Default comment setting.
- vals.push($("select[name='comment'] option:selected", context).text());
+ vals.push($(".form-item-comment select option:selected", context).text());
// Threading.
- var threading = $("input[name='comment_default_mode']:checked", context).next('label').text();
+ var threading = $(".form-item-comment-default-mode input:checked", context).next('label').text();
if (threading) {
vals.push(threading);
}
// Comments per page.
- var number = $("select[name='comment_default_per_page'] option:selected", context).val();
+ var number = $(".form-item-comment-default-per-page select 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 9ac2d40df..81fe8ce89 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1093,6 +1093,9 @@ function comment_form_node_type_form_alter(&$form, $form_state) {
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
+ '#attributes' => array(
+ 'class' => array('comment-node-type-settings-form'),
+ ),
'#attached' => array(
'js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'),
),
@@ -1164,6 +1167,9 @@ function comment_form_node_form_alter(&$form, $form_state) {
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
+ '#attributes' => array(
+ 'class' => array('comment-node-settings-form'),
+ ),
'#attached' => array(
'js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'),
),
@@ -1188,7 +1194,6 @@ function comment_form_node_form_alter(&$form, $form_state) {
'#description' => t('Users with the "Post comments" permission can post comments.'),
'#return_value' => COMMENT_NODE_OPEN,
'#default_value' => $comment_settings,
- '#id' => 'edit-comment-2',
'#parents' => array('comment'),
),
COMMENT_NODE_CLOSED => array(
@@ -1197,7 +1202,6 @@ function comment_form_node_form_alter(&$form, $form_state) {
'#description' => t('Users cannot post comments, but existing comments will be displayed.'),
'#return_value' => COMMENT_NODE_CLOSED,
'#default_value' => $comment_settings,
- '#id' => 'edit-comment-1',
'#parents' => array('comment'),
),
COMMENT_NODE_HIDDEN => array(
@@ -1206,7 +1210,6 @@ function comment_form_node_form_alter(&$form, $form_state) {
'#description' => t('Comments are hidden from view.'),
'#return_value' => COMMENT_NODE_HIDDEN,
'#default_value' => $comment_settings,
- '#id' => 'edit-comment-0',
'#parents' => array('comment'),
),
);
diff --git a/modules/menu/menu.js b/modules/menu/menu.js
index c7041bbdf..8da220143 100644
--- a/modules/menu/menu.js
+++ b/modules/menu/menu.js
@@ -5,8 +5,8 @@
Drupal.behaviors.menuFieldsetSummaries = {
attach: function (context) {
$('fieldset.menu-link-form', context).drupalSetSummary(function (context) {
- if ($('#edit-menu-enabled', context).attr('checked')) {
- return Drupal.checkPlain($('#edit-menu-link-title', context).val());
+ if ($('.form-item-menu-enabled input', context).is(':checked')) {
+ return Drupal.checkPlain($('.form-item-menu-link-title input', context).val());
}
else {
return Drupal.t('Not in menu');
@@ -20,44 +20,46 @@ Drupal.behaviors.menuFieldsetSummaries = {
*/
Drupal.behaviors.menuLinkAutomaticTitle = {
attach: function (context) {
- // Try to find menu settings widget elements as well as a 'title' field in
- // the form, but play nicely with user permissions and form alterations.
- var $checkbox = $('fieldset.menu-link-form #edit-menu-enabled', context);
- var $link_title = $('#edit-menu-link-title', context);
- var $title = $('#edit-title', context);
- // Bail out if we do not have all required fields.
- if (!($checkbox.length && $link_title.length && $title.length)) {
- return;
- }
- // If there is a link title already, mark it as overridden. The user expects
- // that toggling the checkbox twice will take over the node's title.
- if ($checkbox.attr('checked') && $link_title.val().length) {
- $link_title.data('menuLinkAutomaticTitleOveridden', true);
- }
- // Whenever the value is changed manually, disable this behavior.
- $link_title.keyup(function () {
- $link_title.data('menuLinkAutomaticTitleOveridden', true);
- });
- // Global trigger on checkbox (do not fill-in a value when disabled).
- $checkbox.change(function () {
- if ($checkbox.attr('checked')) {
- if (!$link_title.data('menuLinkAutomaticTitleOveridden')) {
- $link_title.val($title.val());
- }
- }
- else {
- $link_title.val('');
- $link_title.removeData('menuLinkAutomaticTitleOveridden');
+ $('fieldset.menu-link-form', context).each(function () {
+ // Try to find menu settings widget elements as well as a 'title' field in
+ // the form, but play nicely with user permissions and form alterations.
+ var $checkbox = $('.form-item-menu-enabled input', this);
+ var $link_title = $('.form-item-menu-link-title input', context);
+ var $title = $(this).closest('form').find('.form-item-title input');
+ // Bail out if we do not have all required fields.
+ if (!($checkbox.length && $link_title.length && $title.length)) {
+ return;
}
- $checkbox.closest('fieldset.vertical-tabs-pane').trigger('summaryUpdated');
- $checkbox.trigger('formUpdated');
- });
- // Take over any title change.
- $title.keyup(function () {
- if (!$link_title.data('menuLinkAutomaticTitleOveridden') && $checkbox.attr('checked')) {
- $link_title.val($title.val());
- $link_title.val($title.val()).trigger('formUpdated');
+ // If there is a link title already, mark it as overridden. The user expects
+ // that toggling the checkbox twice will take over the node's title.
+ if ($checkbox.is(':checked') && $link_title.val().length) {
+ $link_title.data('menuLinkAutomaticTitleOveridden', true);
}
+ // Whenever the value is changed manually, disable this behavior.
+ $link_title.keyup(function () {
+ $link_title.data('menuLinkAutomaticTitleOveridden', true);
+ });
+ // Global trigger on checkbox (do not fill-in a value when disabled).
+ $checkbox.change(function () {
+ if ($checkbox.is(':checked')) {
+ if (!$link_title.data('menuLinkAutomaticTitleOveridden')) {
+ $link_title.val($title.val());
+ }
+ }
+ else {
+ $link_title.val('');
+ $link_title.removeData('menuLinkAutomaticTitleOveridden');
+ }
+ $checkbox.closest('fieldset.vertical-tabs-pane').trigger('summaryUpdated');
+ $checkbox.trigger('formUpdated');
+ });
+ // Take over any title change.
+ $title.keyup(function () {
+ if (!$link_title.data('menuLinkAutomaticTitleOveridden') && $checkbox.is(':checked')) {
+ $link_title.val($title.val());
+ $link_title.val($title.val()).trigger('formUpdated');
+ }
+ });
});
}
};
diff --git a/modules/node/node.js b/modules/node/node.js
index 9b2876baf..146d91a58 100644
--- a/modules/node/node.js
+++ b/modules/node/node.js
@@ -4,28 +4,28 @@
Drupal.behaviors.nodeFieldsetSummaries = {
attach: function (context) {
- $('fieldset#edit-revision-information', context).drupalSetSummary(function (context) {
- return $('#edit-revision', context).is(':checked') ?
+ $('fieldset.node-form-revision-information', context).drupalSetSummary(function (context) {
+ return $('.form-item-revision input', context).is(':checked') ?
Drupal.t('New revision') :
Drupal.t('No revision');
});
- $('fieldset#edit-author', context).drupalSetSummary(function (context) {
- var name = $('#edit-name').val() || Drupal.settings.anonymous,
- date = $('#edit-date').val();
+ $('fieldset.node-form-author', context).drupalSetSummary(function (context) {
+ var name = $('.form-item-name input', context).val() || Drupal.settings.anonymous,
+ date = $('.form-item-date input', context).val();
return date ?
Drupal.t('By @name on @date', { '@name': name, '@date': date }) :
Drupal.t('By @name', { '@name': name });
});
- $('fieldset#edit-options', context).drupalSetSummary(function (context) {
+ $('fieldset.node-form-options', context).drupalSetSummary(function (context) {
var vals = [];
$('input:checked', context).parent().each(function () {
vals.push(Drupal.checkPlain($.trim($(this).text())));
});
- if (!$('#edit-status', context).is(':checked')) {
+ if (!$('.form-item-status input', context).is(':checked')) {
vals.unshift(Drupal.t('Not published'));
}
return vals.join(', ');
diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc
index a85b2afcf..166a510c7 100644
--- a/modules/node/node.pages.inc
+++ b/modules/node/node.pages.inc
@@ -166,6 +166,9 @@ function node_form($form, &$form_state, $node) {
// Collapsed by default when "Create new revision" is unchecked
'#collapsed' => !$node->revision,
'#group' => 'additional_settings',
+ '#attributes' => array(
+ 'class' => array('node-form-revision-information'),
+ ),
'#attached' => array(
'js' => array(drupal_get_path('module', 'node') . '/node.js'),
),
@@ -204,6 +207,9 @@ function node_form($form, &$form_state, $node) {
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
+ '#attributes' => array(
+ 'class' => array('node-form-author'),
+ ),
'#attached' => array(
'js' => array(
drupal_get_path('module', 'node') . '/node.js',
@@ -240,6 +246,9 @@ function node_form($form, &$form_state, $node) {
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
+ '#attributes' => array(
+ 'class' => array('node-form-options'),
+ ),
'#attached' => array(
'js' => array(drupal_get_path('module', 'node') . '/node.js'),
),
diff --git a/modules/path/path.js b/modules/path/path.js
index e065d94b5..881724df4 100644
--- a/modules/path/path.js
+++ b/modules/path/path.js
@@ -4,8 +4,8 @@
Drupal.behaviors.pathFieldsetSummaries = {
attach: function (context) {
- $('fieldset#edit-path', context).drupalSetSummary(function (context) {
- var path = $('#edit-path-alias').val();
+ $('fieldset.path-form', context).drupalSetSummary(function (context) {
+ var path = $('.form-item-path-alias input').val();
return path ?
Drupal.t('Alias: @alias', { '@alias': path }) :
diff --git a/modules/path/path.module b/modules/path/path.module
index 0e5874357..67ecaa4ea 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -119,6 +119,9 @@ function path_form_node_form_alter(&$form, $form_state) {
'#collapsible' => TRUE,
'#collapsed' => empty($path['alias']),
'#group' => 'additional_settings',
+ '#attributes' => array(
+ 'class' => array('path-form'),
+ ),
'#attached' => array(
'js' => array(drupal_get_path('module', 'path') . '/path.js'),
),