Allow displaying event details

This commit is contained in:
Gergely Polonkai 2018-07-03 14:22:03 +02:00
parent bba44a3c7f
commit ba7c766316
3 changed files with 32 additions and 3 deletions

View File

@ -204,5 +204,17 @@ class CalendarSocialApp(Flask):
return render_template('user-settings.html', form=form)
@staticmethod
@route('/event/<int:event_id>')
def event_details(event_id):
"""View to display event details
"""
from .models import Event
event = Event.query.get_or_404(event_id)
return render_template('event-details.html', event=event)
app = CalendarSocialApp(__name__)

View File

@ -0,0 +1,14 @@
{% extends 'base.html' %}
{% block content %}
<h1>
{{ event.title }}<br>
<small>
{{ event.start_time_for_user(current_user) }}{{ event.end_time_for_user(current_user) }}
{% if current_user.timezone | string != event.time_zone %}
({{ event.start_time_tz }}{{ event.end_time_tz }} {{ event.time_zone }})
{% endif %}
</small>
</h1>
{{ event.description }}
{% endblock %}

View File

@ -47,7 +47,10 @@
background-color: #d8d8d8;
}
tr.week > td > div.event {
tr.week > td > a.event {
display: block;
color: black;
text-decoration: none;
border: 1px solid green;
background-color: white;
border-radius: 2px;
@ -118,10 +121,10 @@
<td class="{% if day.month != calendar.timestamp.month %} other-month{% endif %}{% if day.date() == now.date() %} today{% endif %}">
<span class="day-num">{{ day.day }}</span>
{% for event in calendar.day_events(day, user=current_user) %}
<div class="event">
<a href="{{ url_for('event_details', event_id=event.id) }}" class="event">
{{ event.start_time_for_user(current_user).strftime('%H:%M') }}{{ event.end_time_for_user(current_user).strftime('%H:%M') }}
{{ event.title }}
</div>
</a>
{% endfor %}
</td>
{% endfor %}