diff --git a/mayan/apps/acls/views.py b/mayan/apps/acls/views.py index 301bfd3729..2ed5b48ab8 100644 --- a/mayan/apps/acls/views.py +++ b/mayan/apps/acls/views.py @@ -53,10 +53,7 @@ def acl_list_for(request, obj, extra_context=None): 'hide_object': True, 'access_object': AccessObject.encapsulate(obj), 'object': obj, - 'navigation_object_list': [ - {'object': 'object'}, - {'object': 'access_object'} - ], + 'navigation_object_list': ['object', 'access_object'], } if extra_context: @@ -123,10 +120,7 @@ def acl_detail_for(request, actor, obj): 'object_gid': lambda x: obj.gid, }, 'access_object': obj, - 'navigation_object_list': [ - {'object': 'object'}, - {'object': 'access_object'} - ], + 'navigation_object_list': ['object', 'access_object'], } return render_to_response('appearance/generic_detail.html', context, @@ -347,10 +341,7 @@ def acl_new_holder_for(request, obj, extra_context=None, navigation_object=None) 'submit_label': _('Select'), 'object': obj, 'access_object': AccessObject.encapsulate(obj), - 'navigation_object_list': [ - {'object': 'object'}, - {'object': 'access_object'}, - ], + 'navigation_object_list': ['object', 'access_object'], } if extra_context: diff --git a/mayan/apps/document_indexing/views.py b/mayan/apps/document_indexing/views.py index be306918a9..7f6cd0692c 100644 --- a/mayan/apps/document_indexing/views.py +++ b/mayan/apps/document_indexing/views.py @@ -98,7 +98,7 @@ def index_setup_edit(request, index_pk): 'title': _('Edit index: %s') % index, 'form': form, 'index': index, - 'navigation_object_name': 'index', + 'navigation_object_list': ['index'], }, context_instance=RequestContext(request)) @@ -127,7 +127,7 @@ def index_setup_delete(request, index_pk): context = { 'index': index, - 'navigation_object_name': 'index', + 'navigation_object_list': ['index'], 'delete_view': True, 'previous': previous, 'next': next, @@ -152,7 +152,7 @@ def index_setup_view(request, index_pk): 'object_list': object_list, 'index': index, 'list_object_variable_name': 'node', - 'navigation_object_name': 'index', + 'navigation_object_list': ['index'], 'title': _('Tree template nodes for index: %s') % index, 'hide_object': True, 'extra_columns': [ @@ -184,8 +184,8 @@ def index_setup_document_types(request, index_pk): right_list_title=_('Document types for index: %s') % index, decode_content_type=True, extra_context={ - 'navigation_object_name': 'index', 'index': index, + 'navigation_object_list': ['index'], } ) @@ -209,10 +209,10 @@ def template_node_create(request, parent_pk): form = IndexTemplateNodeForm(initial={'index': parent_node.index, 'parent': parent_node}) return render_to_response('appearance/generic_form.html', { - 'title': _('Create child node'), 'form': form, 'index': parent_node.index, - 'navigation_object_name': 'index', + 'navigation_object_list': ['index'], + 'title': _('Create child node'), }, context_instance=RequestContext(request)) @@ -234,15 +234,11 @@ def template_node_edit(request, node_pk): form = IndexTemplateNodeForm(instance=node) return render_to_response('appearance/generic_form.html', { - 'title': _('Edit index template node: %s') % node, 'form': form, 'index': node.index, + 'navigation_object_list': ['index', 'node'], 'node': node, - - 'navigation_object_list': [ - {'object': 'index', 'name': _('Index')}, - {'object': 'node', 'name': _('Node')} - ], + 'title': _('Edit index template node: %s') % node, }, context_instance=RequestContext(request)) @@ -271,16 +267,12 @@ def template_node_delete(request, node_pk): context = { 'delete_view': True, - 'previous': previous, - 'next': next, - 'title': _('Are you sure you with to delete the index template node: %s?') % node, 'index': node.index, + 'navigation_object_list': ['index', 'node'], + 'next': next, 'node': node, - - 'navigation_object_list': [ - {'object': 'index', 'name': _('Index')}, - {'object': 'node', 'name': _('Node')} - ], + 'title': _('Are you sure you with to delete the index template node: %s?') % node, + 'previous': previous, } return render_to_response('appearance/generic_confirm.html', context, diff --git a/mayan/apps/document_states/views.py b/mayan/apps/document_states/views.py index 7aa695b7c9..8d2f2fc0b3 100644 --- a/mayan/apps/document_states/views.py +++ b/mayan/apps/document_states/views.py @@ -86,15 +86,8 @@ class WorkflowInstanceDetailView(SingleObjectListView): ) context = { + 'navigation_object_list': ['object', 'workflow_instance'], 'object': self.get_workflow_instance().document, - 'workflow_instance': self.get_workflow_instance(), - 'navigation_object_list': [ - {'object': 'object'}, - {'object': 'workflow_instance'} - ], - 'title': _('Detail of workflow: %(workflow)s') % { - 'workflow': self.get_workflow_instance() - }, 'subtemplates_list': [ { 'name': 'appearance/generic_detail_subtemplate.html', @@ -110,7 +103,11 @@ class WorkflowInstanceDetailView(SingleObjectListView): 'hide_object': True, } } - ] + ], + 'title': _('Detail of workflow: %(workflow)s') % { + 'workflow': self.get_workflow_instance() + }, + 'workflow_instance': self.get_workflow_instance(), } return context @@ -146,14 +143,11 @@ class WorkflowInstanceTransitionView(FormView): context.update( { + 'navigation_object_list': ['object', 'workflow_instance'], 'object': self.get_workflow_instance().document, - 'workflow_instance': self.get_workflow_instance(), - 'navigation_object_list': [ - {'object': 'object'}, - {'object': 'workflow_instance'} - ], - 'title': _('Do transition for workflow: %s') % self.get_workflow_instance(), 'submit_label': _('Submit'), + 'title': _('Do transition for workflow: %s') % self.get_workflow_instance(), + 'workflow_instance': self.get_workflow_instance(), } ) @@ -270,12 +264,9 @@ class SetupWorkflowStateDeleteView(SingleObjectDeleteView): context.update( { + 'navigation_object_list': ['object', 'workflow_instance'], 'object': self.get_object().workflow, 'workflow_instance': self.get_object(), - 'navigation_object_list': [ - {'object': 'object'}, - {'object': 'workflow_instance'} - ], } ) @@ -295,12 +286,9 @@ class SetupWorkflowStateEditView(SingleObjectEditView): context.update( { + 'navigation_object_list': ['object', 'workflow_instance'], 'object': self.get_object().workflow, 'workflow_instance': self.get_object(), - 'navigation_object_list': [ - {'object': 'object'}, - {'object': 'workflow_instance'} - ], } ) @@ -398,11 +386,8 @@ class SetupWorkflowTransitionDeleteView(SingleObjectDeleteView): context.update( { 'object': self.get_object().workflow, + 'navigation_object_list': ['object', 'workflow_instance'], 'workflow_instance': self.get_object(), - 'navigation_object_list': [ - {'object': 'object'}, - {'object': 'workflow_instance'} - ], } ) @@ -422,12 +407,9 @@ class SetupWorkflowTransitionEditView(SingleObjectEditView): context.update( { + 'navigation_object_list': ['object', 'workflow_instance'], 'object': self.get_object().workflow, 'workflow_instance': self.get_object(), - 'navigation_object_list': [ - {'object': 'object'}, - {'object': 'workflow_instance'} - ], } ) diff --git a/mayan/apps/documents/views.py b/mayan/apps/documents/views.py index 8e2b226437..f53298ff0e 100644 --- a/mayan/apps/documents/views.py +++ b/mayan/apps/documents/views.py @@ -583,14 +583,14 @@ def document_page_view(request, document_page_id): zoom_text = '' return render_to_response('appearance/generic_detail.html', { - 'page': document_page, 'access_object': document_page.document, - 'navigation_object_list': [{'object': 'page'}], - 'web_theme_hide_menus': True, 'form': document_page_form, - 'title': ' '.join([base_title, zoom_text]), - 'zoom': zoom, + 'navigation_object_list': ['page'], + 'page': document_page, 'rotation': rotation, + 'title': ' '.join([base_title, zoom_text]), + 'web_theme_hide_menus': True, + 'zoom': zoom, }, context_instance=RequestContext(request)) @@ -608,12 +608,12 @@ def document_page_text(request, document_page_id): document_page_form = DocumentPageForm_text(instance=document_page) return render_to_response('appearance/generic_detail.html', { - 'page': document_page, - 'navigation_object_list': [{'object': 'page'}], - 'web_theme_hide_menus': True, - 'form': document_page_form, - 'title': _('Details for: %s') % document_page, 'access_object': document_page.document, + 'form': document_page_form, + 'page': document_page, + 'navigation_object_list': ['page'], + 'title': _('Details for: %s') % document_page, + 'web_theme_hide_menus': True, }, context_instance=RequestContext(request)) @@ -637,12 +637,12 @@ def document_page_edit(request, document_page_id): form = DocumentPageForm_edit(instance=document_page) return render_to_response('appearance/generic_form.html', { + 'access_object': document_page.document, 'form': form, + 'navigation_object_list': ['page'], 'page': document_page, - 'navigation_object_list': [{'object': 'page'}], 'title': _('Edit: %s') % document_page, 'web_theme_hide_menus': True, - 'access_object': document_page.document, }, context_instance=RequestContext(request)) @@ -887,11 +887,11 @@ def document_type_edit(request, document_type_id): form = DocumentTypeForm(instance=document_type) return render_to_response('appearance/generic_form.html', { - 'title': _('Edit document type: %s') % document_type, - 'form': form, - 'navigation_object_list': [{'object': 'document_type'}], 'document_type': document_type, - 'next': next + 'form': form, + 'navigation_object_list': ['document_type'], + 'next': next, + 'title': _('Edit document type: %s') % document_type, }, context_instance=RequestContext(request)) @@ -915,13 +915,13 @@ def document_type_delete(request, document_type_id): return HttpResponseRedirect(next) context = { - 'document_type': document_type, 'delete_view': True, - 'navigation_object_list': [{'object': 'document_type'}], + 'document_type': document_type, + 'message': _('All documents of this type will be deleted too.'), + 'navigation_object_list': ['document_type'], 'next': next, 'previous': previous, 'title': _('Are you sure you wish to delete the document type: %s?') % document_type, - 'message': _('All documents of this type will be deleted too.'), } return render_to_response('appearance/generic_confirm.html', context, @@ -955,18 +955,18 @@ def document_type_filename_list(request, document_type_id): document_type = get_object_or_404(DocumentType, pk=document_type_id) context = { - 'object_list': document_type.filenames.all(), - 'title': _('Filenames for document type: %s') % document_type, - 'navigation_object_list': [{'object': 'document_type'}], 'document_type': document_type, - 'list_object_variable_name': 'filename', - 'hide_link': True, 'extra_columns': [ { 'name': _('Enabled'), 'attribute': encapsulate(lambda x: two_state_template(x.enabled)), } - ] + ], + 'hide_link': True, + 'list_object_variable_name': 'filename', + 'navigation_object_list': ['document_type'], + 'object_list': document_type.filenames.all(), + 'title': _('Filenames for document type: %s') % document_type, } return render_to_response('appearance/generic_list.html', context, @@ -994,17 +994,14 @@ def document_type_filename_edit(request, document_type_filename_id): form = DocumentTypeFilenameForm(instance=document_type_filename) return render_to_response('appearance/generic_form.html', { + 'document_type': document_type_filename.document_type, + 'filename': document_type_filename, + 'form': form, + 'navigation_object_list': ['document_type', 'filename'], + 'next': next, 'title': _('Edit filename "%(filename)s" from document type "%(document_type)s"') % { 'document_type': document_type_filename.document_type, 'filename': document_type_filename }, - 'form': form, - 'next': next, - 'filename': document_type_filename, - 'document_type': document_type_filename.document_type, - 'navigation_object_list': [ - {'object': 'document_type'}, - {'object': 'filename'} - ], }, context_instance=RequestContext(request)) @@ -1029,14 +1026,11 @@ def document_type_filename_delete(request, document_type_filename_id): context = { 'delete_view': True, - 'previous': previous, - 'next': next, - 'filename': document_type_filename, 'document_type': document_type_filename.document_type, - 'navigation_object_list': [ - {'object': 'document_type'}, - {'object': 'filename'} - ], + 'filename': document_type_filename, + 'previous': previous, + 'navigation_object_list': ['document_type', 'filename'], + 'next': next, 'title': _('Are you sure you wish to delete the filename: %(filename)s, from document type "%(document_type)s"?') % { 'document_type': document_type_filename.document_type, 'filename': document_type_filename }, @@ -1070,12 +1064,10 @@ def document_type_filename_create(request, document_type_id): form = DocumentTypeFilenameForm_create() return render_to_response('appearance/generic_form.html', { - 'title': _('Create filename for document type: %s') % document_type, - 'form': form, 'document_type': document_type, - 'navigation_object_list': [ - {'object': 'document_type'}, - ], + 'form': form, + 'navigation_object_list': ['document_type'], + 'title': _('Create filename for document type: %s') % document_type, }, context_instance=RequestContext(request)) @@ -1177,7 +1169,7 @@ def document_page_transformation_list(request, document_page_id): context = { 'object_list': document_page.documentpagetransformation_set.all(), 'page': document_page, - 'navigation_object_name': 'page', + 'navigation_object_list': ['page'], 'title': _('Transformations for: %s') % document_page, 'web_theme_hide_menus': True, 'list_object_variable_name': 'transformation', @@ -1215,7 +1207,7 @@ def document_page_transformation_create(request, document_page_id): return render_to_response('appearance/generic_form.html', { 'form': form, 'page': document_page, - 'navigation_object_name': 'page', + 'navigation_object_list': ['page'], 'title': _('Create new transformation for page: %(page)s of document: %(document)s') % { 'page': document_page.page_number, 'document': document_page.document}, 'web_theme_hide_menus': True, @@ -1242,15 +1234,12 @@ def document_page_transformation_edit(request, document_page_transformation_id): return render_to_response('appearance/generic_form.html', { 'form': form, - 'transformation': document_page_transformation, + 'navigation_object_list': ['page', 'transformation'], 'page': document_page_transformation.document_page, - 'navigation_object_list': [ - {'object': 'page'}, - {'object': 'transformation', 'name': _('Transformation')} - ], 'title': _('Edit transformation "%(transformation)s" for: %(document_page)s') % { 'transformation': document_page_transformation.get_transformation_display(), 'document_page': document_page_transformation.document_page}, + 'transformation': document_page_transformation, 'web_theme_hide_menus': True, }, context_instance=RequestContext(request)) @@ -1273,15 +1262,12 @@ def document_page_transformation_delete(request, document_page_transformation_id return render_to_response('appearance/generic_confirm.html', { 'delete_view': True, + 'navigation_object_list': ['page', 'transformation'], 'page': document_page_transformation.document_page, - 'transformation': document_page_transformation, - 'navigation_object_list': [ - {'object': 'page'}, - {'object': 'transformation', 'name': _('Transformation')} - ], + 'previous': previous, 'title': _('Are you sure you wish to delete transformation "%(transformation)s" for: %(document_page)s') % { 'transformation': document_page_transformation.get_transformation_display(), 'document_page': document_page_transformation.document_page}, + 'transformation': document_page_transformation, 'web_theme_hide_menus': True, - 'previous': previous, }, context_instance=RequestContext(request)) diff --git a/mayan/apps/linking/views.py b/mayan/apps/linking/views.py index 05243c4ea9..abb061168d 100644 --- a/mayan/apps/linking/views.py +++ b/mayan/apps/linking/views.py @@ -285,17 +285,13 @@ def smart_link_condition_edit(request, smart_link_condition_pk): form = SmartLinkConditionForm(instance=smart_link_condition) return render_to_response('appearance/generic_form.html', { - 'form': form, - 'title': _('Edit smart link condition'), - 'next': next, - 'previous': previous, 'condition': smart_link_condition, + 'form': form, + 'navigation_object_list': ['object', 'condition'], + 'next': next, 'object': smart_link_condition.smart_link, - 'navigation_object_list': [ - {'object': 'object', 'name': _('Smart link')}, - {'object': 'condition', 'name': _('Condition')} - ], - + 'previous': previous, + 'title': _('Edit smart link condition'), }, context_instance=RequestContext(request)) @@ -322,16 +318,13 @@ def smart_link_condition_delete(request, smart_link_condition_pk): return HttpResponseRedirect(next) return render_to_response('appearance/generic_confirm.html', { - 'delete_view': True, 'condition': smart_link_condition, - 'object': smart_link_condition.smart_link, - 'navigation_object_list': [ - {'object': 'object', 'name': _('Smart link')}, - {'object': 'condition', 'name': _('Condition')} - ], - 'title': _('Are you sure you wish to delete smart link condition: "%s"?') % smart_link_condition, + 'delete_view': True, + 'navigation_object_list': ['object', 'condition'], 'next': next, + 'object': smart_link_condition.smart_link, 'previous': previous, + 'title': _('Are you sure you wish to delete smart link condition: "%s"?') % smart_link_condition, }, context_instance=RequestContext(request)) diff --git a/mayan/apps/main/apps.py b/mayan/apps/main/apps.py index 60b1bbafe2..b4de5e8d06 100644 --- a/mayan/apps/main/apps.py +++ b/mayan/apps/main/apps.py @@ -16,7 +16,7 @@ class MainApp(apps.AppConfig): verbose_name = _('Main') def ready(self): - menu_main.bind_links(links=[link_setup], position=-2) + menu_main.bind_links(links=[link_setup], position=1) menu_main.bind_links(links=[link_tools], position=-3) menu_setup.bind_links(links=[link_admin_site]) menu_tools.bind_links(links=[link_maintenance_menu]) diff --git a/mayan/apps/metadata/views.py b/mayan/apps/metadata/views.py index c4ca208363..85e2aacd5f 100644 --- a/mayan/apps/metadata/views.py +++ b/mayan/apps/metadata/views.py @@ -472,8 +472,8 @@ def setup_document_type_metadata(request, document_type_id): remove_method=lambda x: x.delete(), extra_context={ 'document_type': document_type, - 'navigation_object_name': 'document_type', 'main_title': _('Optional metadata types for document type: %s') % document_type, + 'navigation_object_list': ['document_type'], }, decode_content_type=True, ) @@ -492,8 +492,8 @@ def setup_document_type_metadata_required(request, document_type_id): remove_method=lambda x: x.delete(), extra_context={ 'document_type': document_type, - 'navigation_object_name': 'document_type', 'main_title': _('Required metadata types for document type: %s') % document_type, + 'navigation_object_list': ['document_type'], }, decode_content_type=True, ) diff --git a/mayan/apps/navigation/classes.py b/mayan/apps/navigation/classes.py index e07e421b83..b1f997342e 100644 --- a/mayan/apps/navigation/classes.py +++ b/mayan/apps/navigation/classes.py @@ -43,7 +43,7 @@ class Menu(object): def bind_links(self, links, sources=None, position=0): """ - Associate a link to a model, a view, or an url inside this menu + Associate a link to a model, a view inside this menu """ if sources: for source in sources: @@ -79,12 +79,12 @@ class Menu(object): result = [] - navigation_object_list = context.get('navigation_object_list', [{'object': 'object'}]) + navigation_object_list = context.get('navigation_object_list', ['object']) # Multiple objects for navigation_object in navigation_object_list: try: - resolved_navigation_object_list.append(Variable(navigation_object['object']).resolve(context)) + resolved_navigation_object_list.append(Variable(navigation_object).resolve(context)) except VariableDoesNotExist: pass diff --git a/mayan/apps/sources/views.py b/mayan/apps/sources/views.py index dd96f55c16..0c6962300e 100644 --- a/mayan/apps/sources/views.py +++ b/mayan/apps/sources/views.py @@ -391,12 +391,12 @@ def setup_source_edit(request, source_id): form = form_class(instance=source) return render_to_response('appearance/generic_form.html', { - 'title': _('Edit source: %s') % source, 'form': form, - 'source': source, - 'navigation_object_name': 'source', + 'navigation_object_list': ['source'], 'next': next, + 'source': source, 'source_type': source.source_type, + 'title': _('Edit source: %s') % source, }, context_instance=RequestContext(request)) @@ -418,12 +418,12 @@ def setup_source_delete(request, source_id): return HttpResponseRedirect(redirect_view) context = { - 'title': _('Are you sure you wish to delete the source: %s?') % source, - 'source': source, - 'navigation_object_name': 'source', 'delete_view': True, + 'navigation_object_list': ['source'], 'previous': previous, + 'source': source, 'source_type': source.source_type, + 'title': _('Are you sure you wish to delete the source: %s?') % source, } return render_to_response('appearance/generic_confirm.html', context, @@ -449,10 +449,10 @@ def setup_source_create(request, source_type): form = form_class() return render_to_response('appearance/generic_form.html', { - 'title': _('Create new source of type: %s') % cls.class_fullname(), 'form': form, + 'navigation_object_list': ['source'], 'source_type': source_type, - 'navigation_object_name': 'source', + 'title': _('Create new source of type: %s') % cls.class_fullname(), }, context_instance=RequestContext(request)) @@ -462,11 +462,6 @@ def setup_source_transformation_list(request, source_id): source = get_object_or_404(Source.objects.select_subclasses(), pk=source_id) context = { - 'object_list': SourceTransformation.transformations.get_for_object(source), - 'title': _('Transformations for: %s') % source.fullname(), - 'source': source, - 'navigation_object_name': 'source', - 'list_object_variable_name': 'transformation', 'extra_columns': [ {'name': _('Order'), 'attribute': 'order'}, {'name': _('Transformation'), 'attribute': encapsulate(lambda x: x.get_transformation_display())}, @@ -474,6 +469,11 @@ def setup_source_transformation_list(request, source_id): ], 'hide_link': True, 'hide_object': True, + 'list_object_variable_name': 'transformation', + 'navigation_object_list': ['source'], + 'object_list': SourceTransformation.transformations.get_for_object(source), + 'source': source, + 'title': _('Transformations for: %s') % source.fullname(), } return render_to_response('appearance/generic_list.html', context, @@ -500,15 +500,12 @@ def setup_source_transformation_edit(request, transformation_id): form = SourceTransformationForm(instance=source_transformation) return render_to_response('appearance/generic_form.html', { - 'title': _('Edit transformation: %s') % source_transformation, 'form': form, + 'navigation_object_list': ['source', 'transformation'], + 'next': next, 'source': source_transformation.content_object, 'transformation': source_transformation, - 'navigation_object_list': [ - {'object': 'source', 'name': _('Source')}, - {'object': 'transformation', 'name': _('Transformation')} - ], - 'next': next, + 'title': _('Edit transformation: %s') % source_transformation, }, context_instance=RequestContext(request)) @@ -531,16 +528,13 @@ def setup_source_transformation_delete(request, transformation_id): return render_to_response('appearance/generic_confirm.html', { 'delete_view': True, - 'transformation': source_transformation, + 'navigation_object_list': ['source', 'transformation'], + 'previous': previous, 'source': source_transformation.content_object, - 'navigation_object_list': [ - {'object': 'source', 'name': _('Source')}, - {'object': 'transformation', 'name': _('Transformation')} - ], 'title': _('Are you sure you wish to delete source transformation "%(transformation)s"') % { 'transformation': source_transformation.get_transformation_display(), }, - 'previous': previous, + 'transformation': source_transformation, }, context_instance=RequestContext(request)) @@ -568,6 +562,6 @@ def setup_source_transformation_create(request, source_id): return render_to_response('appearance/generic_form.html', { 'form': form, 'source': source, - 'navigation_object_name': 'source', + 'navigation_object_list': ['source'], 'title': _('Create new transformation for source: %s') % source, }, context_instance=RequestContext(request))