Index: misc/collapse.js =================================================================== RCS file: /cvs/drupal/drupal/misc/collapse.js,v retrieving revision 1.26 diff -u -p -r1.26 collapse.js --- misc/collapse.js 16 Oct 2009 19:20:34 -0000 1.26 +++ misc/collapse.js 7 Nov 2009 02:41:53 -0000 @@ -10,8 +10,11 @@ Drupal.toggleFieldset = function (fields // that alters the default submit button behavior. var content = $('> div:not(.action)', fieldset); $(fieldset) - .removeClass('collapsed') - .trigger({ type: 'collapsed', value: false }); + .removeClass('collapsed') + .trigger({ type: 'collapsed', value: false }) + .find('> legend > a > span.element-invisible') + .empty() + .append(Drupal.t('Hide')); content.hide(); content.slideDown({ duration: 'fast', @@ -31,7 +34,11 @@ Drupal.toggleFieldset = function (fields $('div.action', fieldset).hide(); $(fieldset).trigger({ type: 'collapsed', value: true }); var content = $('> div:not(.action)', fieldset).slideUp('fast', function () { - $(this.parentNode).addClass('collapsed'); + $(this.parentNode) + .addClass('collapsed') + .find('> legend > a > span.element-invisible') + .empty() + .append(Drupal.t('Show')); this.parentNode.animating = false; }); } @@ -65,17 +72,17 @@ Drupal.behaviors.collapse = { } var summary = $(''); - fieldset. - bind('summaryUpdated', function () { - var text = $.trim(fieldset.getSummary()); - summary.html(text ? ' (' + text + ')' : ''); - }) - .trigger('summaryUpdated'); + fieldset.bind('summaryUpdated', function () { + var text = $.trim(fieldset.getSummary()); + summary.html(text ? ' (' + text + ')' : ''); + }) + .trigger('summaryUpdated'); // Turn the legend into a clickable link and wrap the contents of the // fieldset in a div for easier animation. var text = this.innerHTML; - $(this).empty().append($('' + text + '').click(function () { + $(this).empty().append( + $('' + text + '').click(function () { var fieldset = $(this).parents('fieldset:first')[0]; // Don't animate multiple times. if (!fieldset.animating) { @@ -83,12 +90,18 @@ Drupal.behaviors.collapse = { Drupal.toggleFieldset(fieldset); } return false; - })) - .append(summary) - .after( - $('
') - .append(fieldset.children(':not(legend):not(.action)')) - ); + }) + .prepend( + $('') + .append(fieldset.hasClass('collapsed') ? Drupal.t('Show') : Drupal.t('Hide')) + .after(' ') + ) + ) + .append(summary) + .after( + $('') + .append(fieldset.children(':not(legend):not(.action)')) + ); }); } }; Index: modules/system/system.css =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.css,v retrieving revision 1.63 diff -u -p -r1.63 system.css --- modules/system/system.css 21 Sep 2009 08:52:41 -0000 1.63 +++ modules/system/system.css 7 Nov 2009 02:41:54 -0000 @@ -322,7 +322,7 @@ html.js fieldset.collapsed { html.js fieldset.collapsed * { display: none; } -html.js fieldset.collapsed legend { +html.js fieldset.collapsed legend, html.js fieldset.collapsed legend a span.element-invisible { display: block; overflow: hidden; }