redirect.js 992 B

1234567891011121314151617181920212223242526272829
  1. (function ($) {
  2. Drupal.behaviors.redirectFieldsetSummaries = {
  3. attach: function (context) {
  4. $('fieldset.redirect-list', context).drupalSetSummary(function (context) {
  5. if ($('table.redirect-list tbody td.empty', context).length) {
  6. return Drupal.t('No redirects');
  7. }
  8. else {
  9. var enabled_redirects = $('table.redirect-list tbody tr.redirect-enabled', context).length;
  10. var disabled_redirects = $('table.redirect-list tbody tr.redirect-disabled', context).length;
  11. var text = '';
  12. if (enabled_redirects > 0) {
  13. var text = Drupal.formatPlural(enabled_redirects, '1 enabled redirect', '@count enabled redirects');
  14. }
  15. if (disabled_redirects > 0) {
  16. if (text.length > 0) {
  17. text = text + '<br />';
  18. }
  19. text = text + Drupal.formatPlural(disabled_redirects, '1 disabled redirect', '@count disabled redirects');
  20. }
  21. return text;
  22. }
  23. });
  24. }
  25. };
  26. })(jQuery);