views:

154

answers:

1

When an admin fieldset is given the class "collapse", it is rendered with a Show/Hide link installed by CollapsedFieldset.js which collapses or expands it.

In all cases where the collapse class appears, I'd like the link to be the whole fieldset box (or a div of that dimension) instead of just the word "Show".

What is the best way to "override" the default admin Javascript file? If there were an extrahead block in the template stacked.html, it seems like that would be the way to do it, but there is none - maybe because at the time stacked.html is used, the head has already been written?

I could just modify the admin Javascript file but that doesn't seem right.

+1  A: 

You could probably add your own Javascript to the page that just removes the link created by CollapsedFieldset.js and creates the link as you want it. The JS required wouldn't be more than a couple lines of jQuery, which you'd ideally include in the inner Media class of a custom Form subclass that you use in your ModelAdmin subclass (though it needs to appear after CollapsedFieldsets.js and I haven't checked whether it would).

Another alternative would be to ignore class="collapse" altogether and just apply your own class to the fieldset, and then include your own Javascript (via the inner Media class, as above) that duplicates all the functionality of CollapsedFieldset.js, except done the way you want it.

Carl Meyer