Message from discussion
make menu easier to extend
MIME-Version: 1.0
Received: by 10.100.37.20 with SMTP id k20mr252621ank.7.1222125907402; Mon, 22
Sep 2008 16:25:07 -0700 (PDT)
Date: Mon, 22 Sep 2008 16:25:07 -0700 (PDT)
In-Reply-To: <09c09b7e-5c06-431a-ba9e-0184b3620736@r15g2000prd.googlegroups.com>
X-IP: 199.4.160.10
References: <3d144928-890e-4246-aefa-6b0b6bc585b7@x16g2000prn.googlegroups.com>
<09c09b7e-5c06-431a-ba9e-0184b3620736@r15g2000prd.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.0.2) Gecko/2008091618 Firefox/3.0.2,gzip(gfe),gzip(gfe)
Message-ID: <efdea28d-e8fa-4e7e-b9a3-fcf0341aca2f@8g2000hse.googlegroups.com>
Subject: Re: make menu easier to extend
From: Dougn <doug.napole...@gmail.com>
To: django-hotclub <django-hotclub@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
I would recommend just using unregistered plugins to get the job done:
site_base.html:
{% load app_plugins %}
{% block right_tab %}
{% if user.is_authenticated %}
<table>
<tr>{% plugin_point "menu" %}</tr>
</table>
{% endif %}
{% endblock right_tab %}
templates/appname/plugins/menu.html:
{% extends "pinax/menu.html" %}
{% block tab_class %}rtab_tribes{% endblock tab_class %}
{% block tab_link%}<a href=3D"{% url tribes.views.tribes %}">{% trans
"Tribes" %}</a>{% endblock tab_link %}
templates/pinax/menu.html:
<td class=3D"tab {% block tab_class %}{% endblock %}"><div>{% block
tab_link %}{% endblock %}</div></td>
Then menu items will show up in whatever order they are listed in
INSTALLED_APPS
Not in installed apps? wont show up.
Want to add a menu item? add a template.
-Doug
On Sep 19, 3:35=A0am, Eric Drechsel <ericd...@gmail.com> wrote:
> I looked athttp://www.djangosnippets.org/snippets/347/, which seems
> pretty nice for outputting menus with active links and such, but it
> doesn't address pluggability. However, since the main menu just =A0in
> settings.py, one could follow the pattern set by the url mapping
> system, and move the menu definition out into a global menu.py that
> includes from the menu.py from individual apps.
>
> the data structure in the snippet probably isn't quite right (does it
> support nested menus? need to look closer). there are some nice things
> about the data structure for the menu system in Drupal, might be a
> good starting point.
>
> On Sep 18, 1:46=A0pm, Eric Drechsel <ericd...@gmail.com> wrote:
>
> > I'm customizing Pinax, and I see that there is work to be done to make
> > the template structure easier to work with in customized sites.
> > Ideally it should be possible to customize the global "look" without
> > modifying Pinax's app templates, and to add new apps to main
> > navigation simply by following established conventions.
>
> > Unfortunately, the site-menu's active navigation tab markup is funky
> > to work around limitations of the template system without introducing
> > the concept of dynamic menus, and each new tab requires a line be
> > added to base.css, even though they all act the same.
>
> > I'd like to help work on making pinax easier to extend (primarily a
> > lack of documentation). This task seems like a good starting point in
> > Pinax for me, a newish Django developer. I'm posting to the list
> > rather than the tracker to solicit feedback from as wide a group as
> > possible. Have you found a great way to do extensible menus with
> > Django? A method exclusively using templates would be preferred,