Move common app links to a separate module

This commit is contained in:
Roberto Rosario
2014-07-18 18:44:28 -04:00
parent 7d0a562a76
commit de07f6f31c
2 changed files with 22 additions and 16 deletions

View File

@@ -15,25 +15,16 @@ from south.signals import post_migrate
from navigation.api import register_links, register_top_menu
from .conf import settings as common_settings
from .conf.settings import (AUTO_CREATE_ADMIN, AUTO_ADMIN_USERNAME,
AUTO_ADMIN_PASSWORD, TEMPORARY_DIRECTORY)
from .conf.settings import (AUTO_ADMIN_USERNAME, AUTO_ADMIN_PASSWORD,
AUTO_CREATE_ADMIN, TEMPORARY_DIRECTORY)
from .links import (link_about, link_current_user_details,
link_current_user_edit, link_license,
link_password_change)
from .models import AutoAdminSingleton
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'}
register_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'}
register_links(['about_view', 'license_view'], [about_view, license_view], menu_name='secondary_menu')
register_links(['current_user_details', 'current_user_edit', 'password_change_view'], [link_current_user_details, link_current_user_edit, link_password_change], menu_name='secondary_menu')
register_links(['about_view', 'license_view', 'form_view'], [link_about, link_license], menu_name='secondary_menu')
register_top_menu('about', link={'text': _(u'about'), 'view': 'about_view', 'famfam': 'information'}, position=-1)

View File

@@ -0,0 +1,15 @@
from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
def has_usable_password(context):
return context['request'].user.has_usable_password
link_password_change = {'text': _(u'change password'), 'view': 'password_change_view', 'famfam': 'computer_key', 'condition': has_usable_password}
link_current_user_details = {'text': _(u'user details'), 'view': 'current_user_details', 'famfam': 'vcard'}
link_current_user_edit = {'text': _(u'edit details'), 'view': 'current_user_edit', 'famfam': 'vcard_edit'}
link_about = {'text': _('about'), 'view': 'about_view', 'famfam': 'information'}
link_license = {'text': _('license'), 'view': 'license_view', 'famfam': 'script'}