Commit 0c660d84 authored by catch's avatar catch

Issue #1574512 by nod_: Selectors clean-up: block.

parent 4a8cc339
......@@ -6,7 +6,7 @@
* Provide the summary information for the block settings vertical tabs.
*/
Drupal.behaviors.blockSettingsSummary = {
attach: function (context) {
attach: function () {
// 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 drupalSetSummary is defined.
......@@ -14,51 +14,33 @@ Drupal.behaviors.blockSettingsSummary = {
return;
}
var $context = $(context);
$context.find('fieldset#edit-path').drupalSetSummary(function (context) {
if (!$(context).find('textarea[name="pages"]').val()) {
return Drupal.t('Not restricted');
}
else {
return Drupal.t('Restricted to certain pages');
}
});
$context.find('fieldset#edit-node-type').drupalSetSummary(function (context) {
function checkboxesSummary (context) {
var vals = [];
$(context).find('input[type="checkbox"]:checked').each(function () {
vals.push($.trim($(this).next('label').text()));
});
if (!vals.length) {
vals.push(Drupal.t('Not restricted'));
var $checkboxes = $(context).find('input[type="checkbox"]:checked + label');
for (var i = 0, il = $checkboxes.length; i < il; i += 1) {
vals.push($($checkboxes[i]).text());
}
return vals.join(', ');
});
$context.find('fieldset#edit-language').drupalSetSummary(function (context) {
var vals = [];
$(context).find('input[type="checkbox"]:checked').each(function () {
vals.push($.trim($(this).next('label').text()));
});
if (!vals.length) {
vals.push(Drupal.t('Not restricted'));
}
return vals.join(', ');
});
return $.map(vals, $.trim).join(', ');
}
$('#edit-node-type').drupalSetSummary(checkboxesSummary);
$('#edit-language').drupalSetSummary(checkboxesSummary);
$('#edit-role').drupalSetSummary(checkboxesSummary);
$context.find('fieldset#edit-role').drupalSetSummary(function (context) {
var vals = [];
$(context).find('input[type="checkbox"]:checked').each(function () {
vals.push($.trim($(this).next('label').text()));
});
if (!vals.length) {
vals.push(Drupal.t('Not restricted'));
$('#edit-path').drupalSetSummary(function (context) {
var $pages = $(context).find('textarea[name="pages"]');
if (!$pages.val()) {
return Drupal.t('Not restricted');
}
else {
return Drupal.t('Restricted to certain pages');
}
return vals.join(', ');
});
$context.find('fieldset#edit-user').drupalSetSummary(function (context) {
$('#edit-user').drupalSetSummary(function (context) {
var $radio = $(context).find('input[name="custom"]:checked');
if ($radio.val() == 0) {
return Drupal.t('Not customizable');
......@@ -83,7 +65,7 @@ Drupal.behaviors.blockDrag = {
return;
}
var table = $('table#blocks');
var table = $('#blocks');
var tableDrag = Drupal.tableDrag.blocks; // Get the blocks tableDrag object.
// Add a handler for when a row is swapped, update empty regions.
......
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