Created
July 12, 2022 16:13
-
-
Save JacobLett/7371ad1b61be8dfe428caac5f0a12990 to your computer and use it in GitHub Desktop.
macro for state HubDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro state_contacts(stateCode) %} | |
{{ stateCode }} | |
{% endmacro %} | |
{{ state_contacts("US-AL","US-AK","US-AS","US-AZ","US-AR","US-CA","US-CO","US-CT","US-DE","US-DC","US-FL","US-GA","US-HI","US-ID","US-IL","US-IN","US-IA","US-KS","US-KY","US-LA","US-ME","US-MD","US-MA","US-MI","US-MN","US-MS","US-MO","US-MT","US-NE","US-NV","US-NH","US-NJ","US-NM","US-NY","US-NC","US-ND","US-MP","US-OH","US-OK","US-OR","US-PA","US-RI","US-SC","US-SD","US-TN","US-TX","US-UT","US-VT","US-VA","US-WA","US-WV","US-WI","US-WY","CA-AB","CA-BC","CA-MB","CA-NB","CA-NL","CA-NS","CA-ON","CA-PE","CA-QC","CA-SK") }} | |
{# Use macro for logic below #} | |
{% set contacts_us_ar = [] %} | |
{% for row in table %} | |
{% set temp_states_array = [] %} | |
{% for state in row.states %} | |
{% do temp_states_array.append(state.name) %} | |
{% endfor %} | |
{% if temp_states_array is containing "US-AR" %} | |
{% do contacts_us_ar.append(row) %} | |
{% endif %} | |
{% endfor %} | |
<div id="contactsUS-AR" style="display:none;"> | |
{% for contact in contacts_us_ar %} | |
<strong>{{contact.full_name}}</strong><br> | |
{{contact.phone}}<br> | |
{{contact.email}} | |
{% for company in contact.company %} | |
<h3> | |
{{company.name}} | |
</h3> | |
{% endfor %} | |
{% endfor %} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment