0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Don't wrap TableBlock rendering in a div - fixes #2629

This commit is contained in:
Matt Westcott 2016-05-18 12:28:56 +01:00
parent f8d7970cbb
commit 8ed30060fd
2 changed files with 40 additions and 42 deletions

View File

@ -1,9 +1,26 @@
<div class="table">
<table>
{% if table_header %}
<thead>
<tr>
{% for column in table_header %}
<table>
{% if table_header %}
<thead>
<tr>
{% for column in table_header %}
<th>
{% if column.strip %}
{% if html_renderer %}
{{ column.strip|safe|linebreaksbr }}
{% else %}
{{ column.strip|linebreaksbr }}
{% endif %}
{% endif %}
</th>
{% endfor %}
</tr>
</thead>
{% endif %}
<tbody>
{% for row in data %}
<tr>
{% for column in row %}
{% if first_col_is_header and forloop.first %}
<th>
{% if column.strip %}
{% if html_renderer %}
@ -13,38 +30,19 @@
{% endif %}
{% endif %}
</th>
{% endfor %}
</tr>
</thead>
{% endif %}
<tbody>
{% for row in data %}
<tr>
{% for column in row %}
{% if first_col_is_header and forloop.first %}
<th>
{% if column.strip %}
{% if html_renderer %}
{{ column.strip|safe|linebreaksbr }}
{% else %}
{{ column.strip|linebreaksbr }}
{% endif %}
{% endif %}
</th>
{% else %}
<td>
{% if column.strip %}
{% if html_renderer %}
{{ column.strip|safe|linebreaksbr }}
{% else %}
{{ column.strip|linebreaksbr }}
{% endif %}
{% else %}
<td>
{% if column.strip %}
{% if html_renderer %}
{{ column.strip|safe|linebreaksbr }}
{% else %}
{{ column.strip|linebreaksbr }}
{% endif %}
</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -21,7 +21,7 @@ def get_test_html_from_value(value):
that's what we expect from the TableBlock.
"""
data = list(value['data']) # Make a copy
table = '<div class="table"><table>'
table = '<table>'
if value['first_row_is_table_header']:
row_header = data.pop(0)
table += '<thead><tr>'
@ -39,7 +39,7 @@ def get_test_html_from_value(value):
table += '<td>%s</td>' % tiny_escape(col)
first = False
table += '</tr>'
table += '</tbody></table></div>'
table += '</tbody></table>'
return table