I've always put the most important apps up top in the admin, and less-
used stuff down toward the bottom. As far as I can tell, newforms-
admin insists on alphabetizing them, so it occurred to me it would be
nice to collapse the less-used apps to keep them out of the way.

So, after taking a quick look at Customizing the Admin Look and Feel
(http://www.djangoproject.com/documentation/tutorial02/) I made a copy
of the admin look and feel and start poking at it. Note: I used jquery
because I'm lazy and it makes this sort of thing very easy, but
there's no reason you have to. I suspect most of these functions are
tucked away in the admin js somewhere anyway.

First, the javascript to initally collapse all the apps. When a user
clicks on a header, open it, and store the preference in a cookie for
a year:

{% block extrahead %}
<script type="text/javascript" src="/media/js/jquery-c.js"></script>
<script type="text/javascript" src="/media/js/jquery.cookie.js"></
script>
<script type="text/javascript">
$(document).ready(function() {
        $('#content-main tbody').hide();
        $('#content-main caption').css({width:"488px"});
        $('#content-main table').each(function() {
                var cookie = $.cookie(this.id);
                if(cookie == "expanded") {
                        $(this).find('tbody').show();
                }
        });
        $('#content-main caption').click(function(){
                parent = this.parentNode.id;
                $(this).next().toggle();
                if ($(this).next().is(':visible')) {
                        $.cookie(parent, 'expanded', {expires:365});
                }
                else {
                        $.cookie(parent, null);
                }
        });
});
</script>
{% endblock %}

Aside from that, all I did was attach the appname to the app table as
an ID:
<table summary="..." id="{{app.name}}">

It's not for everyone, but I thought I'd pass it along.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to