Merge remote branch 'upstream/master' into dashboard-quantum-integration
This commit is contained in:
commit
b069ef0b74
@ -1,11 +1,11 @@
|
|||||||
import django.dispatch
|
import django.dispatch
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
|
||||||
dash_apps_ping = django.dispatch.Signal()
|
dash_modules_ping = django.dispatch.Signal()
|
||||||
dash_apps_urls = django.dispatch.Signal()
|
dash_modules_urls = django.dispatch.Signal()
|
||||||
|
|
||||||
|
|
||||||
def dash_apps_detect():
|
def dash_modules_detect():
|
||||||
"""
|
"""
|
||||||
Sends a pinging signal to the app, all listening modules will reply with
|
Sends a pinging signal to the app, all listening modules will reply with
|
||||||
items for the sidebar.
|
items for the sidebar.
|
||||||
@ -20,13 +20,13 @@ def dash_apps_detect():
|
|||||||
'text':'Google', 'active_text': 'google'}],
|
'text':'Google', 'active_text': 'google'}],
|
||||||
'type': syspanel})
|
'type': syspanel})
|
||||||
"""
|
"""
|
||||||
return dash_apps_ping.send(sender=dash_apps_ping)
|
return dash_modules_ping.send(sender=dash_modules_ping)
|
||||||
|
|
||||||
|
|
||||||
def dash_app_setup_urls():
|
def dash_app_setup_urls():
|
||||||
"""
|
"""
|
||||||
Adds urls from modules
|
Adds urls from modules
|
||||||
"""
|
"""
|
||||||
return dash_apps_urls.send(sender=dash_apps_urls)
|
return dash_modules_urls.send(sender=dash_modules_urls)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,13 +6,20 @@ register = template.Library()
|
|||||||
|
|
||||||
@register.inclusion_tag('_sidebar_module.html')
|
@register.inclusion_tag('_sidebar_module.html')
|
||||||
def dash_sidebar_modules(request):
|
def dash_sidebar_modules(request):
|
||||||
if signals.dash_apps_detect()[0][1]['type'] == "dash":
|
signals_call = signals.dash_modules_detect()
|
||||||
return {'modules': [module[1] for module in signals.dash_apps_detect()],
|
if signals_call:
|
||||||
|
if signals_call[0][1]['type'] == "dash":
|
||||||
|
return {'modules': [module[1] for module in signals_call],
|
||||||
'request': request }
|
'request': request }
|
||||||
|
else:
|
||||||
|
return {}
|
||||||
|
|
||||||
@register.inclusion_tag('_sidebar_module.html')
|
@register.inclusion_tag('_sidebar_module.html')
|
||||||
def syspanel_sidebar_modules(request):
|
def syspanel_sidebar_modules(request):
|
||||||
if signals.dash_apps_detect()[0][1]['type'] == "syspanel":
|
signals_call = signals.dash_modules_detect()
|
||||||
return {'modules': [module[1] for module in signals.dash_apps_detect()],
|
if signals_call:
|
||||||
|
if signals_call[0][1]['type'] == "syspanel":
|
||||||
|
return {'modules': [module[1] for module in signals_call],
|
||||||
'request': request }
|
'request': request }
|
||||||
|
else:
|
||||||
|
return {}
|
||||||
|
@ -29,5 +29,5 @@ urlpatterns = patterns('',
|
|||||||
)
|
)
|
||||||
|
|
||||||
# import urls from modules
|
# import urls from modules
|
||||||
for module_urls in dash_apps_urls.send(sender=dash_apps_urls):
|
for module_urls in dash_modules_urls.send(sender=dash_modules_urls):
|
||||||
urlpatterns += module_urls[1].urlpatterns
|
urlpatterns += module_urls[1].urlpatterns
|
||||||
|
Loading…
x
Reference in New Issue
Block a user