Reordered config tab subpages.

This commit is contained in:
Emanuel Schuetze 2011-11-14 23:40:19 +01:00
parent 49d2b57a66
commit c88ff41805
12 changed files with 232 additions and 116 deletions

View File

@ -51,7 +51,7 @@
<!-- countdown -->
<input type="checkbox" name="countdown" onchange="document.location='{% if countdown_visible == "True" %}{% url countdown_close %}{% else %}{% url countdown_open %}{% endif %}'"
{% if countdown_visible == "True" %}checked{% endif %}>
{% trans "Countdown" %} (<a href="{% url config_general %}">{{countdown_time}}{% trans "sec" %}</a>){% if countdown_visible == "True" %}:
{% trans "Countdown" %} (<a href="{% url config_agenda %}">{{countdown_time}}{% trans "sec" %}</a>){% if countdown_visible == "True" %}:
<a class="beamer_countdown" href="{% url countdown_reset countdown_time %}" title="{% trans 'Reset countdown' %}"><img src="/static/images/icons/media-skip-backward.png"></a>
<a class="beamer_countdown" href="{% url countdown_start %}" title="{% trans 'Start countdown' %}"><img src="/static/images/icons/media-playback-start.png"></a>
<a class="beamer_countdown" href="{% url countdown_stop %}" title="{% trans 'Stop countdown' %}"><img src="/static/images/icons/media-playback-pause.png"></a>

View File

@ -2,7 +2,7 @@
{% block title %}{{ block.super }} - {%trans "Import applications" %} {% endblock %}
{% block content %}
<h1>Import</h1>
<h1>{%trans "Import applications" %}</h1>
<p>{% trans 'Select a CSV file to import applications!' %}</p>
<p>{% trans '(Required comma separated values: <code>number, title, text, reason, first_name, last_name</code> - <code>number</code> and <code>reason</code> are optional and may be empty)' %} </p>

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-11-14 22:57+0100\n"
"POT-Creation-Date: 2011-11-14 23:35+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -95,8 +95,8 @@ msgstr "Text"
#: application/templates/application/edit.html:2
#: application/templates/application/view.html:2
#: application/templates/application/view.html:220 poll/models.py:23
#: poll/models.py:138 system/templates/system/general.html:18 utils/pdf.py:458
#: utils/pdf.py:470
#: poll/models.py:138 system/templates/system/base_system.html:14
#: utils/pdf.py:458 utils/pdf.py:470
msgid "Application"
msgstr "Antrag"
@ -104,7 +104,8 @@ msgstr "Antrag"
#: agenda/templates/agenda/overview.html:231
#: agenda/templates/beamer/ItemAssignment.html:8
#: assignment/templates/assignment/edit.html:2 poll/models.py:24
#: utils/pdf.py:534 utils/pdf.py:675 utils/pdf.py:684
#: system/templates/system/base_system.html:15 utils/pdf.py:534
#: utils/pdf.py:675 utils/pdf.py:684
msgid "Election"
msgstr "Wahl"
@ -119,7 +120,7 @@ msgstr "Abstimmung"
#: agenda/templates/agenda/overview.html:96
#: agenda/templates/beamer/overview.html:3
#: agenda/templates/beamer/overview.html:10
#: system/templates/system/general.html:13 templates/base.html:37
#: system/templates/system/base_system.html:13 templates/base.html:37
#: utils/pdf.py:227 utils/pdf.py:232
msgid "Agenda"
msgstr "Tagesordnung"
@ -147,7 +148,8 @@ msgstr "Tagesordnungseintrag geändert"
#: agenda/views.py:283 application/views.py:531 participant/views.py:145
#: participant/views.py:256 participant/views.py:285 participant/views.py:346
#: system/views.py:49 system/views.py:92
#: system/views.py:37 system/views.py:55 system/views.py:79
#: system/views.py:105 system/views.py:143
msgid "Please check the form for errors."
msgstr "Bitte kontrollieren Sie das Formular nach Fehlern."
@ -209,7 +211,10 @@ msgstr "Wahleintrag"
#: participant/templates/participant/edit.html:18
#: participant/templates/participant/group_edit.html:14
#: participant/templates/participant/settings.html:15
#: system/templates/system/general.html:28
#: system/templates/system/agenda.html:10
#: system/templates/system/application.html:10
#: system/templates/system/assignment.html:10
#: system/templates/system/general.html:10
#: system/templates/system/system.html:11
msgid "Save"
msgstr "Speichern"
@ -235,7 +240,10 @@ msgstr "Übernehmen"
#: participant/templates/participant/group_edit.html:21
#: participant/templates/participant/import.html:16
#: participant/templates/participant/settings.html:19
#: system/templates/system/general.html:32
#: system/templates/system/agenda.html:14
#: system/templates/system/application.html:14
#: system/templates/system/assignment.html:14
#: system/templates/system/general.html:14
#: system/templates/system/system.html:15
msgid "Cancel"
msgstr "Abbrechen"
@ -800,6 +808,7 @@ msgstr "Neuer Antrag"
#: application/templates/application/base_application.html:13
#: application/templates/application/import.html:2
#: application/templates/application/import.html:5
msgid "Import applications"
msgstr "Anträge importieren"
@ -1194,8 +1203,7 @@ msgstr "gewählt"
#: assignment/templates/assignment/overview.html:2
#: assignment/templates/assignment/overview.html:5
#: assignment/templates/assignment/overview.html:21 system/models.py:23
#: system/templates/system/general.html:23 templates/base.html:45
#: utils/pdf.py:642
#: templates/base.html:45 utils/pdf.py:642
msgid "Elections"
msgstr "Wahlen"
@ -1703,7 +1711,23 @@ msgstr "Titel für PDF-Dokument (alle Wahlen)"
msgid "Preamble text for PDF document (all elections)"
msgstr "Einleitungstext für PDF-Dokument (alle Wahlen) "
#: system/views.py:43
#: system/views.py:35
msgid "General settings successfully saved."
msgstr "Allgemeine Einstellungen erfolgreich gespeichert."
#: system/views.py:53
msgid "Agenda settings successfully saved."
msgstr "Tagesordnungs-Einstellungen erfolgreich gespeichert."
#: system/views.py:77
msgid "Application settings successfully saved."
msgstr "Antrags-Einstellungen erfolgreich gespeichert."
#: system/views.py:103
msgid "Election settings successfully saved."
msgstr "Wahl-Einstellungen wurden erfolgreich gespeichert."
#: system/views.py:137
msgid ""
"Anonymous access enabled. Please modify the \"Anonymous\" group to fit your "
"required permissions."
@ -1711,33 +1735,46 @@ msgstr ""
"Anonymer Zugriff aktiviert. Bitte setzen Sie die Rechte der Gruppe "
"\"Anonymous\" passend zum gewünschten Zugriffslevel."
#: system/views.py:47
#: system/views.py:141
msgid "System settings successfully saved."
msgstr "Systemeinstellungen erfolgreich gespeichert."
#: system/views.py:90
msgid "General settings successfully saved."
msgstr "Allgemeine Einstellungen erfolgreich gespeichert."
#: system/templates/system/base_system.html:7
#: system/templates/system/agenda.html:2
#: system/templates/system/application.html:2
#: system/templates/system/assignment.html:2
#: system/templates/system/base_system.html:10
#: system/templates/system/general.html:2
#: system/templates/system/system.html:2 templates/base.html:53
msgid "Configuration"
msgstr "Konfiguration"
#: system/templates/system/base_system.html:9
#: system/templates/system/general.html:5
#: system/templates/system/agenda.html:5
msgid "Agenda settings"
msgstr "Tagesordnungs-Einstellungen"
#: system/templates/system/application.html:5
msgid "Application settings"
msgstr "Antrags-Einstellungen"
#: system/templates/system/assignment.html:5
msgid "Election settings"
msgstr "Wahl-Einstellungen"
#: system/templates/system/base_system.html:12
msgid "General"
msgstr "Allgemein"
#: system/templates/system/base_system.html:10
#: system/templates/system/system.html:5
#: system/templates/system/base_system.html:16
msgid "System"
msgstr "System"
#: system/templates/system/general.html:8
msgid "Event"
msgstr "Veranstaltung"
#: system/templates/system/general.html:5
msgid "General settings"
msgstr "Allgemeine Einstellungen"
#: system/templates/system/system.html:5
msgid "System settings"
msgstr "System-Einstellungen"
#: templates/404.html:9
msgid "Page not found."
@ -1834,3 +1871,6 @@ msgstr "verfügbare Posten"
#: utils/utils.py:75
msgid "Sorry, you have no rights to see this page."
msgstr "Bedaure, Sie haben keine Berechtigung diese Seite zu sehen."
#~ msgid "Event"
#~ msgstr "Veranstaltung"

View File

@ -0,0 +1,19 @@
{% extends "system/base_system.html" %}
{% block title %}{{ block.super }} - {%trans "Configuration" %}{% endblock %}
{% block content %}
<h1>{%trans "Agenda settings" %}</h1>
<form action="" method="post">{% csrf_token %}
{{ form_agenda.as_p }}
<p>
<button class="button" type="submit">
<span class="icon ok">{%trans 'Save' %}</span>
</button>
<a href='{% url config_agenda %}'>
<button class="button" type="button" onclick="window.location='{% url config_agenda %}'">
<span class="icon cancel">{%trans 'Cancel' %}</span>
</button>
</a>
</p>
</form>
{% endblock %}

View File

@ -0,0 +1,19 @@
{% extends "system/base_system.html" %}
{% block title %}{{ block.super }} - {%trans "Configuration" %}{% endblock %}
{% block content %}
<h1>{%trans "Application settings" %}</h1>
<form action="" method="post">{% csrf_token %}
{{ form_application.as_p }}
<p>
<button class="button" type="submit">
<span class="icon ok">{%trans 'Save' %}</span>
</button>
<a href='{% url config_application %}'>
<button class="button" type="button" onclick="window.location='{% url config_application %}'">
<span class="icon cancel">{%trans 'Cancel' %}</span>
</button>
</a>
</p>
</form>
{% endblock %}

View File

@ -0,0 +1,19 @@
{% extends "system/base_system.html" %}
{% block title %}{{ block.super }} - {%trans "Configuration" %}{% endblock %}
{% block content %}
<h1>{%trans "Election settings" %}</h1>
<form action="" method="post">{% csrf_token %}
{{ form_assignment.as_p }}
<p>
<button class="button" type="submit">
<span class="icon ok">{%trans 'Save' %}</span>
</button>
<a href='{% url config_assignment %}'>
<button class="button" type="button" onclick="window.location='{% url config_assignment %}'">
<span class="icon cancel">{%trans 'Cancel' %}</span>
</button>
</a>
</p>
</form>
{% endblock %}

View File

@ -2,11 +2,17 @@
{% load tags %}
{% block submenu %}
{% url config_system as url_config_system %}
{% url config_general as url_config_general %}
{% url config_agenda as url_config_agenda %}
{% url config_application as url_config_application %}
{% url config_assignment as url_config_assignment %}
{% url config_system as url_config_system %}
<h4 class="sectiontitle">{%trans "Configuration" %}</h4>
<ul>
<li class="{% if request.path == url_config_general %}selected{% endif %}"><a href="{% url config_general %}">{%trans "General" %}</a></li>
<li class="{% if request.path == url_config_agenda %}selected{% endif %}"><a href="{% url config_agenda %}">{%trans "Agenda" %}</a></li>
<li class="{% if request.path == url_config_application %}selected{% endif %}"><a href="{% url config_application %}">{%trans "Application" %}</a></li>
<li class="{% if request.path == url_config_assignment %}selected{% endif %}"><a href="{% url config_assignment %}">{%trans "Election" %}</a></li>
<li class="{% if request.path == url_config_system %}selected{% endif %}"><a href="{% url config_system %}">{%trans "System" %}</a></li>
</ul>
{% endblock %}

View File

@ -2,27 +2,9 @@
{% block title %}{{ block.super }} - {%trans "Configuration" %}{% endblock %}
{% block content %}
<h1>{%trans "General" %}</h1>
<h1>{%trans "General settings" %}</h1>
<form action="" method="post">{% csrf_token %}
<fieldset>
<legend>{%trans "Event" %}</legend>
{{ form_event.as_p }}
</fieldset>
<p></p>
<fieldset>
<legend>{%trans "Agenda" %}</legend>
{{ form_agenda.as_p }}
</fieldset>
<p></p>
<fieldset>
<legend>{%trans "Application" %}</legend>
{{ form_application.as_p }}
</fieldset>
<p></p>
<fieldset>
<legend>{%trans "Elections" %}</legend>
{{ form_assignment.as_p }}
</fieldset>
<p>
<button class="button" type="submit">
<span class="icon ok">{%trans 'Save' %}</span>

View File

@ -2,7 +2,7 @@
{% block title %}{{ block.super }} - {%trans "Configuration" %}{% endblock %}
{% block content %}
<h1>{%trans "System" %}</h1>
<h1>{%trans "System settings" %}</h1>
<form action="" method="post">{% csrf_token %}
{{ form.as_p }}
@ -10,8 +10,8 @@
<button class="button" type="submit">
<span class="icon ok">{%trans 'Save' %}</span>
</button>
<a href='{% url config_general %}'>
<button class="button" type="button" onclick="window.location='{% url config_general %}'">
<a href='{% url config_system %}'>
<button class="button" type="button" onclick="window.location='{% url config_system %}'">
<span class="icon cancel">{%trans 'Cancel' %}</span>
</button>
</a>

View File

@ -14,5 +14,8 @@ from django.conf.urls.defaults import *
urlpatterns = patterns('system.views',
url(r'^config/general$', 'get_general_config', name='config_general'),
url(r'^config/agenda$', 'get_agenda_config', name='config_agenda'),
url(r'^config/application$', 'get_application_config', name='config_application'),
url(r'^config/assignment$', 'get_assignment_config', name='config_assignment'),
url(r'^config/system$', 'get_system_config', name='config_system'),
)

View File

@ -20,6 +20,100 @@ from utils.utils import template, permission_required
from system.forms import SystemConfigForm, EventConfigForm, AgendaConfigForm, ApplicationConfigForm, AssignmentConfigForm
from system.api import config_get, config_set
@permission_required('system.can_manage_system')
@template('system/general.html')
def get_general_config(request):
if request.method == 'POST':
form_event = EventConfigForm(request.POST, prefix='event')
if form_event.is_valid():
# event form
config_set('event_name', form_event.cleaned_data['event_name'])
config_set('event_description', form_event.cleaned_data['event_description'])
config_set('event_date', form_event.cleaned_data['event_date'])
config_set('event_location', form_event.cleaned_data['event_location'])
config_set('event_organizer', form_event.cleaned_data['event_organizer'])
messages.success(request, _('General settings successfully saved.'))
else:
messages.error(request, _('Please check the form for errors.'))
else:
form_event = EventConfigForm(initial={
'event_name': config_get('event_name'),
}, prefix='event')
return {
'form_event': form_event,
}
@permission_required('system.can_manage_system')
@template('system/agenda.html')
def get_agenda_config(request):
if request.method == 'POST':
form_agenda = AgendaConfigForm(request.POST, prefix='agenda')
if form_agenda.is_valid():
config_set('agenda_countdown_time', form_agenda.cleaned_data['agenda_countdown_time'])
messages.success(request, _('Agenda settings successfully saved.'))
else:
messages.error(request, _('Please check the form for errors.'))
else:
form_agenda = AgendaConfigForm(initial={
'agenda_countdown_time': config_get('agenda_countdown_time'),
}, prefix='agenda')
return {
'form_agenda': form_agenda,
}
@permission_required('system.can_manage_system')
@template('system/application.html')
def get_application_config(request):
if request.method == 'POST':
form_application = ApplicationConfigForm(request.POST, prefix='application')
form_assignment = AssignmentConfigForm(request.POST, prefix='assignment')
if form_application.is_valid():
config_set('application_min_supporters', form_application.cleaned_data['application_min_supporters'])
config_set('application_preamble', form_application.cleaned_data['application_preamble'])
config_set('application_pdf_ballot_papers_selection', form_application.cleaned_data['application_pdf_ballot_papers_selection'])
config_set('application_pdf_ballot_papers_number', form_application.cleaned_data['application_pdf_ballot_papers_number'])
config_set('application_pdf_title', form_application.cleaned_data['application_pdf_title'])
config_set('application_pdf_preamble', form_application.cleaned_data['application_pdf_preamble'])
messages.success(request, _('Application settings successfully saved.'))
else:
messages.error(request, _('Please check the form for errors.'))
else:
form_application = ApplicationConfigForm(initial={
'application_min_supporters': config_get('application_min_supporters'),
'application_preamble': config_get('application_preamble'),
'application_pdf_ballot_papers_selection': config_get('application_pdf_ballot_papers_selection'),
'application_pdf_ballot_papers_number': config_get('application_pdf_ballot_papers_number'),
'application_pdf_title': config_get('application_pdf_title'),
'application_pdf_preamble': config_get('application_pdf_preamble'),
}, prefix='application')
return {
'form_application': form_application,
}
@permission_required('system.can_manage_system')
@template('system/assignment.html')
def get_assignment_config(request):
if request.method == 'POST':
form_assignment = AssignmentConfigForm(request.POST, prefix='assignment')
if form_assignment.is_valid():
config_set('assignment_pdf_ballot_papers_selection', form_assignment.cleaned_data['assignment_pdf_ballot_papers_selection'])
config_set('assignment_pdf_ballot_papers_number', form_assignment.cleaned_data['assignment_pdf_ballot_papers_number'])
config_set('assignment_pdf_title', form_assignment.cleaned_data['assignment_pdf_title'])
config_set('assignment_pdf_preamble', form_assignment.cleaned_data['assignment_pdf_preamble'])
messages.success(request, _('Election settings successfully saved.'))
else:
messages.error(request, _('Please check the form for errors.'))
else:
form_assignment = AssignmentConfigForm(initial={
'assignment_pdf_ballot_papers_selection': config_get('assignment_pdf_ballot_papers_selection'),
'assignment_pdf_ballot_papers_number': config_get('assignment_pdf_ballot_papers_number'),
'assignment_pdf_title': config_get('assignment_pdf_title'),
'assignment_pdf_preamble': config_get('assignment_pdf_preamble'),
}, prefix='assignment')
return {
'form_assignment': form_assignment,
}
@permission_required('system.can_manage_system')
@template('system/system.html')
def get_system_config(request):
@ -47,7 +141,6 @@ def get_system_config(request):
messages.success(request, _('System settings successfully saved.'))
else:
messages.error(request, _('Please check the form for errors.'))
else:
form = SystemConfigForm(initial={
'system_url': config_get('system_url'),
@ -57,68 +150,3 @@ def get_system_config(request):
return {
'form': form,
}
@permission_required('system.can_manage_system')
@template('system/general.html')
def get_general_config(request):
if request.method == 'POST':
form_event = EventConfigForm(request.POST, prefix='event')
form_agenda = AgendaConfigForm(request.POST, prefix='agenda')
form_application = ApplicationConfigForm(request.POST, prefix='application')
form_assignment = AssignmentConfigForm(request.POST, prefix='assignment')
if form_event.is_valid() and form_agenda.is_valid() and form_application.is_valid() and form_assignment.is_valid():
# event form
config_set('event_name', form_event.cleaned_data['event_name'])
config_set('event_description', form_event.cleaned_data['event_description'])
config_set('event_date', form_event.cleaned_data['event_date'])
config_set('event_location', form_event.cleaned_data['event_location'])
config_set('event_organizer', form_event.cleaned_data['event_organizer'])
# agenda form
config_set('agenda_countdown_time', form_agenda.cleaned_data['agenda_countdown_time'])
# application form
config_set('application_min_supporters', form_application.cleaned_data['application_min_supporters'])
config_set('application_preamble', form_application.cleaned_data['application_preamble'])
config_set('application_pdf_ballot_papers_selection', form_application.cleaned_data['application_pdf_ballot_papers_selection'])
config_set('application_pdf_ballot_papers_number', form_application.cleaned_data['application_pdf_ballot_papers_number'])
config_set('application_pdf_title', form_application.cleaned_data['application_pdf_title'])
config_set('application_pdf_preamble', form_application.cleaned_data['application_pdf_preamble'])
# assignment form
config_set('assignment_pdf_ballot_papers_selection', form_assignment.cleaned_data['assignment_pdf_ballot_papers_selection'])
config_set('assignment_pdf_ballot_papers_number', form_assignment.cleaned_data['assignment_pdf_ballot_papers_number'])
config_set('assignment_pdf_title', form_assignment.cleaned_data['assignment_pdf_title'])
config_set('assignment_pdf_preamble', form_assignment.cleaned_data['assignment_pdf_preamble'])
messages.success(request, _('General settings successfully saved.'))
else:
messages.error(request, _('Please check the form for errors.'))
else:
form_event = EventConfigForm(initial={
'event_name': config_get('event_name'),
'event_description': config_get('event_description'),
'event_date': config_get('event_date'),
'event_location': config_get('event_location'),
'event_organizer': config_get('event_organizer'),
}, prefix='event')
form_agenda = AgendaConfigForm(initial={
'agenda_countdown_time': config_get('agenda_countdown_time'),
}, prefix='agenda')
form_application = ApplicationConfigForm(initial={
'application_min_supporters': config_get('application_min_supporters'),
'application_preamble': config_get('application_preamble'),
'application_pdf_ballot_papers_selection': config_get('application_pdf_ballot_papers_selection'),
'application_pdf_ballot_papers_number': config_get('application_pdf_ballot_papers_number'),
'application_pdf_title': config_get('application_pdf_title'),
'application_pdf_preamble': config_get('application_pdf_preamble'),
}, prefix='application')
form_assignment = AssignmentConfigForm(initial={
'assignment_pdf_ballot_papers_selection': config_get('assignment_pdf_ballot_papers_selection'),
'assignment_pdf_ballot_papers_number': config_get('assignment_pdf_ballot_papers_number'),
'assignment_pdf_title': config_get('assignment_pdf_title'),
'assignment_pdf_preamble': config_get('assignment_pdf_preamble'),
}, prefix='assignment')
return {
'form_event': form_event,
'form_agenda': form_agenda,
'form_application': form_application,
'form_assignment': form_assignment,
}