Remove maintenance tools menu entry, apps now register tools directly to the tools menu.
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
tools = {}
|
||||
|
||||
|
||||
def register_maintenance_links(links, title=None, namespace=None):
|
||||
namespace_dict = tools.get(namespace, {'title': None, 'links': []})
|
||||
namespace_dict['title'] = title
|
||||
for link in links:
|
||||
namespace_dict['links'].append(link)
|
||||
tools[namespace] = namespace_dict
|
||||
@@ -15,8 +15,7 @@ from .handlers import (
|
||||
from .links import (
|
||||
link_about, link_current_user_details, link_current_user_edit,
|
||||
link_current_user_locale_profile_details,
|
||||
link_current_user_locale_profile_edit, link_license,
|
||||
link_maintenance_menu, link_setup, link_tools
|
||||
link_current_user_locale_profile_edit, link_license, link_setup, link_tools
|
||||
)
|
||||
from .menus import (
|
||||
menu_facet, menu_main, menu_secondary, menu_setup, menu_tools
|
||||
@@ -62,7 +61,6 @@ class CommonApp(MayanAppConfig):
|
||||
],
|
||||
sources=['common:current_user_details', 'common:current_user_edit', 'common:current_user_locale_profile_details', 'common:current_user_locale_profile_edit', 'authentication:password_change_view', 'common:setup_list', 'common:tools_list']
|
||||
)
|
||||
menu_tools.bind_links(links=[link_maintenance_menu])
|
||||
|
||||
user_logged_in.connect(user_locale_profile_session_config, dispatch_uid='user_locale_profile_session_config', sender=settings.AUTH_USER_MODEL)
|
||||
post_save.connect(user_locale_profile_create, dispatch_uid='user_locale_profile_create', sender=settings.AUTH_USER_MODEL)
|
||||
|
||||
@@ -15,6 +15,5 @@ link_current_user_edit = Link(icon='fa fa-user', text=_('Edit details'), view='c
|
||||
link_current_user_locale_profile_details = Link(icon='fa fa-globe', text=_('Locale profile'), view='common:current_user_locale_profile_details')
|
||||
link_current_user_locale_profile_edit = Link(icon='fa fa-globe', text=_('Edit locale profile'), view='common:current_user_locale_profile_edit')
|
||||
link_license = Link(icon='fa fa-book', text=_('License'), view='common:license_view')
|
||||
link_maintenance_menu = Link(icon='fa fa-wrench', text=_('Maintenance'), view='common:maintenance_menu')
|
||||
link_setup = Link(icon='fa fa-gear', text=_('Setup'), view='common:setup_list')
|
||||
link_tools = Link(icon='fa fa-wrench', text=_('Tools'), view='common:tools_list')
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.views.generic import RedirectView
|
||||
|
||||
from .views import (
|
||||
AboutView, CurrentUserDetailsView, CurrentUserLocaleProfileDetailsView,
|
||||
HomeView, LicenseView, MaintenanceMenuView, SetupListView, ToolsListView
|
||||
HomeView, LicenseView, SetupListView, ToolsListView
|
||||
)
|
||||
|
||||
urlpatterns = patterns(
|
||||
@@ -14,7 +14,6 @@ urlpatterns = patterns(
|
||||
url(r'^$', HomeView.as_view(), name='home'),
|
||||
url(r'^about/$', AboutView.as_view(), name='about_view'),
|
||||
url(r'^license/$', LicenseView.as_view(), name='license_view'),
|
||||
url(r'^maintenance_menu/$', MaintenanceMenuView.as_view(), name='maintenance_menu'),
|
||||
url(r'^object/multiple/action/$', 'multi_object_action_view', name='multi_object_action_view'),
|
||||
url(r'^setup/$', SetupListView.as_view(), name='setup_list'),
|
||||
url(r'^tools/$', ToolsListView.as_view(), name='tools_list'),
|
||||
|
||||
@@ -20,7 +20,6 @@ from django.views.generic.list import ListView
|
||||
|
||||
from documents.search import document_search
|
||||
|
||||
from .api import tools
|
||||
from .classes import MissingItem
|
||||
from .forms import (
|
||||
ChoiceForm, LicenseForm, LocaleProfileForm, LocaleProfileForm_view,
|
||||
@@ -219,30 +218,6 @@ class LicenseView(ExtraContextMixin, TemplateView):
|
||||
template_name = 'appearance/generic_form.html'
|
||||
|
||||
|
||||
class MaintenanceMenuView(TemplateView):
|
||||
template_name = 'appearance/tools.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
data = super(MaintenanceMenuView, self).get_context_data(**kwargs)
|
||||
|
||||
user_tools = {}
|
||||
for namespace, values in tools.items():
|
||||
user_tools[namespace] = {
|
||||
'title': values['title']
|
||||
}
|
||||
user_tools[namespace].setdefault('links', [])
|
||||
for link in values['links']:
|
||||
resolved_link = link.resolve(context=RequestContext(self.request))
|
||||
if resolved_link:
|
||||
user_tools[namespace]['links'].append(resolved_link)
|
||||
|
||||
data.update({
|
||||
'blocks': user_tools,
|
||||
'title': _('Maintenance menu')
|
||||
})
|
||||
return data
|
||||
|
||||
|
||||
class MultiFormView(FormView):
|
||||
prefixes = {}
|
||||
|
||||
@@ -486,16 +461,17 @@ class SimpleView(ViewPermissionCheckMixin, ExtraContextMixin, TemplateView):
|
||||
pass
|
||||
|
||||
|
||||
class ToolsListView(TemplateView):
|
||||
class ToolsListView(SimpleView):
|
||||
template_name = 'appearance/generic_list_horizontal.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
data = super(ToolsListView, self).get_context_data(**kwargs)
|
||||
data.update({
|
||||
'resolved_links': menu_tools.resolve(context=RequestContext(self.request)),
|
||||
def get_menu_links(self):
|
||||
return menu_tools.resolve(context=RequestContext(self.request))
|
||||
|
||||
def get_extra_context(self):
|
||||
return {
|
||||
'resolved_links': self.get_menu_links(),
|
||||
'title': _('Tools'),
|
||||
})
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
def multi_object_action_view(request):
|
||||
|
||||
Reference in New Issue
Block a user