@@ -52,7 +52,7 @@ <h3 class="mission__statement">Provide mentorship and challenge for people of al
5252 < div class ="row container-fluid ">
5353 < hr class ="upcoming-divider ">
5454 < div class ="upcoming__img-container col-md-12 ">
55- < div class ="row ">
55+ < div class ="upcoming__content row ">
5656 < div class ="upcoming__col col-md-5 col-12 mr-auto ">
5757 < h2 class ="upcoming__title "> Upcoming Event</ h2 >
5858 < div class ="row ">
@@ -102,83 +102,55 @@ <h2 class="post__label">Project</h2>
102102 {% endif %}
103103 </ div >
104104 < div class ="upcoming__logo-col col-md-5 text-center ">
105- < div class ="upcoming__sponsor-list ">
105+ < div class ="upcoming__sponsor-list h-100 ">
106106 < h2 class ="upcoming__sponsor-title "> Supported By</ h2 >
107-
108-
109- {% comment %}
110- Assume number of sponsors is even. We are going to create rows of 2 sponsors in each.
111- If not even the last row must contain 1 sponsor and be terminated with appropriate tags.
112- {% endcomment %}
113-
114- {% assign sponsors = "" | split: ',' %}
115- {% for sponsor in site.sponsors %}
116- <!--HEre select item that maches the sponsor_id - the object
117- instead of just the string sponsor name.-->
118- {% assign sponsors = sponsors | push: sponsor %}
119- {% endfor %}
120- {% assign num_of_sponsors = sponsors | size %}
121- {% assign sponsors_remainder = num_of_sponsors | modulo: 2 %}
122-
123- {% if sponsors_remainder == 0 %}
124- {% assign num_of_sponsors_even = true %}
125- {% assign row_num_modifier = 1 %}
126- {% else %}
127- {% assign num_of_sponsors_even = false %}
128- {% assign row_num_modifier = 0 %}
129- {% endif %}
130-
131- {% assign num_of_rows = num_of_sponsors | divided_by: 2 | floor | minus: row_num_modifier %}
132- {% assign items_per_row = 1 %}
133-
134- {% for row in (0..num_of_rows) %}
135- {% if forloop.last and num_of_sponsors_even == false %}
136- {% assign items_per_row = 0 %}
137- {% endif %}
138- < div class ="row ">
139- {% for col in (0..items_per_row) %}
140- {% assign sponsor_index = row | times: 2 | plus: col %}
141- {% assign sponsor = sponsors[sponsor_index] %}
142- < div class ="footer__sponsor-col col-md-12 col-lg-6 ">
143- < a class ="footer__sponsor-link " href ="{{ sponsor.sponsor_link }} ">
144- < img class ="footer__img " src ="{{ site.baseurl }}/{{ sponsor.sponsor_logo }} ">
145- </ a >
146- </ div >
147- {% endfor %}
148- </ div >
149- {% endfor %}
150-
151-
152-
153-
154-
155-
156-
157-
158-
159-
160-
161-
162-
163-
164-
165-
166-
167-
168-
169-
170-
171-
172-
173-
174-
175-
176-
177-
178-
179-
180-
181-
107+ <!--HERE feed event sponsors only - we need sponsor objects not just the name.-->
108+ <!--Build an array of site sponsors (all).-->
109+ {% assign site_sponsors_all = "" | split: ',' %}
110+ {% for sponsor in site.sponsors %}
111+ {% assign site_sponsors_all = site_sponsors_all | push: sponsor %}
112+ {% endfor %}
113+
114+ <!--Build an array of sponsors for the event.-->
115+ {% assign event_sponsors = "" | split: ',' %}
116+ {% for sponsor in post.sponsors %}
117+ {% for site_sponsor in site_sponsors_all %}
118+ {% if site_sponsor.sponsor_id == sponsor %}
119+ {% assign event_sponsors = event_sponsors | push: site_sponsor %}
120+ {% endif %}
121+ {% endfor %}
122+ {% endfor %}
123+
124+ {% assign num_of_sponsors = event_sponsors | size %}
125+ {% assign sponsors_remainder = num_of_sponsors | modulo: 2 %}
126+
127+ {% if sponsors_remainder == 0 %}
128+ {% assign num_of_sponsors_even = true %}
129+ {% assign row_num_modifier = 1 %}
130+ {% else %}
131+ {% assign num_of_sponsors_even = false %}
132+ {% assign row_num_modifier = 0 %}
133+ {% endif %}
134+
135+ {% assign num_of_rows = num_of_sponsors | divided_by: 2 | floor | minus: row_num_modifier %}
136+ {% assign items_per_row = 1 %}
137+
138+ {% for row in (0..num_of_rows) %}
139+ {% if forloop.last and num_of_sponsors_even == false %}
140+ {% assign items_per_row = 0 %}
141+ {% endif %}
142+ < div class ="row ">
143+ {% for col in (0..items_per_row) %}
144+ {% assign sponsor_index = row | times: 2 | plus: col %}
145+ {% assign sponsor = event_sponsors[sponsor_index] %}
146+ < div class ="footer__sponsor-col col-md-12 col-lg-6 ">
147+ < a class ="footer__sponsor-link " href ="{{ sponsor.sponsor_link }} ">
148+ < img class ="footer__img " src ="{{ site.baseurl }}/{{ sponsor.sponsor_logo }} ">
149+ </ a >
150+ </ div >
151+ {% endfor %}
152+ </ div >
153+ {% endfor %}
182154 </ div >
183155 </ div >
184156 </ div >
0 commit comments