Filled frontpage with config values.
This commit is contained in:
parent
6f0fd91ec2
commit
abf7721f3f
@ -24,3 +24,5 @@ class GeneralConfigForm(Form, CssClassMixin):
|
||||
event_location = CharField(widget=TextInput(), required=False, label=_("Event location"))
|
||||
event_organizer = CharField(widget=TextInput(), required=False, label=_("Event organizer"))
|
||||
system_enable_anonymous = BooleanField(required=False, label=_("Allow access for anonymous guest users") )
|
||||
frontpage_title = CharField(widget=TextInput(), required=False, label=_("Title") )
|
||||
frontpage_welcometext = CharField(widget=Textarea(), required=False, label=_("Welcome text") )
|
@ -81,6 +81,8 @@ def default_config(sender, key, **kwargs):
|
||||
return {
|
||||
'event_name': 'OpenSlides',
|
||||
'event_description': 'Presentation and voting system',
|
||||
'frontpage_title': 'Welcome',
|
||||
'frontpage_welcometext': 'Welcome to OpenSlides!',
|
||||
}.get(key)
|
||||
|
||||
|
||||
|
@ -22,6 +22,21 @@
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
<p></p>
|
||||
<fieldset>
|
||||
<legend>{%trans "Frontpage" %}</legend>
|
||||
{% for field in form %}
|
||||
{% if "id_frontpage" in field.label_tag %}
|
||||
<p>
|
||||
{{ field.errors }}
|
||||
{{ field.required }}
|
||||
{{ field.label_tag }}
|
||||
{{ field }}
|
||||
{{ field.help_text }}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
<p></p>
|
||||
<fieldset style="width: 410px;">
|
||||
<legend>{%trans "System" %}</legend>
|
||||
{% for field in form %}
|
||||
|
@ -41,15 +41,24 @@ class GeneralConfig(FormView):
|
||||
'event_date': config['event_date'],
|
||||
'event_location': config['event_location'],
|
||||
'event_organizer': config['event_organizer'],
|
||||
'frontpage_title': config['frontpage_title'],
|
||||
'frontpage_welcometext': config['frontpage_welcometext'],
|
||||
'system_enable_anonymous': config['system_enable_anonymous'],
|
||||
}
|
||||
|
||||
def form_valid(self, form):
|
||||
# event
|
||||
config['event_name'] = form.cleaned_data['event_name']
|
||||
config['event_description'] = form.cleaned_data['event_description']
|
||||
config['event_date'] = form.cleaned_data['event_date']
|
||||
config['event_location'] = form.cleaned_data['event_location']
|
||||
config['event_organizer'] = form.cleaned_data['event_organizer']
|
||||
|
||||
# frontpage
|
||||
config['frontpage_welcometext'] = form.cleaned_data['frontpage_welcometext']
|
||||
config['frontpage_welcometext'] = form.cleaned_data['frontpage_welcometext']
|
||||
|
||||
# system
|
||||
if form.cleaned_data['system_enable_anonymous']:
|
||||
config['system_enable_anonymous'] = True
|
||||
# check for Anonymous group and (re)create it as needed
|
||||
@ -65,6 +74,7 @@ class GeneralConfig(FormView):
|
||||
messages.success(self.request, _('Anonymous access enabled. Please modify the "Anonymous" group to fit your required permissions.'))
|
||||
else:
|
||||
config['system_enable_anonymous'] = False
|
||||
|
||||
messages.success(self.request, _('General settings successfully saved.'))
|
||||
return super(GeneralConfig, self).form_valid(form)
|
||||
|
||||
|
@ -2,15 +2,16 @@
|
||||
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{{ block.super }} – {{ item.title }}{% endblock %}
|
||||
{% block title %}{{ block.super }} – {% trans "Home" %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{% trans 'Wellcome' %}</h1>
|
||||
{{ wellcome_text|safe }}
|
||||
<h1>{{ title }}</h1>
|
||||
<p>{{ welcometext|safe|linebreaks }}</p>
|
||||
|
||||
{% trans "You have access to the following pages:" %}
|
||||
<ul>
|
||||
{% for app in apps %}
|
||||
<li><a href="{{ app.url }}">{{ app.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -278,7 +278,11 @@ class FrontPage(TemplateView):
|
||||
continue
|
||||
if tab.permission:
|
||||
apps.append(tab)
|
||||
context['apps'] = apps
|
||||
context.update({
|
||||
'apps': apps,
|
||||
'title': config['frontpage_title'],
|
||||
'welcometext': config['frontpage_welcometext'],
|
||||
})
|
||||
return context
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user