@@ -61,7 +61,9 @@ <h3>Previous Events</h3>
6161 < th class ="has-text-centered "> Description</ th >
6262 </ thead >
6363 < tbody >
64+ {% assign i = 0 %}
6465 {% for event in event_list reversed %}
66+ {% assign i = i | plus:1 %}
6567 {% capture currentDate %}
6668 {{ site.time | date: '%F' }}
6769 {% endcapture %}
@@ -70,13 +72,47 @@ <h3>Previous Events</h3>
7072 {% endcapture %}
7173 {% if eventdate < currentDate %}
7274 < tr >
73- < td class ="has-text-centered "> < a href ="{{ event.event-url }} " target =" _blank "> {{ event.title }}</ a > </ td >
75+ < td class ="has-text-centered "> < a href ="# " id =" {{ i }} " onclick =" openModal('modal{{ i }}') "> {{ event.title }}</ a > </ td >
7476 < td class ="has-text-centered "> {{ event.type }}</ td >
7577 < td class ="has-text-centered "> {{ event.event-date | date:"%b %d, %Y" }}</ td >
7678 < td class ="has-text-centered "> {{ event.location }}</ td >
7779 < td class ="has-text-centered "> {{ event.description }}</ td >
78- </ tr >
80+ </ tr >
81+ < div class ="modal " id ="modal{{ i }} ">
82+ < div class ="modal-background "> </ div >
83+ < div class ="modal-card ">
84+ < header class ="modal-card-head ">
85+ < p class ="modal-card-title "> {{ event.title }}</ p >
86+ < button class ="delete " aria-label ="close " onclick ="closeModal('modal{{ i }}') "> </ button >
87+ </ header >
88+ < div class ="modal-card-body ">
89+ Event details will be updated soon
90+ </ div >
91+ < footer class ="modal-card-foot ">
92+ < button class ="button " onclick ="closeModal('modal{{ i }}') "> Close</ button >
93+ </ footer >
94+ </ div >
95+ </ div >
7996 {% endif %}
8097 {% endfor %}
8198 </ tbody >
8299</ table >
100+
101+ < script type ="text/javascript ">
102+ document . addEventListener ( 'keydown' , function ( event ) {
103+ if ( event . key == "Escape" ) {
104+ var activeModals = document . getElementsByClassName ( "modal is-active" ) ;
105+ if ( activeModals . length > 0 ) {
106+ closeModal ( document . getElementsByClassName ( "modal is-active" ) [ 0 ] . id ) ;
107+ }
108+ }
109+ } ) ;
110+ function openModal ( modalId ) {
111+ document . getElementById ( modalId ) . classList . add ( 'is-active' ) ;
112+ return false ;
113+ }
114+ function closeModal ( modalId ) {
115+ document . getElementById ( modalId ) . classList . remove ( 'is-active' ) ;
116+ return false ;
117+ }
118+ </ script >
0 commit comments