Rename link 'class' attribute with 'klass' to avoid any conflicts. Fix django_gpg links. Remove 'dont_mark_active', 'conditional_highlight', and 'extra_navigation_links' features. Inject 'resolved_objects' into context before resolving links. Add check for ACLs when there is a resolved object present. Re-add remove_from_query and keep_query support. Use URLNode to resolve link this way the resolver work exactly as Django's {% url %} tag and saves some code duplicity.

This commit is contained in:
Roberto Rosario
2015-04-05 03:24:36 -04:00
parent db340513d0
commit e648975aff
7 changed files with 86 additions and 330 deletions

View File

@@ -19,11 +19,11 @@ from .permissions import (
link_document_create_multiple = Link(icon='fa fa-upload', permissions=[PERMISSION_DOCUMENT_CREATE], text=_('New document'), view='sources:document_create_multiple')
link_document_create_siblings = Link(permissions=[PERMISSION_DOCUMENT_CREATE], text=_('Clone'), view='sources:document_create_siblings', args='object.id')
link_setup_sources = Link(icon='fa fa-upload', permissions=[PERMISSION_SOURCES_SETUP_VIEW], text=_('Sources'), view='sources:setup_source_list')
link_setup_source_create_imap_email = Link(conditional_highlight=lambda context: context.get('source_type') == SOURCE_CHOICE_EMAIL_IMAP and 'source' not in context, permissions=[PERMISSION_SOURCES_SETUP_CREATE], text=_('Add new IMAP email'), view='sources:setup_source_create', args='"%s"' % SOURCE_CHOICE_EMAIL_IMAP)
link_setup_source_create_pop3_email = Link(conditional_highlight=lambda context: context.get('source_type') == SOURCE_CHOICE_EMAIL_POP3 and 'source' not in context, permissions=[PERMISSION_SOURCES_SETUP_CREATE], text=_('Add new POP3 email'), view='sources:setup_source_create', args='"%s"' % SOURCE_CHOICE_EMAIL_POP3)
link_setup_source_create_staging_folder = Link(conditional_highlight=lambda context: context.get('source_type') == SOURCE_CHOICE_STAGING and 'source' not in context, permissions=[PERMISSION_SOURCES_SETUP_CREATE], text=_('Add new staging folder'), view='sources:setup_source_create', args='"%s"' % SOURCE_CHOICE_STAGING)
link_setup_source_create_watch_folder = Link(conditional_highlight=lambda context: context.get('source_type') == SOURCE_CHOICE_WATCH and 'source' not in context, permissions=[PERMISSION_SOURCES_SETUP_CREATE], text=_('Add new watch folder'), view='sources:setup_source_create', args='"%s"' % SOURCE_CHOICE_WATCH)
link_setup_source_create_webform = Link(conditional_highlight=lambda context: context.get('source_type') == SOURCE_CHOICE_WEB_FORM and 'source' not in context, permissions=[PERMISSION_SOURCES_SETUP_CREATE], text=_('Add new webform source'), view='sources:setup_source_create', args='"%s"' % SOURCE_CHOICE_WEB_FORM)
link_setup_source_create_imap_email = Link(permissions=[PERMISSION_SOURCES_SETUP_CREATE], text=_('Add new IMAP email'), view='sources:setup_source_create', args='"%s"' % SOURCE_CHOICE_EMAIL_IMAP)
link_setup_source_create_pop3_email = Link(permissions=[PERMISSION_SOURCES_SETUP_CREATE], text=_('Add new POP3 email'), view='sources:setup_source_create', args='"%s"' % SOURCE_CHOICE_EMAIL_POP3)
link_setup_source_create_staging_folder = Link(permissions=[PERMISSION_SOURCES_SETUP_CREATE], text=_('Add new staging folder'), view='sources:setup_source_create', args='"%s"' % SOURCE_CHOICE_STAGING)
link_setup_source_create_watch_folder = Link(permissions=[PERMISSION_SOURCES_SETUP_CREATE], text=_('Add new watch folder'), view='sources:setup_source_create', args='"%s"' % SOURCE_CHOICE_WATCH)
link_setup_source_create_webform = Link(permissions=[PERMISSION_SOURCES_SETUP_CREATE], text=_('Add new webform source'), view='sources:setup_source_create', args='"%s"' % SOURCE_CHOICE_WEB_FORM)
link_setup_source_delete = Link(permissions=[PERMISSION_SOURCES_SETUP_DELETE], text=_('Delete'), view='sources:setup_source_delete', args=['source.pk'])
link_setup_source_edit = Link(text=_('Edit'), view='sources:setup_source_edit', args=['source.pk'], permissions=[PERMISSION_SOURCES_SETUP_EDIT])
link_setup_source_transformation_create = Link(permissions=[PERMISSION_SOURCES_SETUP_EDIT], text=_('Add transformation'), view='sources:setup_source_transformation_create', args=['source.pk'])