This is an automated email from the ASF dual-hosted git repository.

vogievetsky pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid-website-src.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c8fadd4 Update event-list.html
     new 4e8288dd Merge pull request #356 from 
petermarshallio/202212-events-dateLimit
1c8fadd4 is described below

commit 1c8fadd4c2a91816a637d8ff0dad5997f0bd230b
Author: Peter Marshall <[email protected]>
AuthorDate: Mon Dec 12 15:02:01 2022 +0000

    Update event-list.html
    
    Amends the iterator so that an event is only included if it's today or 
afterwards (bit of a hack without the time) - so only upcoming events are 
shown. Kicks out "nothing scheduled yet" if no events are relevant.
---
 _includes/event-list.html | 49 ++++++++++++++++++++++++++++++++---------------
 1 file changed, 34 insertions(+), 15 deletions(-)

diff --git a/_includes/event-list.html b/_includes/event-list.html
index ba646528..f30dfea7 100644
--- a/_includes/event-list.html
+++ b/_includes/event-list.html
@@ -4,23 +4,42 @@
   <h3>
     Upcoming Events
   </h3>
-  {% for event in site.data.events limit: 7 %}
-  <div class="event">
-    <div class="mini-cal">
-      <div class="date-month">
-        {{ event.date | date: "%b" }}
-      </div>
-      <div class="date-day">
-        {{ event.date | date: "%e" }}
+  {% assign event_count = 0 %}
+  {% assign event_count_max = 7 %}
+  {% assign today_date = "now" | date: '%s' | minus: 86400 | date: '%s' %}
+
+  {% for event in site.data.events %}
+
+    {% assign event_date = event.date | date: '%s' %}
+
+    {% if today_date < event_date %}
+
+    <div class="event">
+      <div class="mini-cal">
+        <div class="date-month">
+          {{ event.date | date: "%b" }}
+        </div>
+        <div class="date-day">
+          {{ event.date | date: "%e" }}
+        </div>
       </div>
+      <p>
+        <a href="{{ event.link }}">
+          <span class ="title">{{ event.name }}</span><br>
+          <span class="text-muted">{{ event.info }}</span>
+        </a>
+      </p>
     </div>
-    <p>
-      <a href="{{ event.link }}">
-        <span class ="title">{{ event.name }}</span><br>
-        <span class="text-muted">{{ event.info }}</span>
-      </a>
-    </p>
-  </div>
+
+      {% assign event_count = event_count | plus: 1 %}
+
+    {% endif %}
+
+    {% if event_count == event_count_max %} {% break %} {% endif %}
+
   {% endfor %}
+
+  {% if event_count == 0 %} <p>Nothing scheduled yet.</p> {% endif %}
+
   <a class="btn btn-default btn-xs" 
href="https://www.meetup.com/topics/apache-druid/";>Join a Druid Meetup!</a>
 </div>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to