From 7c90206b3fae3856cc56a35e88e6ef0c90ccc2c3 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Thu, 6 Sep 2012 22:41:24 +0200 Subject: [PATCH] Adjusted new template for participant app. Added new generic form. --- .../participant/base_participant.html | 30 ---- .../templates/participant/config.html | 18 +-- .../templates/participant/edit.html | 35 ++--- .../templates/participant/group_edit.html | 26 ++-- .../templates/participant/group_overview.html | 12 +- .../templates/participant/import.html | 20 ++- .../templates/participant/login.html | 11 +- .../templates/participant/overview.html | 140 +++++++++++------- .../participant/password_change.html | 21 +-- .../templates/participant/settings.html | 20 +-- openslides/participant/views.py | 10 +- openslides/static/styles/base.css | 7 +- openslides/templates/base.html | 2 +- openslides/templates/form.html | 12 ++ openslides/templates/formbuttons_save.html | 5 + .../templates/formbuttons_saveapply.html | 8 + 16 files changed, 184 insertions(+), 193 deletions(-) delete mode 100644 openslides/participant/templates/participant/base_participant.html create mode 100644 openslides/templates/form.html create mode 100644 openslides/templates/formbuttons_save.html create mode 100644 openslides/templates/formbuttons_saveapply.html diff --git a/openslides/participant/templates/participant/base_participant.html b/openslides/participant/templates/participant/base_participant.html deleted file mode 100644 index bb726731d..000000000 --- a/openslides/participant/templates/participant/base_participant.html +++ /dev/null @@ -1,30 +0,0 @@ -{% extends "base.html" %} - -{% load tags %} -{% load i18n %} -{% load staticfiles %} - -{% block submenu %} - {% url user_overview as url_users %} - {% url user_new as url_usernew %} - {% url user_group_overview as url_usergroups %} - {% url user_import as url_userimport %} -

{% trans "Participants" %}

- -{% endblock %} diff --git a/openslides/participant/templates/participant/config.html b/openslides/participant/templates/participant/config.html index 83a33eae2..49973462e 100644 --- a/openslides/participant/templates/participant/config.html +++ b/openslides/participant/templates/participant/config.html @@ -7,16 +7,12 @@ {% block content %}

{% trans "Participant settings" %}

{% csrf_token %} - {{ form.as_p }} -

- - - - -

+ {% include "form.html" %} +

+ {% include "formbuttons_save.html" %} + + {% trans 'Cancel' %} + +

{% endblock %} diff --git a/openslides/participant/templates/participant/edit.html b/openslides/participant/templates/participant/edit.html index da910b19e..abfb03bae 100644 --- a/openslides/participant/templates/participant/edit.html +++ b/openslides/participant/templates/participant/edit.html @@ -1,4 +1,4 @@ -{% extends "participant/base_participant.html" %} +{% extends "base.html" %} {% load i18n %} @@ -11,33 +11,30 @@ {% endif %} {% endblock %} - {% block content %} - {% if edit_user %} -

{% trans "Edit participant" %}

- {% else %} -

{% trans "New participant" %}

- {% endif %} +

+ {% if edit_user %} + {% trans "Edit participant" %} + {% else %} + {% trans "New participant" %} + {% endif %} + + {% trans "Back to overview" %} + +

{% csrf_token %} - {{ form.as_p }} + {% include "form.html" %} {% if edit_user %}

{% trans 'Reset to First Password' %}

{% endif %}

- - - - - + {% include "formbuttons_saveapply.html" %} + + {% trans 'Cancel' %} +

* {% trans "required" %}
diff --git a/openslides/participant/templates/participant/group_edit.html b/openslides/participant/templates/participant/group_edit.html index 8fafae7b2..788cc8ccd 100644 --- a/openslides/participant/templates/participant/group_edit.html +++ b/openslides/participant/templates/participant/group_edit.html @@ -1,4 +1,4 @@ -{% extends "participant/base_participant.html" %} +{% extends "base.html" %} {% load i18n %} @@ -12,25 +12,23 @@ {% endblock %} {% block content %} +

{% if group %} -

{% trans "Edit user group" %}

+ {% trans "Edit user group" %} {% else %} -

{% trans "New user group" %}

+ {% trans "New user group" %} {% endif %} + + {% trans "Back to overview" %} + +
{% csrf_token %} - {{ form.as_p }} + {% include "form.html" %}

- - - - + {% include "formbuttons_saveapply.html" %} + + {% trans 'Cancel' %}

* {% trans "required" %} diff --git a/openslides/participant/templates/participant/group_overview.html b/openslides/participant/templates/participant/group_overview.html index 3745308fb..04dde9e2f 100644 --- a/openslides/participant/templates/participant/group_overview.html +++ b/openslides/participant/templates/participant/group_overview.html @@ -1,4 +1,4 @@ -{% extends "participant/base_participant.html" %} +{% extends "base.html" %} {% load i18n %} {% load staticfiles %} @@ -6,8 +6,14 @@ {% block title %}{{ block.super }} – {% trans "User groups" %}{% endblock %} {% block content %} -

{% trans "User groups" %}

- +

{% trans "User groups" %} + + {% trans "New" %} + {% trans "Participants" %} + +

+ +
diff --git a/openslides/participant/templates/participant/import.html b/openslides/participant/templates/participant/import.html index d01a76e39..14b4ae516 100644 --- a/openslides/participant/templates/participant/import.html +++ b/openslides/participant/templates/participant/import.html @@ -1,11 +1,17 @@ -{% extends "participant/base_participant.html" %} +{% extends "base.html" %} {% load i18n %} {% block title %}{{ block.super }} – {% trans "Import participants" %} {% endblock %} {% block content %} -

{% trans 'Import participants' %}

+

+ {% trans 'Import participants' %} + + {% trans "Back to overview" %} + +

+

{% trans 'Select a CSV file to import participants!' %}

{% trans 'Required comma separated values: {first_name, last_name, gender, group, type, committee, comment}' %} @@ -17,15 +23,13 @@

{% csrf_token %} - {{ form.as_p }} + {% include "form.html" %}

- - - + + {% trans 'Cancel' %}

* {% trans "required" %} diff --git a/openslides/participant/templates/participant/login.html b/openslides/participant/templates/participant/login.html index 632065cd2..13b6fdeb6 100644 --- a/openslides/participant/templates/participant/login.html +++ b/openslides/participant/templates/participant/login.html @@ -1,17 +1,8 @@ -{% extends "participant/base_participant.html" %} +{% extends "base.html" %} {% load i18n %} {% load staticfiles %} -{% block mainmenu %} - -{% endblock %} - -{% block submenu %} -{% endblock %} - {% block content %}

{% trans "Login" %}

diff --git a/openslides/participant/templates/participant/overview.html b/openslides/participant/templates/participant/overview.html index 06437a9dd..91796a651 100644 --- a/openslides/participant/templates/participant/overview.html +++ b/openslides/participant/templates/participant/overview.html @@ -1,4 +1,4 @@ -{% extends "participant/base_participant.html" %} +{% extends "base.html" %} {% load i18n %} {% load staticfiles %} @@ -7,7 +7,7 @@ {% block title %}{{ block.super }} – {% trans "Participants" %}{% endblock %} {% block header %} - {% if perms.agenda.can_manage_agenda %} + {% if perms.participant.can_manage_participant %} {% endif %} @@ -15,75 +15,111 @@ {% block content %} -

{% trans "Participants" %}

+

{% trans "Participants" %} + +
+ {% if perms.participant.can_manage_participant %} + {% trans "New" %} + {% trans "User groups" %} + {% trans 'Import' %} + {% endif %} + {% if perms.participant.can_see_participant and perms.participant.can_manage_participant %} +
+ {% if user.is_authenticated %} + + Print as PDF + + + + {% else %} + {% trans "Login" %} + {% endif %} +
+ {% else %} + {% if perms.participant.can_see_participant %} + PDF + {% endif %} + {% if perms.participant.can_manage_participant %} + PDF + {% endif %} + {% endif %} +
+
+

-

- - {% trans "Filter" %}: - - - - - - -

+ + {% trans "Filter" %}: +
+ + + + + +
+ + {% if users.count == allusers %} {{ users.count }} {% blocktrans count counter=users.count %}participant{% plural %}participants{% endblocktrans %} {% else %} {{ users.count }} {% trans "of" %} {{ allusers }} {% trans "Participants" %} (= {{ percent }} %) {% endif %} +
{% trans "User Group" %} {% trans "Actions" %}
- - - + + + {% if perms.participant.can_manage_participant %} - - - + + + {% endif %} {% for user in users %} - - - + + + {% if perms.participant.can_manage_participant %} - - +
{% trans "First Name" %} {% trans "Last Name" %}{% trans "Category" %}{% trans "Type" %}{% trans "Committee" %}{% trans "Category" %}{% trans "Type" %}{% trans "Committee" %}{% trans "Comment" %}{% trans "Last Login" %}{% trans "Actions" %}{% trans "Comment" %}{% trans "Last Login" %}{% trans "Actions" %}
{{ user.first_name }} {{ user.last_name }}{{ user.category }}{{ user.get_type_display }}{{ user.committee }}{{ user.category }}{{ user.get_type_display }}{{ user.committee }}{{ user.comment|first_line }} + {{ user.comment|first_line }} {% if user.last_login > user.date_joined %} {{ user.last_login }} {% endif %} diff --git a/openslides/participant/templates/participant/password_change.html b/openslides/participant/templates/participant/password_change.html index 491aa987a..3a845dae5 100644 --- a/openslides/participant/templates/participant/password_change.html +++ b/openslides/participant/templates/participant/password_change.html @@ -4,28 +4,11 @@ {% block title %}{{ block.super }} – {% trans "Password Settings" %}{% endblock %} -{% block submenu %} -

{% trans "User Settings" %}

- -{% endblock %} - {% block content %}

{% trans "Password Settings" %}

{% csrf_token %} - {{ form.as_p }} - - - - - + {% include "form.html" %} + {% include "formbuttons_save.html" %}
-

{% endblock %} diff --git a/openslides/participant/templates/participant/settings.html b/openslides/participant/templates/participant/settings.html index 8c59157eb..746722cf3 100644 --- a/openslides/participant/templates/participant/settings.html +++ b/openslides/participant/templates/participant/settings.html @@ -4,27 +4,11 @@ {% block title %}{{ block.super }} – {% trans "Personal Settings" %}{% endblock %} -{% block submenu %} -

{% trans "User Settings" %}

- -{% endblock %} - {% block content %}

{% trans "Personal Settings" %}

{% csrf_token %} - {{ form_user.as_p }} - - - - - + {% include "form.html" %} + {% include "formbuttons_save.html" %}
{% endblock %} diff --git a/openslides/participant/views.py b/openslides/participant/views.py index a498e5285..69e2db7fe 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -451,17 +451,17 @@ def user_settings(request): Edit own user account. """ if request.method == 'POST': - form_user = UsersettingsForm(request.POST, instance=request.user) - if form_user.is_valid(): - form_user.save() + form = UsersettingsForm(request.POST, instance=request.user) + if form.is_valid(): + form.save() messages.success(request, _('User settings successfully saved.')) else: messages.error(request, _('Please check the form for errors.')) else: - form_user = UsersettingsForm(instance=request.user) + form = UsersettingsForm(instance=request.user) return { - 'form_user': form_user, + 'form': form, 'edituser': request.user, } diff --git a/openslides/static/styles/base.css b/openslides/static/styles/base.css index 1d4a65210..648b55204 100644 --- a/openslides/static/styles/base.css +++ b/openslides/static/styles/base.css @@ -49,10 +49,11 @@ a:hover { /* show optional column */ .optional { - display: block; + display: auto; +} +.help-inline { + font-size: 11px; } - - /* Left Menu */ diff --git a/openslides/templates/base.html b/openslides/templates/base.html index e221dd200..0fd26c505 100644 --- a/openslides/templates/base.html +++ b/openslides/templates/base.html @@ -42,7 +42,7 @@
  • {% trans "Logout" %}
  • {% else %} - {% trans "Login" %} + {% trans "Login" %} {% endif %} diff --git a/openslides/templates/form.html b/openslides/templates/form.html new file mode 100644 index 000000000..63b08a983 --- /dev/null +++ b/openslides/templates/form.html @@ -0,0 +1,12 @@ +{% for field in form %} +
    + + {{ field }} + {% if field.errors %} + {{ field.errors }} + {% endif %} + {% if field.help_text %} + {{ field.help_text }} + {% endif %} +
    +{% endfor %} diff --git a/openslides/templates/formbuttons_save.html b/openslides/templates/formbuttons_save.html new file mode 100644 index 000000000..d3b5a6ba6 --- /dev/null +++ b/openslides/templates/formbuttons_save.html @@ -0,0 +1,5 @@ +{% load i18n %} + + \ No newline at end of file diff --git a/openslides/templates/formbuttons_saveapply.html b/openslides/templates/formbuttons_saveapply.html new file mode 100644 index 000000000..48c4fb339 --- /dev/null +++ b/openslides/templates/formbuttons_saveapply.html @@ -0,0 +1,8 @@ +{% load i18n %} + + + \ No newline at end of file