You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
600 B
23 lines
600 B
|
|
from xadmin.sites import site
|
|
from xadmin.views import BaseAdminPlugin, CommAdminView
|
|
|
|
BUILDIN_STYLES = {
|
|
'default': 'xadmin/includes/sitemenu_default.html',
|
|
'accordion': 'xadmin/includes/sitemenu_accordion.html',
|
|
}
|
|
|
|
|
|
class SiteMenuStylePlugin(BaseAdminPlugin):
|
|
|
|
menu_style = None
|
|
|
|
def init_request(self, *args, **kwargs):
|
|
return bool(self.menu_style) and self.menu_style in BUILDIN_STYLES
|
|
|
|
def get_context(self, context):
|
|
context['menu_template'] = BUILDIN_STYLES[self.menu_style]
|
|
return context
|
|
|
|
site.register_plugin(SiteMenuStylePlugin, CommAdminView)
|