Skip to content

Commit beee21d

Browse files
authored
Make Liberecké Pyvo look better
#170
2 parents 074f5f9 + f2a641a commit beee21d

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed

pyvocz/static/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ h1, h2, h3, h4, h5, h6 {
1010
margin-top: 0;
1111
}
1212

13+
h2, h3, h4, h5, h6 {
14+
font-family: "Bree Serif", serif;
15+
margin-top: .5em;
16+
margin-bottom: .5em;
17+
}
18+
1319
.container {
1420
background-color: #fdfeff;
1521
padding-top: 1em;

pyvocz/templates/series.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ <h1>{{ self.title() }}</h1>
5151
<a href="{{ event_add_link(series) }}">
5252
přidat informace o dalším srazu</a
5353
>.
54-
</a>
54+
</div>
5555
</div>
5656

5757
{% if year==None %}
@@ -139,9 +139,17 @@ <h2>{{ tr('Historie srazů', 'Meetup History') }}</h2>
139139
<a {% if year==None and all==None %}class="disabled"{% endif %}
140140
href="{{ url_for('series', series_slug=series.slug, **paginate_prev) }}">&lt;</a>
141141
</li>
142-
<li class="paginate-link {% if year==None and all==None %}current{% endif %}">
143-
<a href="{{ url_for('series', series_slug=series.slug, year=None) }}">{{ tr("Nové", "New") }}</a>
144-
</li>
142+
{% if new_history %}
143+
<li class="paginate-link {% if year==None and all==None %}current{% endif %}">
144+
<a href="{{ url_for('series', series_slug=series.slug, year=None) }}">
145+
{% if new_history %}
146+
{{ tr("Nové", "New") }}
147+
{% else %}
148+
{{ tr("Předchozí", "Previous") }}
149+
{% endif %}
150+
</a>
151+
</li>
152+
{% endif %}
145153
{% for page in all_years|reverse %}
146154
<li class="paginate-link {% if page==year %}current{% endif %}">
147155
<a href="{{ url_for('series', series_slug=series.slug, year=page) }}">{{ page }}</a>

pyvocz/views.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,28 @@ def series(series_slug, year=None, all=None):
178178
# Otherwise, if there are no events in requested year, return 404.
179179
abort(404)
180180

181-
events = list(reversed(series.events))
181+
all_events = list(reversed(series.events))
182182

183-
if not all:
183+
if all:
184+
events = all_events
185+
else:
184186
if year is None:
185187
# The 'New' page displays the current year as well as the last one
186-
events = [e for e in events if e.date.year >= today.year - 1]
188+
events = [e for e in all_events if e.date.year >= today.year - 1]
187189
else:
188-
events = [e for e in events if e.date.year == year]
190+
events = [e for e in all_events if e.date.year == year]
191+
192+
# Split events between future and past
193+
# (today's event, if any, is considered future)
194+
past_events = [e for e in events if e.date < today]
195+
future_events = [e for e in events if e.date >= today]
196+
197+
new_history = True
198+
if not all and year is None:
199+
# On the home page of the series, if there are no recent enough
200+
# past events, show up to 5 last ones.
201+
new_history = False
202+
past_events = [e for e in all_events if e.date < today][:5]
189203

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

209223
has_events = bool(events)
210224

211-
# Split events between future and past
212-
# (today's event, if any, is considered future)
213-
past_events = [e for e in events if e.date < today]
214-
future_events = [e for e in events if e.date >= today]
215-
216225
# Events are ordered closest first;
217226
# for future ones this means ascending order
218227
future_events.reverse()
@@ -235,6 +244,7 @@ def series(series_slug, year=None, all=None):
235244
all_years=all_years, paginate_prev=paginate_prev,
236245
paginate_next=paginate_next, has_events=has_events,
237246
event_add_link=event_add_link,
247+
new_history=new_history,
238248
)
239249

240250

0 commit comments

Comments
 (0)