mirror of
https://github.com/lucaspalomodevelop/eventcally.git
synced 2026-03-13 00:07:22 +00:00
Menüpunkt Alle Events mit Filter
This commit is contained in:
parent
a5fc4a1cce
commit
dc64f843fa
34
app.py
34
app.py
@ -1093,9 +1093,39 @@ def event_review(event_id):
|
||||
|
||||
@app.route("/eventdates")
|
||||
def event_dates():
|
||||
dates = EventDate.query.filter(EventDate.start >= today).order_by(EventDate.start).all()
|
||||
date_from = today
|
||||
date_to = date_set_end_of_day(today + relativedelta(months=12))
|
||||
date_from_str = form_input_from_date(date_from)
|
||||
date_to_str = form_input_from_date(date_to)
|
||||
keyword = ''
|
||||
|
||||
if 'date_from' in request.args:
|
||||
date_from_str = request.args['date_from']
|
||||
date_from = form_input_to_date(date_from_str)
|
||||
|
||||
if 'date_to' in request.args:
|
||||
date_to_str = request.args['date_to']
|
||||
date_to = form_input_to_date(date_to_str)
|
||||
|
||||
if 'keyword' in request.args:
|
||||
keyword = request.args['keyword']
|
||||
|
||||
date_filter = and_(EventDate.start >= date_from, EventDate.start < date_to)
|
||||
|
||||
if keyword:
|
||||
like_keyword = '%' + keyword + '%'
|
||||
event_filter = and_(Event.verified, or_(Event.name.ilike(like_keyword), Event.description.ilike(like_keyword), Event.tags.ilike(like_keyword)))
|
||||
else:
|
||||
event_filter = Event.verified
|
||||
|
||||
dates = EventDate.query.join(Event).filter(date_filter).filter(event_filter).order_by(EventDate.start).paginate()
|
||||
|
||||
return render_template('event_date/list.html',
|
||||
dates=dates)
|
||||
date_from_str=date_from_str,
|
||||
date_to_str=date_to_str,
|
||||
keyword=keyword,
|
||||
dates=dates.items,
|
||||
pagination=get_pagination_urls(dates))
|
||||
|
||||
@app.route('/eventdate/<int:id>')
|
||||
def event_date(id):
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{% extends "layout.html" %}
|
||||
{% from "_macros.html" import render_event_status_pill, render_ooa, render_place, render_events_sub_menu %}
|
||||
{% from "_macros.html" import render_pagination, render_event_status_pill, render_ooa, render_place, render_events_sub_menu %}
|
||||
{% block title %}
|
||||
{{ _('Event Dates') }}
|
||||
{% endblock %}
|
||||
@ -7,6 +7,32 @@
|
||||
|
||||
<h1>{{ _('Event Dates') }}</h1>
|
||||
|
||||
<form action="{{ url_for('event_dates') }}" class="form-inline mb-4" method="GET" autocomplete="off">
|
||||
|
||||
<div class="input-group mb-2 mr-sm-2">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">{{ _('From') }}</span>
|
||||
</div>
|
||||
<input type="text" id="date_from" name="date_from" value="{{ date_from_str }}" class="form-control datepicker" />
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-2 mr-sm-2">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">{{ _('to') }}</span>
|
||||
</div>
|
||||
<input type="text" id="date_to" name="date_to" value="{{ date_to_str }}" class="form-control datepicker" />
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-2 mr-sm-2">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">{{ _('Keyword') }}</span>
|
||||
</div>
|
||||
<input type="text" name="keyword" value="{{ keyword }}" class="form-control" />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary mb-2">{{ _('Find') }}</button>
|
||||
</form>
|
||||
|
||||
{% for date in dates %}
|
||||
<div class="card mb-3" style="max-width: 768px;">
|
||||
{% if date.event.photo_id %}
|
||||
@ -16,10 +42,12 @@
|
||||
<h5 class="card-title">{{ date.event.name }}{{ render_event_status_pill(date.event) }}</h5>
|
||||
<h6 class="card-subtitle mb-2 text-muted"><i class="fa fa-calendar"></i> {{ date.start | datetimeformat('short') }}</h6>
|
||||
<p class="card-text">{{ date.event.description | truncate(100) }}</p>
|
||||
<small class="text-muted"><i class="fa fa-map-marker"></i>{{ date.event.event_place.name }}</small>
|
||||
<small class="text-muted"><i class="fa fa-map-marker"></i> {{ date.event.event_place.name }}</small>
|
||||
<a href="{{ url_for('event_date', id=date.id) }}" class="stretched-link"></a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{{ render_pagination(pagination) }}
|
||||
|
||||
{% endblock %}
|
||||
@ -52,6 +52,7 @@
|
||||
<a class="nav-item nav-link" href="{{ url_for('manage') }}">{{ _('Manage') }}</a>
|
||||
{% endif %}
|
||||
|
||||
<a class="nav-item nav-link" href="{{ url_for('event_dates') }}">{{ _('Events') }}</a>
|
||||
<a class="nav-item nav-link" href="{{ url_for('example') }}">{{ _('Example') }}</a>
|
||||
<a class="nav-item nav-link" href="{{ url_for('developer') }}">{{ _('Developer') }}</a>
|
||||
</div>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<form action="{{ url_for('widget_event_dates', au_short_name='goslar') }}" class="form-inline mb-4" method="GET" autocomplete="off">
|
||||
<form action="" class="form-inline mb-4" method="GET" autocomplete="off">
|
||||
|
||||
<div class="input-group mb-2 mr-sm-2">
|
||||
<div class="input-group-prepend">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user