Skip to content

Commit dba210f

Browse files
authored
Merge pull request #77 from klubFITpp/upcomming
Upravení akcí na nadcházející akce
2 parents 9119074 + b2c5fea commit dba210f

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

index.html

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,30 @@ <h3 class="about__article__title"><i class="about__article__title__icon ion ion-
2727
</section>
2828

2929
<section class="events">
30-
<h2 class="section__title">Akce</h2>
30+
<h2 class="section__title">Nadcházející akce</h2>
3131
<div class="events__article__wrapper">
32-
{% assign events = site.events | sort: 'date' | reverse %}
33-
{% for event in events limit:3 %}
34-
<a href="{{event.url}}">
35-
<article class="event__article " >
36-
<h3 class="event__title">{{event.title}}</h3>
37-
<div class="event__background event__image" style="background-image: url({{ event.img | relative_url }});">
38-
</div>
39-
<div class="event__footer ">
40-
<small class="event__date">{{ event.date | date: "%-d. %-m. %Y" }}</small>
41-
<span class="event__link" href="{{event.url}}">Více</span>
42-
</div>
43-
</article>
44-
</a>
32+
{% assign today = 'now' | date: "%s" %} <!-- Get today's date as a timestamp -->
33+
{% assign yesterday = today | minus: 86400 %}
34+
{% assign i = 0 %}
35+
{% for event in site.events %}
36+
{% assign event_timestamp = event.date | date: "%s" %}
37+
{% assign event_timestamp_int = event_timestamp | minus: 0 %}
38+
{% if event_timestamp_int > yesterday %}
39+
{% assign i = i | plus: 1 %}
40+
{% if i < 4 %}
41+
<a href="{{event.url}}">
42+
<article class="event__article " >
43+
<h3 class="event__title">{{event.title}}</h3>
44+
<div class="event__background event__image" style="background-image: url({{ event.img | relative_url }});">
45+
</div>
46+
<div class="event__footer ">
47+
<small class="event__date">{{ event.date | date: "%-d. %-m. %Y" }}</small>
48+
<span class="event__link" href="{{event.url}}">Více</span>
49+
</div>
50+
</article>
51+
</a>
52+
{% endif %}
53+
{% endif %}
4554
{% endfor %}
4655
</div>
4756
<a class="events__more__link" href="/events">Další akce</a>

0 commit comments

Comments
 (0)