Commit 459d6234 authored by Dries's avatar Dries

- Patch #445130 by Rob Loach, aspilicious: namespace the Drupal jQuery functions.

parent 70d60fb8
......@@ -66,7 +66,7 @@ Drupal.behaviors.collapse = {
var summary = $('<span class="summary"></span>');
$fieldset.
bind('summaryUpdated', function () {
var text = $.trim($fieldset.getSummary());
var text = $.trim($fieldset.drupalGetSummary());
summary.html(text ? ' (' + text + ')' : '');
})
.trigger('summaryUpdated');
......
......@@ -4,7 +4,7 @@
/**
* Retrieves the summary for the first element.
*/
$.fn.getSummary = function () {
$.fn.drupalGetSummary = function () {
var callback = this.data('summaryCallback');
return (this[0] && callback) ? $.trim(callback(this[0])) : '';
};
......@@ -16,7 +16,7 @@ $.fn.getSummary = function () {
* Either a function that will be called each time the summary is
* retrieved or a string (which is returned each time).
*/
$.fn.setSummary = function (callback) {
$.fn.drupalSetSummary = function (callback) {
var self = this;
// To facilitate things, the callback should always be a function. If it's
......
......@@ -129,7 +129,7 @@ Drupal.verticalTab.prototype = {
* Updates the tab's summary.
*/
updateSummary: function () {
this.summary.html(this.fieldset.getSummary());
this.summary.html(this.fieldset.drupalGetSummary());
},
/**
......
......@@ -6,14 +6,14 @@
*/
Drupal.behaviors.blockSettingsSummary = {
attach: function (context) {
// The setSummary method required for this behavior is not available
// The drupalSetSummary method required for this behavior is not available
// on the Blocks administration page, so we need to make sure this
// behavior is processed only if setSummary is defined.
if (typeof jQuery.fn.setSummary == 'undefined') {
// behavior is processed only if drupalSetSummary is defined.
if (typeof jQuery.fn.drupalSetSummary == 'undefined') {
return;
}
$('fieldset#edit-path', context).setSummary(function (context) {
$('fieldset#edit-path', context).drupalSetSummary(function (context) {
if (!$('textarea[name="pages"]', context).val()) {
return Drupal.t('Not restricted');
}
......@@ -22,7 +22,7 @@ Drupal.behaviors.blockSettingsSummary = {
}
});
$('fieldset#edit-node-type', context).setSummary(function (context) {
$('fieldset#edit-node-type', context).drupalSetSummary(function (context) {
var vals = [];
$('input[type="checkbox"]:checked', context).each(function () {
vals.push($.trim($(this).next('label').text()));
......@@ -33,7 +33,7 @@ Drupal.behaviors.blockSettingsSummary = {
return vals.join(', ');
});
$('fieldset#edit-role', context).setSummary(function (context) {
$('fieldset#edit-role', context).drupalSetSummary(function (context) {
var vals = [];
$('input[type="checkbox"]:checked', context).each(function () {
vals.push($.trim($(this).next('label').text()));
......@@ -44,7 +44,7 @@ Drupal.behaviors.blockSettingsSummary = {
return vals.join(', ');
});
$('fieldset#edit-user', context).setSummary(function (context) {
$('fieldset#edit-user', context).drupalSetSummary(function (context) {
var $radio = $('input[name="custom"]:checked', context);
if ($radio.val() == 0) {
return Drupal.t('Not customizable');
......
......@@ -4,7 +4,7 @@
Drupal.behaviors.menuFieldsetSummaries = {
attach: function (context) {
$('fieldset.menu-link-form', context).setSummary(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());
}
......
......@@ -4,13 +4,13 @@
Drupal.behaviors.contentTypes = {
attach: function (context) {
// Provide the vertical tab summaries.
$('fieldset#edit-submission', context).setSummary(function(context) {
$('fieldset#edit-submission', context).drupalSetSummary(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) {
$('fieldset#edit-workflow', context).drupalSetSummary(function(context) {
var vals = [];
$("input[name^='node_options']:checked", context).parent().each(function() {
vals.push(Drupal.checkPlain($(this).text()));
......@@ -20,7 +20,7 @@ Drupal.behaviors.contentTypes = {
}
return vals.join(', ');
});
$('fieldset#edit-display', context).setSummary(function(context) {
$('fieldset#edit-display', context).drupalSetSummary(function(context) {
var vals = [];
$('input:checked', context).next('label').each(function() {
vals.push(Drupal.checkPlain($(this).text()));
......
......@@ -4,20 +4,20 @@
Drupal.behaviors.nodeFieldsetSummaries = {
attach: function (context) {
$('fieldset#edit-revision-information', context).setSummary(function (context) {
$('fieldset#edit-revision-information', context).drupalSetSummary(function (context) {
return $('#edit-revision', context).is(':checked') ?
Drupal.t('New revision') :
Drupal.t('No revision');
});
$('fieldset#edit-author', context).setSummary(function (context) {
$('fieldset#edit-author', context).drupalSetSummary(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) {
$('fieldset#edit-options', context).drupalSetSummary(function (context) {
var vals = [];
$('input:checked', context).parent().each(function () {
......
......@@ -4,7 +4,7 @@
Drupal.behaviors.pathFieldsetSummaries = {
attach: function (context) {
$('fieldset#edit-path', context).setSummary(function (context) {
$('fieldset#edit-path', context).drupalSetSummary(function (context) {
var path = $('#edit-path-alias').val();
return path ?
......
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