adding div around title

Those div are required to solve ref Chill-project/Chill-Person#12
This commit is contained in:
Julien Fastré 2016-11-13 21:02:10 +01:00
parent 9100bb14b3
commit f8dd08d194

View File

@ -7,9 +7,30 @@
{%- set type_title = constant('Chill\\CustomFieldsBundle\\CustomFields\\CustomFieldTitle::TYPE_TITLE') -%} {%- set type_title = constant('Chill\\CustomFieldsBundle\\CustomFields\\CustomFieldTitle::TYPE_TITLE') -%}
{# a variable to store that "something has been printed #} {# a variable to store that "something has been printed #}
{%- set something_has_been_printed = false -%} {%- set something_has_been_printed = false -%}
{%- set title_div_opened = false -%}
{%- set subtitle_div_opened = false -%}
{% for customField in cFGroup.activeCustomFields %} {% for customField in cFGroup.activeCustomFields %}
{% if customField.type == 'title' %} {% if customField.type == 'title' %}
{%- if show_empty == true %} {%- if show_empty == true %}
{%- if customField.options[type] == type_title -%}
{%- if title_div_opened == false -%}
<div class="cf_title_box">
{%- set title_div_opened = true -%}
{%- else -%}
{%- if subtitle_div_opened == true -%}
</div> <!-- closing cf_subtitle_box -->
{%- set title_div_opened = false -%}
{%- endif -%}
</div><div class="cf_title_box">
{%- endif -%}
{%- else -%}
{%- if subtitle_div_opened == false -%}
<div class="cf_subtitle_box">
{%- set subtitle_div_opened = true -%}
{%- else -%}
</div><div class="cf_subtitle_box">
{%- endif -%}
{%- endif -%}
{{ chill_custom_field_widget(cFData , customField) }} {{ chill_custom_field_widget(cFData , customField) }}
{%- else -%} {%- else -%}
{# we keep the customfield in memory, and print it only if 'something' has been filled after the title #} {# we keep the customfield in memory, and print it only if 'something' has been filled after the title #}
@ -24,10 +45,26 @@
{% else %} {% else %}
{%- if show_empty == true or (chill_custom_field_is_empty(cFData, customField) == false) -%} {%- if show_empty == true or (chill_custom_field_is_empty(cFData, customField) == false) -%}
{%- if title is not empty -%} {%- if title is not empty -%}
{%- if title_div_opened == false -%}
<div class="cf_title_box">
{%- set title_div_opened = true -%}
{%- else -%}
{%- if subtitle_div_opened == true -%}
</div> <!-- closing cf_subtitle_box -->
{%- set title_div_opened = false -%}
{%- endif -%}
</div><div class="cf_title_box">
{%- endif -%}
{{ chill_custom_field_widget(cFData, title) }} {{ chill_custom_field_widget(cFData, title) }}
{%- set title = null -%} {%- set title = null -%}
{%- endif -%} {%- endif -%}
{%- if subtitle is not empty -%} {%- if subtitle is not empty -%}
{%- if subtitle_div_opened == false -%}
<div class="cf_subtitle_box">
{%- set subtitle_div_opened = true -%}
{%- else -%}
</div><div class="cf_subtitle_box">
{%- endif -%}
{{ chill_custom_field_widget(cFData, subtitle) }} {{ chill_custom_field_widget(cFData, subtitle) }}
{%- set subtitle = null -%} {%- set subtitle = null -%}
{%- endif -%} {%- endif -%}
@ -37,6 +74,12 @@
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}
{% endfor %} {% endfor %}
{%- if subtitle_div_opened == true -%}
</div> <!-- closing cf_subtitle_box -->
{%- endif -%}
{%- if title_div_opened == true -%}
</div> <!-- closing cf_title_box -->
{%- endif -%}
{% if something_has_been_printed == false %} {% if something_has_been_printed == false %}
<dt class="custom_field_no_data custom_fields_group_rendering">{{ 'Empty data'|trans }}</dt> <dt class="custom_field_no_data custom_fields_group_rendering">{{ 'Empty data'|trans }}</dt>
<dd class="custom_field_no_data custom_fields_group_rendering">{{ 'No data to show' | trans }}</dd> <dd class="custom_field_no_data custom_fields_group_rendering">{{ 'No data to show' | trans }}</dd>