Start top menu refactor, added elementtree to requirements

This commit is contained in:
Roberto Rosario
2012-03-16 21:07:53 -04:00
parent 7ccab82fd4
commit dcf568ead5
20 changed files with 113 additions and 85 deletions

View File

@@ -8,7 +8,7 @@ from django.contrib.auth.management import create_superuser
from django.dispatch import receiver
from django.db.models.signals import post_syncdb
from navigation.api import bind_links, register_top_menu
from navigation.api import bind_links, register_top_menu, Link
from .conf import settings as common_settings
from .utils import validate_path
@@ -17,18 +17,16 @@ from .utils import validate_path
def has_usable_password(context):
return context['request'].user.has_usable_password
password_change_view = {'text': _(u'change password'), 'view': 'password_change_view', 'famfam': 'computer_key', 'condition': has_usable_password}
current_user_details = {'text': _(u'user details'), 'view': 'current_user_details', 'famfam': 'vcard'}
current_user_edit = {'text': _(u'edit details'), 'view': 'current_user_edit', 'famfam': 'vcard_edit'}
bind_links(['current_user_details', 'current_user_edit', 'password_change_view'], [current_user_details, current_user_edit, password_change_view], menu_name='secondary_menu')
about_view = {'text': _('about'), 'view': 'about_view', 'famfam': 'information'}
license_view = {'text': _('license'), 'view': 'license_view', 'famfam': 'script'}
password_change_view = Link(text=_(u'change password'), view='password_change_view', sprite='computer_key', condition=has_usable_password)
current_user_details = Link(text=_(u'user details'), view='current_user_details', sprite='vcard')
current_user_edit = Link(text=_(u'edit details'), view='current_user_edit', sprite='vcard_edit')
about_view = Link(text=_('about'), view='about_view', sprite='information')
license_view = Link(text=_('license'), view='license_view', sprite='script')
bind_links(['about_view', 'license_view'], [about_view, license_view], menu_name='secondary_menu')
bind_links(['current_user_details', 'current_user_edit', 'password_change_view'], [current_user_details, current_user_edit, password_change_view], menu_name='secondary_menu')
register_top_menu('about', link={'text': _(u'about'), 'view': 'about_view', 'famfam': 'information'}, position=-1)
register_top_menu('about', link=Link(text=_(u'about'), view='about_view', sprite='information'), position=-1)
@receiver(post_syncdb, dispatch_uid='create_superuser', sender=auth_models)