Skip to content

Commit

Permalink
Make Liberecké Pyvo look better
Browse files Browse the repository at this point in the history
  • Loading branch information
encukou authored Feb 13, 2024
2 parents 074f5f9 + f2a641a commit beee21d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
6 changes: 6 additions & 0 deletions pyvocz/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ h1, h2, h3, h4, h5, h6 {
margin-top: 0;
}

h2, h3, h4, h5, h6 {
font-family: "Bree Serif", serif;
margin-top: .5em;
margin-bottom: .5em;
}

.container {
background-color: #fdfeff;
padding-top: 1em;
Expand Down
16 changes: 12 additions & 4 deletions pyvocz/templates/series.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h1>{{ self.title() }}</h1>
<a href="{{ event_add_link(series) }}">
přidat informace o dalším srazu</a
>.
</a>
</div>
</div>

{% if year==None %}
Expand Down Expand Up @@ -139,9 +139,17 @@ <h2>{{ tr('Historie srazů', 'Meetup History') }}</h2>
<a {% if year==None and all==None %}class="disabled"{% endif %}
href="{{ url_for('series', series_slug=series.slug, **paginate_prev) }}">&lt;</a>
</li>
<li class="paginate-link {% if year==None and all==None %}current{% endif %}">
<a href="{{ url_for('series', series_slug=series.slug, year=None) }}">{{ tr("Nové", "New") }}</a>
</li>
{% if new_history %}
<li class="paginate-link {% if year==None and all==None %}current{% endif %}">
<a href="{{ url_for('series', series_slug=series.slug, year=None) }}">
{% if new_history %}
{{ tr("Nové", "New") }}
{% else %}
{{ tr("Předchozí", "Previous") }}
{% endif %}
</a>
</li>
{% endif %}
{% for page in all_years|reverse %}
<li class="paginate-link {% if page==year %}current{% endif %}">
<a href="{{ url_for('series', series_slug=series.slug, year=page) }}">{{ page }}</a>
Expand Down
28 changes: 19 additions & 9 deletions pyvocz/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,28 @@ def series(series_slug, year=None, all=None):
# Otherwise, if there are no events in requested year, return 404.
abort(404)

events = list(reversed(series.events))
all_events = list(reversed(series.events))

if not all:
if all:
events = all_events
else:
if year is None:
# The 'New' page displays the current year as well as the last one
events = [e for e in events if e.date.year >= today.year - 1]
events = [e for e in all_events if e.date.year >= today.year - 1]
else:
events = [e for e in events if e.date.year == year]
events = [e for e in all_events if e.date.year == year]

# Split events between future and past
# (today's event, if any, is considered future)
past_events = [e for e in events if e.date < today]
future_events = [e for e in events if e.date >= today]

new_history = True
if not all and year is None:
# On the home page of the series, if there are no recent enough
# past events, show up to 5 last ones.
new_history = False
past_events = [e for e in all_events if e.date < today][:5]

if all is not None:
paginate_prev = {'year': first_year}
Expand All @@ -208,11 +222,6 @@ def series(series_slug, year=None, all=None):

has_events = bool(events)

# Split events between future and past
# (today's event, if any, is considered future)
past_events = [e for e in events if e.date < today]
future_events = [e for e in events if e.date >= today]

# Events are ordered closest first;
# for future ones this means ascending order
future_events.reverse()
Expand All @@ -235,6 +244,7 @@ def series(series_slug, year=None, all=None):
all_years=all_years, paginate_prev=paginate_prev,
paginate_next=paginate_next, has_events=has_events,
event_add_link=event_add_link,
new_history=new_history,
)


Expand Down

0 comments on commit beee21d

Please sign in to comment.