Skip to content

Commit

Permalink
bug #2717 Replaced the spaceless tag by the apply tag (javiereguiluz)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.x branch.

Discussion
----------

Replaced the spaceless tag by the apply tag

This backports #2704 to 1.x branch.

Commits
-------

311456a Replaced the spaceless tag by the apply tag
  • Loading branch information
javiereguiluz committed May 25, 2019
2 parents 608fbb4 + 311456a commit 8d98254
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 117 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -38,7 +38,7 @@
"symfony/twig-bundle": "~2.3|~3.0|^4.0",
"symfony/validator": "~2.3|~3.0|^4.0",
"twig/extensions": "~1.0",
"twig/twig": "~1.26|~2.0"
"twig/twig": "~1.40|~2.9"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "~2.2",
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/views/default/edit.html.twig
Expand Up @@ -11,10 +11,10 @@
{% block body_class 'edit edit-' ~ _entity_config.name|lower %}

{% block content_title %}
{% spaceless %}
{% set _default_title = 'edit.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
{{ _entity_config.edit.title is defined ? _entity_config.edit.title|trans(_trans_parameters) : _default_title }}
{% endspaceless %}
{% apply spaceless %}
{% set _default_title = 'edit.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
{{ _entity_config.edit.title is defined ? _entity_config.edit.title|trans(_trans_parameters) : _default_title }}
{% endapply %}
{% endblock %}

{% block main %}
Expand Down
18 changes: 9 additions & 9 deletions src/Resources/views/default/list.html.twig
Expand Up @@ -29,15 +29,15 @@
{% block body_class 'list list-' ~ _entity_config.name|lower %}

{% block content_title %}
{% spaceless %}
{% if 'search' == app.request.get('action') %}
{% set _default_title = 'search.page_title'|transchoice(paginator.nbResults, {}, 'EasyAdminBundle') %}
{{ (_entity_config.search.title is defined ? _entity_config.search.title|transchoice(paginator.nbResults) : _default_title)|raw }}
{% else %}
{% set _default_title = 'list.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
{{ (_entity_config.list.title is defined ? _entity_config.list.title|trans(_trans_parameters) : _default_title)|raw }}
{% endif %}
{% endspaceless %}
{% apply spaceless %}
{% if 'search' == app.request.get('action') %}
{% set _default_title = 'search.page_title'|transchoice(paginator.nbResults, {}, 'EasyAdminBundle') %}
{{ (_entity_config.search.title is defined ? _entity_config.search.title|transchoice(paginator.nbResults) : _default_title)|raw }}
{% else %}
{% set _default_title = 'list.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
{{ (_entity_config.list.title is defined ? _entity_config.list.title|trans(_trans_parameters) : _default_title)|raw }}
{% endif %}
{% endapply %}
{% endblock %}

{% block content_header %}
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/views/default/new.html.twig
Expand Up @@ -10,10 +10,10 @@
{% block body_class 'new new-' ~ _entity_config.name|lower %}

{% block content_title %}
{% spaceless %}
{% set _default_title = 'new.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
{{ _entity_config.new.title is defined ? _entity_config.new.title|trans(_trans_parameters) : _default_title }}
{% endspaceless %}
{% apply spaceless %}
{% set _default_title = 'new.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
{{ _entity_config.new.title is defined ? _entity_config.new.title|trans(_trans_parameters) : _default_title }}
{% endapply %}
{% endblock %}

{% block main %}
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/views/default/show.html.twig
Expand Up @@ -10,10 +10,10 @@
{% block body_class 'show show-' ~ _entity_config.name|lower %}

{% block content_title %}
{% spaceless %}
{% set _default_title = 'show.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
{{ _entity_config.show.title is defined ? _entity_config.show.title|trans(_trans_parameters) : _default_title }}
{% endspaceless %}
{% apply spaceless %}
{% set _default_title = 'show.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %}
{{ _entity_config.show.title is defined ? _entity_config.show.title|trans(_trans_parameters) : _default_title }}
{% endapply %}
{% endblock %}

{% block main %}
Expand Down
114 changes: 57 additions & 57 deletions src/Resources/views/form/bootstrap_3_horizontal_layout.html.twig
Expand Up @@ -8,45 +8,45 @@
{# Labels #}

{% block form_label -%}
{% spaceless %}
{% if label is same as(false) %}
<div class="{{ block('form_label_class') }}"></div>
{% else %}
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %}
{{- parent() -}}
{% endif %}
{% endspaceless %}
{% apply spaceless %}
{% if label is same as(false) %}
<div class="{{ block('form_label_class') }}"></div>
{% else %}
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %}
{{- parent() -}}
{% endif %}
{% endapply %}
{%- endblock form_label %}

{% block form_label_class 'col-sm-2' %}

{# Rows #}

{% block form_row -%}
{% spaceless %}
{% set _field_type = easyadmin.field.fieldType|default('default') %}
<div class="form-group {% if (not compound or force_error|default(false)) and not valid %}has-error{% endif %} field-{{ block_prefixes|slice(-2)|first }}">
{{ form_label(form) }}
<div class="{{ block('form_group_class') }}">
{{ form_widget(form) }}

{% if _field_type in ['datetime', 'datetime_immutable', 'date', 'date_immutable', 'dateinterval', 'time', 'time_immutable', 'birthday'] and easyadmin.field.nullable|default(false) %}
<div class="nullable-control">
<label>
<input type="checkbox" {% if data is null %}checked="checked"{% endif %}>
{{ 'label.nullable_field'|trans({}, 'EasyAdminBundle')}}
</label>
</div>
{% endif %}

{{ form_errors(form) }}

{% if easyadmin.field.help|default('') != '' %}
<span class="help-block"><i class="fa fa-info-circle"></i> {{ easyadmin.field.help|trans(domain = form.vars.translation_domain)|raw }}</span>
{% endif %}
{% apply spaceless %}
{% set _field_type = easyadmin.field.fieldType|default('default') %}
<div class="form-group {% if (not compound or force_error|default(false)) and not valid %}has-error{% endif %} field-{{ block_prefixes|slice(-2)|first }}">
{{ form_label(form) }}
<div class="{{ block('form_group_class') }}">
{{ form_widget(form) }}

{% if _field_type in ['datetime', 'datetime_immutable', 'date', 'date_immutable', 'dateinterval', 'time', 'time_immutable', 'birthday'] and easyadmin.field.nullable|default(false) %}
<div class="nullable-control">
<label>
<input type="checkbox" {% if data is null %}checked="checked"{% endif %}>
{{ 'label.nullable_field'|trans({}, 'EasyAdminBundle')}}
</label>
</div>
{% endif %}

{{ form_errors(form) }}

{% if easyadmin.field.help|default('') != '' %}
<span class="help-block"><i class="fa fa-info-circle"></i> {{ easyadmin.field.help|trans(domain = form.vars.translation_domain)|raw }}</span>
{% endif %}
</div>
</div>
</div>
{% endspaceless %}
{% endapply %}
{%- endblock form_row %}

{% block checkbox_row -%}
Expand All @@ -58,41 +58,41 @@
{%- endblock radio_row %}

{% block checkbox_radio_row -%}
{% spaceless %}
<div class="form-group {% if not valid %}has-error{% endif %} field-{{ block_prefixes|slice(-2)|first }}">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{ form_widget(form) }}
{{ form_errors(form) }}

{% if easyadmin.field.help|default('') != '' %}
<span class="help-block"><i class="fa fa-info-circle"></i> {{ easyadmin.field.help|trans(domain = easyadmin.entity.translation_domain)|raw }}</span>
{% endif %}
{% apply spaceless %}
<div class="form-group {% if not valid %}has-error{% endif %} field-{{ block_prefixes|slice(-2)|first }}">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{ form_widget(form) }}
{{ form_errors(form) }}

{% if easyadmin.field.help|default('') != '' %}
<span class="help-block"><i class="fa fa-info-circle"></i> {{ easyadmin.field.help|trans(domain = easyadmin.entity.translation_domain)|raw }}</span>
{% endif %}
</div>
</div>
</div>
{% endspaceless %}
{% endapply %}
{%- endblock checkbox_radio_row %}

{% block submit_row -%}
{% spaceless %}
<div class="form-group field-{{ block_prefixes|slice(-2)|first }}">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{ form_widget(form) }}
{% apply spaceless %}
<div class="form-group field-{{ block_prefixes|slice(-2)|first }}">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{ form_widget(form) }}
</div>
</div>
</div>
{% endspaceless %}
{% endapply %}
{% endblock submit_row %}

{% block reset_row -%}
{% spaceless %}
<div class="form-group">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{ form_widget(form) }}
{% apply spaceless %}
<div class="form-group">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{ form_widget(form) }}
</div>
</div>
</div>
{% endspaceless %}
{% endapply %}
{% endblock reset_row %}

{% block form_group_class 'col-sm-10' %}
76 changes: 38 additions & 38 deletions src/Resources/views/form/bootstrap_3_layout.html.twig
Expand Up @@ -402,25 +402,25 @@
{% endblock %}

{% block vich_file_widget %}
{% spaceless %}
<div class="easyadmin-vich-file">
{% if download_uri|default('') is not empty %}
{% set download_title = download_uri|split('/')|last ?: 'download'|trans({}, 'VichUploaderBundle') %}
<a href="{{ asset(download_uri) }}">{{ download_title }}</a>
{% endif %}

<div class="row">
{% if form.delete is defined %}
<div class="col-sm-3 col-md-2">
{{ form_row(form.delete, { label: 'form.label.delete' }) }}
</div>
{% apply spaceless %}
<div class="easyadmin-vich-file">
{% if download_uri|default('') is not empty %}
{% set download_title = download_uri|split('/')|last ?: 'download'|trans({}, 'VichUploaderBundle') %}
<a href="{{ asset(download_uri) }}">{{ download_title }}</a>
{% endif %}
<div class="{{ form.delete is defined ? 'col-sm-9 col-md-10' : 'col-sm-12' }}">
{{ form_widget(form.file) }}

<div class="row">
{% if form.delete is defined %}
<div class="col-sm-3 col-md-2">
{{ form_row(form.delete, { label: 'form.label.delete' }) }}
</div>
{% endif %}
<div class="{{ form.delete is defined ? 'col-sm-9 col-md-10' : 'col-sm-12' }}">
{{ form_widget(form.file) }}
</div>
</div>
</div>
</div>
{% endspaceless %}
{% endapply %}
{% endblock %}

{% block vich_image_row %}
Expand All @@ -429,32 +429,32 @@
{% endblock %}

{% block vich_image_widget %}
{% spaceless %}
<div class="easyadmin-vich-image">
{{ form_widget(form.file) }}
{% if form.delete is defined %}
{{ form_row(form.delete, { label: 'form.label.delete' }) }}
{% endif %}
{% apply spaceless %}
<div class="easyadmin-vich-image">
{{ form_widget(form.file) }}
{% if form.delete is defined %}
{{ form_row(form.delete, { label: 'form.label.delete' }) }}
{% endif %}

{% if image_uri|default('') is not empty %}
{% if download_uri|default('') is empty %}
<div class="easyadmin-thumbnail">
<img style="cursor: initial" src="{{ asset(image_uri) }}">
</div>
{% else %}
{% set _lightbox_id = 'easyadmin-lightbox-' ~ id %}
{% if image_uri|default('') is not empty %}
{% if download_uri|default('') is empty %}
<div class="easyadmin-thumbnail">
<img style="cursor: initial" src="{{ asset(image_uri) }}">
</div>
{% else %}
{% set _lightbox_id = 'easyadmin-lightbox-' ~ id %}

<a href="#" class="easyadmin-thumbnail" data-featherlight="#{{ _lightbox_id }}" data-featherlight-close-on-click="anywhere">
<img src="{{ asset(download_uri) }}">
</a>
<a href="#" class="easyadmin-thumbnail" data-featherlight="#{{ _lightbox_id }}" data-featherlight-close-on-click="anywhere">
<img src="{{ asset(download_uri) }}">
</a>

<div id="{{ _lightbox_id }}" class="easyadmin-lightbox">
<img src="{{ asset(download_uri) }}">
</div>
<div id="{{ _lightbox_id }}" class="easyadmin-lightbox">
<img src="{{ asset(download_uri) }}">
</div>
{% endif %}
{% endif %}
{% endif %}
</div>
{% endspaceless %}
</div>
{% endapply %}
{% endblock %}

{% block easyadmin_rest %}
Expand Down

0 comments on commit 8d98254

Please sign in to comment.