Merge pull request #168 from DanielGrams/issues/167

Add attendance mode to event lists #167
This commit is contained in:
Daniel Grams 2021-05-02 15:34:20 +02:00 committed by GitHub
commit 08b04a7e87
5 changed files with 24 additions and 3 deletions

View File

@ -180,6 +180,7 @@ class EventSearchItemSchema(EventRefSchema):
organizer = fields.Nested(OrganizerRefSchema)
organization = fields.Nested(OrganizationRefSchema, attribute="admin_unit")
categories = fields.List(fields.Nested(EventCategoryRefSchema))
attendance_mode = EnumField(EventAttendanceMode)
class EventListRequestSchema(PaginationRequestSchema):

File diff suppressed because one or more lines are too long

View File

@ -259,8 +259,14 @@
{% endif %}
{% endmacro %}
{% macro render_attendance_mode_pill(event) %}
{% if event.attendance_mode and event.attendance_mode.value != 1 %}
<span class="badge badge-pill badge-info">{{ event.attendance_mode | loc_enum }}</span>
{% endif %}
{% endmacro %}
{% macro render_event_warning_pills(event) %}
{{ render_event_status_pill(event) }} {{ render_booked_up_pill(event) }}
{{ render_event_status_pill(event) }} {{ render_booked_up_pill(event) }} {{ render_attendance_mode_pill(event) }}
{% endmacro %}
{% macro render_event_review_status_pill(event) %}

View File

@ -80,6 +80,19 @@
return '';
}
function render_attendance_mode_pill(event) {
if (event.attendance_mode != null) {
if (event.attendance_mode == "online") {
return '<span class="badge badge-pill badge-info">{{ _('EventAttendanceMode.online') }}</span>';
}
if (event.attendance_mode == "mixed") {
return '<span class="badge badge-pill badge-info">{{ _('EventAttendanceMode.mixed') }}</span>';
}
}
return '';
}
function render_booked_up_pill(event) {
if (event.booked_up) {
return '<span class="badge badge-pill badge-warning">{{ _('Booked up') }}</span>';
@ -89,7 +102,7 @@
}
function render_event_warning_pills(event) {
return render_event_status_pill(event) + ' ' + render_booked_up_pill(event);
return render_event_status_pill(event) + ' ' + render_booked_up_pill(event) + ' ' + render_attendance_mode_pill(event);
}
</script>

View File

@ -26,6 +26,7 @@ def event_suggestion_review(event_suggestion_id):
@app.route(
"/event_suggestion/<int:event_suggestion_id>/reject", methods=("GET", "POST")
)
@auth_required()
def event_suggestion_reject(event_suggestion_id):
event_suggestion = EventSuggestion.query.get_or_404(event_suggestion_id)
access_or_401(event_suggestion.admin_unit, "event:verify")