New welcome widget.

This commit is contained in:
Emanuel Schuetze 2012-09-20 20:45:37 +02:00
parent 05baced315
commit fa9874038e
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,13 @@
{% load i18n %}
{% load tags %}
{% if welcometext %}
<p>{{ welcometext|safe|linebreaks }}</p>
{% endif %}
<p>{% trans "You have access to the following pages:" %}</p>
<ul>
{% for app in apps %}
<li><a href="{{ app.url }}">{{ app.title }}</a></li>
{% endfor %}
</ul>

View File

@ -371,6 +371,27 @@ def get_widgets(request):
"""
widgets = []
# welcome widget
apps = []
for app in settings.INSTALLED_APPS:
try:
mod = import_module(app + '.views')
tab = mod.register_tab(request)
except (ImportError, AttributeError):
continue
if tab.permission:
apps.append(tab)
context = {
'apps': apps,
'welcometext': config['frontpage_welcometext']}
widgets.append(Widget(
name='welcome',
display_name=config['frontpage_title'],
template='projector/welcome_widget.html',
context=context,
permission_required='projector.can_see_dashboard',
default_column=1))
# Projector live view widget
widgets.append(Widget(
name='live_view',