Automated merge with ssh://openslides.org/openslides

This commit is contained in:
Emanuel Schuetze 2012-04-15 10:36:51 +02:00
commit 195ddddf7e
5 changed files with 37 additions and 9 deletions

View File

@ -101,10 +101,10 @@ from openslides.utils.signals import template_manipulation
def set_submenu(sender, request, context, **kwargs): def set_submenu(sender, request, context, **kwargs):
if not request.path.startswith('/config/'): if not request.path.startswith('/config/'):
return None return None
selected = True if request.path == reverse('config_general') else False
menu_links = [ menu_links = [
(reverse('config_general'), _('General'), selected), (reverse('config_general'), _('General'), request.path == reverse('config_general') ),
] ]
for app in settings.INSTALLED_APPS: for app in settings.INSTALLED_APPS:
try: try:
mod = import_module(app + '.views') mod = import_module(app + '.views')
@ -118,9 +118,10 @@ def set_submenu(sender, request, context, **kwargs):
(reverse('config_%s' % appname), _(appname.title()), selected) (reverse('config_%s' % appname), _(appname.title()), selected)
) )
menu_links.append (
(reverse('config_version'), _('Version'), request.path == reverse('config_version') )
)
context.update({ context.update({
'menu_links': menu_links, 'menu_links': menu_links,
}) })

View File

@ -0,0 +1,11 @@
{% extends "config/base_config.html" %}
{% load i18n %}
{% block title %}{{ block.super }} - {% trans "Version" %}{% endblock %}
{% block content %}
<h1>{% trans "Version" %}</h1>
<p>{% trans "OpenSlides Version" %}: {{ version }}</p>
{% endblock %}

View File

@ -15,13 +15,18 @@ from django.utils.importlib import import_module
import settings import settings
from views import GeneralConfig from views import GeneralConfig, VersionConfig
urlpatterns = patterns('config.views', urlpatterns = patterns('config.views',
url(r'^general/$', url(r'^general/$',
GeneralConfig.as_view(), GeneralConfig.as_view(),
name='config_general', name='config_general',
), ),
url(r'^version/$',
VersionConfig.as_view(),
name='config_version',
),
) )
for app in settings.INSTALLED_APPS: for app in settings.INSTALLED_APPS:

View File

@ -17,8 +17,10 @@ from django.contrib.auth.models import Group, Permission
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.template.loader import render_to_string from django.template.loader import render_to_string
from openslides import get_version
from utils.utils import template, permission_required from utils.utils import template, permission_required
from utils.views import FormView from utils.views import FormView, TemplateView
from utils.template import Tab from utils.template import Tab
from forms import SystemConfigForm, EventConfigForm from forms import SystemConfigForm, EventConfigForm
@ -54,6 +56,16 @@ class GeneralConfig(FormView):
return super(Config, self).form_invalid(form) return super(Config, self).form_invalid(form)
class VersionConfig(TemplateView):
permission_required = 'config.can_manage_config'
template_name = 'config/version.html'
def get_context_data(self, **kwargs):
context = super(VersionConfig, self).get_context_data(**kwargs)
context['version'] = get_version()
return context
class Config(FormView): class Config(FormView):
permission_required = 'config.can_manage_config' permission_required = 'config.can_manage_config'
form_class = SystemConfigForm form_class = SystemConfigForm

View File

@ -68,8 +68,7 @@
{% endblock %} {% endblock %}
<div id="footer"> <div id="footer">
<small> <small>
&copy; Copyright 2011 | Powered by <a href="http://openslides.org">OpenSlides</a><br /> &copy; Copyright 2011 | Powered by <a href="http://openslides.org">OpenSlides</a>
Version: {{ openslides_version }}
</small> </small>
</div> </div>
</div> </div>