From 8ed30060fdd3e91bee608658e3741037b5fbff8e Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Wed, 18 May 2016 12:28:56 +0100 Subject: [PATCH] Don't wrap TableBlock rendering in a div - fixes #2629 --- .../templates/table_block/blocks/table.html | 78 +++++++++---------- wagtail/contrib/table_block/tests.py | 4 +- 2 files changed, 40 insertions(+), 42 deletions(-) diff --git a/wagtail/contrib/table_block/templates/table_block/blocks/table.html b/wagtail/contrib/table_block/templates/table_block/blocks/table.html index e377a8ca6b..e7d6f7cb01 100644 --- a/wagtail/contrib/table_block/templates/table_block/blocks/table.html +++ b/wagtail/contrib/table_block/templates/table_block/blocks/table.html @@ -1,9 +1,26 @@ -
- - {% if table_header %} - - - {% for column in table_header %} +
+ {% if table_header %} + + + {% for column in table_header %} + + {% endfor %} + + + {% endif %} + + {% for row in data %} + + {% for column in row %} + {% if first_col_is_header and forloop.first %} - {% endfor %} - - - {% endif %} - - {% for row in data %} - - {% for column in row %} - {% if first_col_is_header and forloop.first %} - - {% else %} - - {% endif %} - {% endfor %} - - {% endfor %} - -
+ {% if column.strip %} + {% if html_renderer %} + {{ column.strip|safe|linebreaksbr }} + {% else %} + {{ column.strip|linebreaksbr }} + {% endif %} + {% endif %} +
{% if column.strip %} {% if html_renderer %} @@ -13,38 +30,19 @@ {% endif %} {% endif %}
- {% if column.strip %} - {% if html_renderer %} - {{ column.strip|safe|linebreaksbr }} - {% else %} - {{ column.strip|linebreaksbr }} - {% endif %} - {% endif %} - - {% if column.strip %} - {% if html_renderer %} - {{ column.strip|safe|linebreaksbr }} - {% else %} - {{ column.strip|linebreaksbr }} - {% endif %} + {% else %} + + {% if column.strip %} + {% if html_renderer %} + {{ column.strip|safe|linebreaksbr }} + {% else %} + {{ column.strip|linebreaksbr }} {% endif %} -
-
+ {% endif %} + + {% endif %} + {% endfor %} + + {% endfor %} + + diff --git a/wagtail/contrib/table_block/tests.py b/wagtail/contrib/table_block/tests.py index ccdf72e80b..21b424338f 100644 --- a/wagtail/contrib/table_block/tests.py +++ b/wagtail/contrib/table_block/tests.py @@ -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 = '
' + table = '
' if value['first_row_is_table_header']: row_header = data.pop(0) table += '' @@ -39,7 +39,7 @@ def get_test_html_from_value(value): table += '' % tiny_escape(col) first = False table += '' - table += '
%s
' + table += '' return table