| {# Block partial: table (standard, comparison, spanning variants) #} |
| {% set variant = block.data.variant | default('standard') %} |
|
|
| {% if variant == 'comparison' %} |
| {# ββ Comparison table (table_v2) ββ #} |
| <table class="{{ block.css_class }}"> |
| <thead> |
| {% if block.data.header_groups %} |
| <tr> |
| {% for c in block.data.base_columns %} |
| <th rowspan="2">{{ c.label | e }}</th> |
| {% endfor %} |
| {% for g in block.data.header_groups %} |
| <th colspan="{{ g.columns | length }}">{{ g.label | e }}</th> |
| {% endfor %} |
| </tr> |
| <tr> |
| {% for g in block.data.header_groups %} |
| {% for c in g.columns %} |
| <th>{{ c.label | e }}</th> |
| {% endfor %} |
| {% endfor %} |
| </tr> |
| {% else %} |
| <tr> |
| {% for c in block.data.all_columns %} |
| {% set col_label = c.label | default('') %} |
| {% set col_lc = col_label | lower %} |
| <th class="{% if col_lc == 'regular' %}is-regular-col{% elif col_lc == 'prime' %}is-prime-col{% endif %}">{{ |
| c.label | e }}</th> |
| {% endfor %} |
| </tr> |
| {% endif %} |
| </thead> |
| <tbody> |
| {% for row in block.data.rows %} |
| <tr> |
| {% for c in block.data.all_columns %} |
| {% set col_label = c.label | default('') %} |
| {% set col_lc = col_label | lower %} |
| <td class="{% if col_lc == 'regular' %}is-regular-col{% elif col_lc == 'prime' %}is-prime-col{% endif %}">{{ |
| row[c.key] | default('') | safe }}</td> |
| {% endfor %} |
| </tr> |
| {% endfor %} |
| </tbody> |
| </table> |
|
|
| {% elif variant == 'spanning' %} |
| {# ββ Spanning table (table_v3 / table_v4) ββ #} |
| <table class="{{ block.css_class }}"> |
| <tbody> |
| {% for row in block.data.rows %} |
| <tr> |
| {% for cell in row %} |
| <td{% if cell.colspan> 1 %} colspan="{{ cell.colspan }}"{% endif %}{% if cell.rowspan > 1 %} rowspan="{{ |
| cell.rowspan }}"{% endif %}>{{ cell.text | safe }}</td> |
| {% endfor %} |
| </tr> |
| {% endfor %} |
| </tbody> |
| </table> |
|
|
| {% else %} |
| {# ββ Standard table ββ #} |
| <table class="{{ block.css_class }}"> |
| {% if block.data.columns %} |
| <thead> |
| <tr> |
| {% for col in block.data.columns %} |
| {% set col_lc = (col | lower) %} |
| <th class="{% if col_lc == 'regular' %}is-regular-col{% elif col_lc == 'prime' %}is-prime-col{% endif %}">{{ |
| col | e }}</th> |
| {% endfor %} |
| </tr> |
| </thead> |
| {% endif %} |
| <tbody> |
| {% for row in block.data.rows %} |
| <tr> |
| {% for cell in row %} |
| {% set col = block.data.columns[loop.index0] if block.data.columns and loop.index0 < (block.data.columns | |
| length) else '' %} {% set col_lc=(col | lower) %} <td |
| class="{% if col_lc == 'regular' %}is-regular-col{% elif col_lc == 'prime' %}is-prime-col{% endif %}">{{ |
| cell | safe }}</td> |
| {% endfor %} |
| </tr> |
| {% endfor %} |
| </tbody> |
| </table> |
| {% endif %} |