diff --git a/README.md b/README.md index 0fe3bb4..c179946 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Goslar Event Prototype +# Oveda - Open Event Database ![Tests](https://github.com/DanielGrams/gsevpt/workflows/Tests/badge.svg) [![codecov](https://codecov.io/gh/DanielGrams/gsevpt/branch/master/graph/badge.svg?token=66CLLWWV7Y)](https://codecov.io/gh/DanielGrams/gsevpt) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) ![Docker Pulls](https://img.shields.io/docker/pulls/danielgrams/gsevpt) -Website prototype using Python, Flask and Postgres. | +Event website using Python, Flask and Postgres. ## Deployment diff --git a/app.json b/app.json index 95c4c95..412eaca 100644 --- a/app.json +++ b/app.json @@ -1,18 +1,18 @@ { - "name": "Goslar Event Prototype", - "description": "Website prototype using Python, Flask and Postgres running on Heroku.", - "image": "heroku/python", - "keywords": ["python" ], - "repository": "https://github.com/DanielGrams/gsevpt", - "addons": [ "heroku-postgresql" ], - "env": { - "SECRET_TOKEN": { - "description": "A secret key for verifying the integrity of signed cookies.", - "generator": "secret" - }, - "SECURITY_PASSWORD_SALT": { - "description": "Bcrypt salt for encrypting passwords.", - "generator": "secret" - } + "name": "Oveda - Open Event Database", + "description": "Event website using Python, Flask and Postgres.", + "image": "heroku/python", + "keywords": ["python"], + "repository": "https://github.com/DanielGrams/gsevpt", + "addons": ["heroku-postgresql"], + "env": { + "SECRET_TOKEN": { + "description": "A secret key for verifying the integrity of signed cookies.", + "generator": "secret" + }, + "SECURITY_PASSWORD_SALT": { + "description": "Bcrypt salt for encrypting passwords.", + "generator": "secret" } - } \ No newline at end of file + } +} diff --git a/doc/deployment.md b/doc/deployment.md index 5093256..c93db6d 100644 --- a/doc/deployment.md +++ b/doc/deployment.md @@ -63,7 +63,7 @@ Create `.env` file in the root directory or pass as environment variables. | SECRET_KEY | A secret key for verifying the integrity of signed cookies. Generate a nice key using `python3 -c "import secrets; print(secrets.token_urlsafe())"`. | | SECURITY_PASSWORD_HASH | Bcrypt is set as default SECURITY_PASSWORD_HASH, which requires a salt. Generate a good salt using: `python3 -c "import secrets; print(secrets.SystemRandom().getrandbits(128))"`. | | JWT_PRIVATE_KEY | Private key for JWT (see "Generate JWT Keys for OIDC/OAuth") | -| SECURITY_PASSWORD_HASH | JWT_PUBLIC_JWKS (see "Generate JWT Keys for OIDC/OAuth") | +| JWT_PUBLIC_JWKS | Public JWKS (see "Generate JWT Keys for OIDC/OAuth") | ### Send notifications via Mail diff --git a/project/jinja_filters.py b/project/jinja_filters.py index 06397b8..c7f6fe6 100644 --- a/project/jinja_filters.py +++ b/project/jinja_filters.py @@ -21,6 +21,13 @@ def any_dict_value_true(data: dict): return any(data.values()) +def ensure_link_scheme(link: str): + if link.startswith("http://") or link.startswith("https://"): + return link + + return f"https://{link}" + + app.jinja_env.filters["event_category_name"] = lambda u: get_event_category_name(u) app.jinja_env.filters["loc_enum"] = lambda u: get_localized_enum_name(u) app.jinja_env.filters["loc_scope"] = lambda s: get_localized_scope(s) @@ -28,6 +35,7 @@ app.jinja_env.filters["env_override"] = env_override app.jinja_env.filters["quote_plus"] = lambda u: quote_plus(u) app.jinja_env.filters["is_list"] = is_list app.jinja_env.filters["any_dict_value_true"] = any_dict_value_true +app.jinja_env.filters["ensure_link_scheme"] = lambda s: ensure_link_scheme(s) @app.context_processor diff --git a/project/templates/_macros.html b/project/templates/_macros.html index a7f5ac0..911d974 100644 --- a/project/templates/_macros.html +++ b/project/templates/_macros.html @@ -202,8 +202,8 @@ {% endif %} {% endmacro %} -{% macro render_enum_prop(prop, icon, label_key) %} -{% if prop and prop.value > 0 %} +{% macro render_enum_prop(prop, icon, label_key, ignore=0) %} +{% if prop and prop.value > 0 and prop.value != ignore %}
{{ prop | loc_enum }} @@ -233,7 +233,7 @@ {% if link %}
- {{ link }} + {{ link }}
{% endif %} {% endmacro %} @@ -365,8 +365,8 @@ {{ render_bool_prop(event.kid_friendly, 'fa-child', 'Kid friendly') }} {{ render_bool_prop(event.accessible_for_free, 'fa-door-open', 'Accessible for free') }} {{ render_range_prop(event.age_from, event.age_to, 'fa-people-arrows', 'Typical Age range') }} -{{ render_enum_prop(event.target_group_origin, 'fa-users', 'Target group origin') }} -{{ render_enum_prop(event.attendance_mode, 'fa-mouse-pointer', 'Attendance mode') }} +{{ render_enum_prop(event.target_group_origin, 'fa-users', 'Target group origin', 1) }} +{{ render_enum_prop(event.attendance_mode, 'fa-mouse-pointer', 'Attendance mode', 1) }} {{ render_bool_prop(event.registration_required, 'fa-list', 'Registration required') }} {{ render_bool_prop(event.booked_up, 'fa-square-full', 'Booked up') }} {{ render_int_prop(event.expected_participants, 'fa-users', 'Expected number of participants') }} @@ -394,12 +394,12 @@ {% if end %}- {{ end | datetimeformat('short') }}{% endif %}
{% endif %} - {{ render_enum_prop(event.status, 'fa-info-circle', 'Status') }} + {{ render_enum_prop(event.status, 'fa-info-circle', 'Status', 1) }} {% if event.previous_start_date %}
{{ event.previous_start_date | datetimeformat('short') }}
{% endif %} - {% if show_rating and event.rating %} + {% if show_rating and event.rating and event.rating != 50 %} {{ render_string_prop("%d/10" % (event.rating/10), 'fa-adjust', 'Rating') }} {% endif %} @@ -441,9 +441,17 @@ {{ render_location_prop(event.event_place.location) }} + {% if event.attendance_mode and event.attendance_mode.value != 1 %}

{{ _('Show directions') }}

+ {% endif %} + + {% if event.attendance_mode and event.attendance_mode.value == 2 %} +

{{ _('The event takes place online.') }}

+ {% elif event.attendance_mode and event.attendance_mode.value == 3 %} +

{{ _('The event takes place both offline and online.') }}

+ {% endif %} {% endif %} @@ -532,12 +540,12 @@

{{ _('Event') }}

- {{ render_enum_prop(event.status, 'fa-info-circle', 'Status') }} + {{ render_enum_prop(event.status, 'fa-info-circle', 'Status', 1) }} {% if event.previous_start_date %}
{{ event.previous_start_date | datetimeformat('short') }}
{% endif %} - {% if show_rating and event.rating %} + {% if show_rating and event.rating and event.rating != 50 %} {{ render_string_prop("%d/10" % (event.rating/10), 'fa-adjust', 'Rating') }} {% endif %} @@ -546,10 +554,10 @@
{% if event.description %} -
{{ event.description }}
+
{{ event.description }}
{% endif %} -
+
{{ render_audit(event, show_rating) }}
@@ -572,9 +580,17 @@ {{ render_link_prop(event.event_place.url) }} {{ render_location_prop(event.event_place.location) }} -
- {{ _('Show directions') }} -
+ {% if event.attendance_mode and event.attendance_mode.value != 2 %} +
+ {{ _('Show directions') }} +
+ {% endif %} + + {% if event.attendance_mode and event.attendance_mode.value == 2 %} +
{{ _('The event takes place online.') }}
+ {% elif event.attendance_mode and event.attendance_mode.value == 3 %} +
{{ _('The event takes place both offline and online.') }}
+ {% endif %} diff --git a/project/templates/home.html b/project/templates/home.html index eae4ee7..f82c11d 100644 --- a/project/templates/home.html +++ b/project/templates/home.html @@ -113,7 +113,7 @@ oveda - Offene Veranstaltungsdatenbank
Grafik Entwicklung
Entwicklungsphase
-

Wir haben aktuell einen gut funktionierenden Prototypen, der gerne getestet werden darf.

+

Wir haben aktuell einen gut funktionierenden Stand, der gerne getestet werden darf.

diff --git a/project/translations/de/LC_MESSAGES/messages.mo b/project/translations/de/LC_MESSAGES/messages.mo index e165f4e..2d70fde 100644 Binary files a/project/translations/de/LC_MESSAGES/messages.mo and b/project/translations/de/LC_MESSAGES/messages.mo differ diff --git a/project/translations/de/LC_MESSAGES/messages.po b/project/translations/de/LC_MESSAGES/messages.po index 865c02f..c0fb775 100644 --- a/project/translations/de/LC_MESSAGES/messages.po +++ b/project/translations/de/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2021-04-18 15:53+0200\n" +"POT-Creation-Date: 2021-04-20 16:47+0200\n" "PO-Revision-Date: 2020-06-07 18:51+0200\n" "Last-Translator: FULL NAME \n" "Language: de\n" @@ -176,7 +176,7 @@ msgstr "Nutzungsbedingungen" msgid "Legal notice" msgstr "Impressum" -#: project/forms/admin.py:12 project/templates/_macros.html:1151 +#: project/forms/admin.py:12 project/templates/_macros.html:1167 #: project/templates/layout.html:193 #: project/templates/widget/event_suggestion/create.html:155 #: project/views/root.py:54 @@ -615,7 +615,7 @@ msgstr "Teilnahme" #: project/forms/event.py:187 msgid "EventAttendanceMode.offline" -msgstr "Offline" +msgstr "Normal (Offline)" #: project/forms/event.py:191 msgid "EventAttendanceMode.online" @@ -651,7 +651,7 @@ msgid "An event can last a maximum of 24 hours." msgstr "Eine Veranstaltung darf maximal 24 Stunden dauern." #: project/forms/event.py:225 project/templates/_macros.html:399 -#: project/templates/_macros.html:537 +#: project/templates/_macros.html:545 msgid "Previous start date" msgstr "Vorheriges Startdatum" @@ -683,7 +683,7 @@ msgstr "Wähle aus, wie relevant die Veranstaltung für deine Organisation ist." #: project/forms/event.py:250 project/forms/event.py:259 #: project/forms/event.py:319 project/forms/event_suggestion.py:50 -#: project/templates/_macros.html:425 project/templates/_macros.html:560 +#: project/templates/_macros.html:425 project/templates/_macros.html:568 #: project/templates/event/create.html:108 #: project/templates/event/update.html:58 #: project/templates/event_place/create.html:21 @@ -702,8 +702,8 @@ msgstr "Neuen Ort eingeben" #: project/forms/event.py:266 project/forms/event.py:275 #: project/forms/event.py:327 project/forms/event.py:373 -#: project/forms/event_suggestion.py:57 project/templates/_macros.html:455 -#: project/templates/_macros.html:585 project/templates/event/create.html:83 +#: project/forms/event_suggestion.py:57 project/templates/_macros.html:463 +#: project/templates/_macros.html:601 project/templates/event/create.html:83 #: project/templates/event/update.html:49 #: project/templates/organizer/create.html:17 #: project/templates/organizer/delete.html:13 @@ -788,7 +788,7 @@ msgstr "Wähle den Status der Veranstaltung." msgid "Update event" msgstr "Veranstaltung aktualisieren" -#: project/forms/event.py:358 project/templates/_macros.html:1099 +#: project/forms/event.py:358 project/templates/_macros.html:1115 #: project/templates/event/actions.html:41 #: project/templates/event/delete.html:6 msgid "Delete event" @@ -956,7 +956,7 @@ msgid "Weekdays" msgstr "Wochentage" #: project/forms/reference.py:11 project/forms/reference_request.py:15 -#: project/templates/_macros.html:476 project/templates/_macros.html:607 +#: project/templates/_macros.html:484 project/templates/_macros.html:623 #: project/templates/admin_unit/create.html:17 #: project/templates/admin_unit/update.html:18 msgid "Admin unit" @@ -983,7 +983,7 @@ msgstr "Anfrage speichern" msgid "Delete request" msgstr "Anfrage löschen" -#: project/forms/reference_request.py:27 project/templates/_macros.html:1163 +#: project/forms/reference_request.py:27 project/templates/_macros.html:1179 #: project/templates/event_suggestion/review_status.html:18 #: project/templates/reference_request/review_status.html:12 msgid "Review status" @@ -1038,7 +1038,7 @@ msgid "This field is optional." msgstr "Dieses Feld ist optional." #: project/templates/_macros.html:116 project/templates/_macros.html:385 -#: project/templates/_macros.html:392 project/templates/_macros.html:780 +#: project/templates/_macros.html:392 project/templates/_macros.html:796 msgid "Date" msgstr "Datum" @@ -1078,7 +1078,7 @@ msgstr "Zuletzt aktualisiert am %(updated_at)s von %(updated_by)s." msgid "Last updated at %(updated_at)s." msgstr "Zuletzt aktualisiert am %(updated_at)s." -#: project/templates/_macros.html:378 project/templates/_macros.html:533 +#: project/templates/_macros.html:378 project/templates/_macros.html:541 #: project/templates/event/actions.html:12 #: project/templates/event/create.html:62 #: project/templates/event/delete.html:13 @@ -1088,26 +1088,34 @@ msgstr "Zuletzt aktualisiert am %(updated_at)s." msgid "Event" msgstr "Veranstaltung" -#: project/templates/_macros.html:388 project/templates/_macros.html:519 +#: project/templates/_macros.html:388 project/templates/_macros.html:527 #, python-format msgid "%(count)d event dates" msgstr "%(count)d Termine" -#: project/templates/_macros.html:445 project/templates/_macros.html:576 +#: project/templates/_macros.html:446 project/templates/_macros.html:585 msgid "Show directions" msgstr "Anreise planen" -#: project/templates/_macros.html:627 project/templates/event_date/list.html:4 +#: project/templates/_macros.html:451 project/templates/_macros.html:590 +msgid "The event takes place online." +msgstr "Die Veranstaltung findet online statt." + +#: project/templates/_macros.html:453 project/templates/_macros.html:592 +msgid "The event takes place both offline and online." +msgstr "Die Veranstaltung findet sowohl offline als auch online statt." + +#: project/templates/_macros.html:643 project/templates/event_date/list.html:4 #: project/templates/event_date/list.html:256 #: project/templates/reference_request/review.html:30 msgid "Event Dates" msgstr "Termine" -#: project/templates/_macros.html:698 +#: project/templates/_macros.html:714 msgid "Search location on Google" msgstr "Ort bei Google suchen" -#: project/templates/_macros.html:730 project/templates/_macros.html:732 +#: project/templates/_macros.html:746 project/templates/_macros.html:748 #: project/templates/event_date/list.html:277 #: project/templates/widget/event_suggestion/create.html:144 #: project/templates/widget/event_suggestion/create.html:169 @@ -1118,12 +1126,12 @@ msgstr "Ort bei Google suchen" msgid "Previous" msgstr "Zurück" -#: project/templates/_macros.html:734 +#: project/templates/_macros.html:750 #, python-format msgid "Page %(page)d of %(pages)d (%(total)d total)" msgstr "Seite %(page)d von %(pages)d (%(total)d insgesamt)" -#: project/templates/_macros.html:736 project/templates/_macros.html:738 +#: project/templates/_macros.html:752 project/templates/_macros.html:754 #: project/templates/event_date/list.html:279 #: project/templates/widget/event_suggestion/create.html:145 #: project/templates/widget/event_suggestion/create.html:170 @@ -1133,35 +1141,35 @@ msgstr "Seite %(page)d von %(pages)d (%(total)d insgesamt)" msgid "Next" msgstr "Weiter" -#: project/templates/_macros.html:803 +#: project/templates/_macros.html:819 msgid "Radius" msgstr "Umkreis" -#: project/templates/_macros.html:1008 +#: project/templates/_macros.html:1024 msgid "Edit image" msgstr "Bild bearbeiten" -#: project/templates/_macros.html:1029 +#: project/templates/_macros.html:1045 msgid "Close" msgstr "Schließen" -#: project/templates/_macros.html:1030 +#: project/templates/_macros.html:1046 msgid "Okay" msgstr "OK" -#: project/templates/_macros.html:1039 project/templates/_macros.html:1041 +#: project/templates/_macros.html:1055 project/templates/_macros.html:1057 msgid "Choose image file" msgstr "Bild-Datei auswählen" -#: project/templates/_macros.html:1098 project/templates/event/actions.html:40 +#: project/templates/_macros.html:1114 project/templates/event/actions.html:40 msgid "Edit event" msgstr "Veranstaltung bearbeiten" -#: project/templates/_macros.html:1101 project/templates/manage/events.html:30 +#: project/templates/_macros.html:1117 project/templates/manage/events.html:30 msgid "More" msgstr "Mehr" -#: project/templates/_macros.html:1123 +#: project/templates/_macros.html:1139 msgid "Event suggestion" msgstr "Veranstaltungsvorschlag"