Skip to content

Commit a4fb066

Browse files
tobias-93bobvandevijver
authored andcommitted
Remove deprecated spaceless filter applications
1 parent 3d493b4 commit a4fb066

File tree

7 files changed

+84
-100
lines changed

7 files changed

+84
-100
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{% block column_boolean %}
2-
{% apply spaceless %}
3-
{{ echo_if(builder.ModelClass ~ '.' ~ column.getter) }}
4-
<i class="fa fa-check"></i>
5-
{{ echo_else() }}
6-
<i class="fa fa-times"></i>
7-
{{ echo_endif() }}
8-
{% endapply %}
2+
{{- echo_if(builder.ModelClass ~ '.' ~ column.getter) -}}
3+
<i class="fa fa-check"></i>
4+
{{- echo_else() -}}
5+
<i class="fa fa-times"></i>
6+
{{- echo_endif() -}}
97
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{% block column_collection %}
2-
{% apply spaceless %}
3-
<ul>
4-
{{ echo_for('object', builder.ModelClass ~ '.' ~ column.getter ) }}
5-
<li>{{ echo_twig('object') }}</li>
6-
{{ echo_endfor() }}
7-
</ul>
8-
{% endapply %}
2+
<ul>
3+
{{- echo_for('object', builder.ModelClass ~ '.' ~ column.getter ) -}}
4+
<li>{{ echo_twig('object') }}</li>
5+
{{- echo_endfor() -}}
6+
</ul>
97
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
{% block column_date %}
2-
{% apply spaceless %}
3-
{%- if builder.generator.bundleConfig.twig.use_localized_date == true -%}
4-
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
5-
{%- if column.localized_date_format is defined -%}
6-
{{ echo_set('localized_date_format', column.formOptions.localized_date_format) }}
7-
{%- else -%}
8-
{{ echo_set('localized_date_format', builder.generator.bundleConfig.twig.localized_date_format) }}
9-
{%- endif -%}
10-
{%- if column.formOptions.format is defined -%}
11-
{{ echo_set('date_format', column.formOptions.format) }}
12-
{%- else -%}
13-
{{ echo_set('date_format', builder.generator.bundleConfig.twig.date_format) }}
14-
{%- endif -%}
2+
{%- if builder.generator.bundleConfig.twig.use_localized_date == true -%}
3+
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
4+
{%- if column.localized_date_format is defined -%}
5+
{{ echo_set('localized_date_format', column.formOptions.localized_date_format) }}
6+
{%- else -%}
7+
{{ echo_set('localized_date_format', builder.generator.bundleConfig.twig.localized_date_format) }}
8+
{%- endif -%}
9+
{%- if column.formOptions.format is defined -%}
10+
{{ echo_set('date_format', column.formOptions.format) }}
11+
{%- else -%}
12+
{{ echo_set('date_format', builder.generator.bundleConfig.twig.date_format) }}
13+
{%- endif -%}
1514

16-
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|format_date(localized_date_format, pattern=date_format)') }}
17-
{{ echo_endif() }}
18-
{%- else -%}
19-
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
20-
{%- if column.formOptions.format is defined -%}
21-
{{ echo_set('date_format', column.formOptions.format) }}
22-
{%- else -%}
23-
{{ echo_set('date_format', builder.generator.bundleConfig.twig.date_format) }}
24-
{%- endif -%}
15+
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|format_date(localized_date_format, pattern=date_format)') }}
16+
{{ echo_endif() }}
17+
{%- else -%}
18+
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
19+
{%- if column.formOptions.format is defined -%}
20+
{{ echo_set('date_format', column.formOptions.format) }}
21+
{%- else -%}
22+
{{ echo_set('date_format', builder.generator.bundleConfig.twig.date_format) }}
23+
{%- endif -%}
2524

26-
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(date_format)') }}
27-
{{ echo_endif() }}
28-
{%- endif -%}
29-
{% endapply %}
25+
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(date_format)') }}
26+
{{- echo_endif() }}
27+
{%- endif -%}
3028
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
{% block column_datetime %}
2-
{% apply spaceless %}
3-
{% if builder.generator.bundleConfig.twig.use_localized_date == true -%}
4-
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
5-
{%- if column.localized_date_format is defined -%}
6-
{{ echo_set('localized_date_format', column.formOptions.localized_date_format) }}
7-
{%- else -%}
8-
{{ echo_set('localized_date_format', builder.generator.bundleConfig.twig.localized_date_format) }}
9-
{%- endif -%}
10-
{%- if column.localized_time_format is defined -%}
11-
{{ echo_set('localized_time_format', column.formOptions.localized_datetime_format) }}
12-
{%- else -%}
13-
{{ echo_set('localized_time_format', builder.generator.bundleConfig.twig.localized_datetime_format) }}
14-
{%- endif -%}
15-
{%- if column.formOptions.format is defined -%}
16-
{{ echo_set('datetime_format', column.formOptions.format) }}
17-
{%- else -%}
18-
{{ echo_set('datetime_format', builder.generator.bundleConfig.twig.datetime_format) }}
19-
{%- endif -%}
2+
{% if builder.generator.bundleConfig.twig.use_localized_date == true -%}
3+
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
4+
{%- if column.localized_date_format is defined -%}
5+
{{ echo_set('localized_date_format', column.formOptions.localized_date_format) }}
6+
{%- else -%}
7+
{{ echo_set('localized_date_format', builder.generator.bundleConfig.twig.localized_date_format) }}
8+
{%- endif -%}
9+
{%- if column.localized_time_format is defined -%}
10+
{{ echo_set('localized_time_format', column.formOptions.localized_datetime_format) }}
11+
{%- else -%}
12+
{{ echo_set('localized_time_format', builder.generator.bundleConfig.twig.localized_datetime_format) }}
13+
{%- endif -%}
14+
{%- if column.formOptions.format is defined -%}
15+
{{ echo_set('datetime_format', column.formOptions.format) }}
16+
{%- else -%}
17+
{{ echo_set('datetime_format', builder.generator.bundleConfig.twig.datetime_format) }}
18+
{%- endif -%}
2019

21-
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|format_datetime(localized_date_format, localized_time_format, pattern=datetime_format)') }}
22-
{{ echo_endif() }}
23-
{%- else -%}
24-
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
25-
{% if column.formOptions.format is defined %}
26-
{{ echo_set('datetime_format', column.formOptions.format) }}
27-
{% else %}
28-
{{ echo_set('datetime_format', builder.generator.bundleConfig.twig.datetime_format) }}
29-
{% endif %}
20+
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|format_datetime(localized_date_format, localized_time_format, pattern=datetime_format)') }}
21+
{{ echo_endif() }}
22+
{%- else -%}
23+
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
24+
{% if column.formOptions.format is defined %}
25+
{{ echo_set('datetime_format', column.formOptions.format) }}
26+
{% else %}
27+
{{ echo_set('datetime_format', builder.generator.bundleConfig.twig.datetime_format) }}
28+
{% endif %}
3029

31-
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(datetime_format)') }}
32-
{{ echo_endif() }}
33-
{%- endif %}
34-
{% endapply %}
30+
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(datetime_format)') }}
31+
{{ echo_endif() }}
32+
{%- endif %}
3533
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{% block column_decimal %}
2-
{% apply spaceless %}
3-
{{- echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ "|number_format(" ~
4-
column.formOptions.precision|default(admingenerator_config('twig.number_format.decimal')) ~ ", '" ~
5-
admingenerator_config('twig.number_format.decimal_point') ~ "', '" ~
6-
admingenerator_config('twig.number_format.thousand_separator')~ "')") -}}
7-
{% endapply %}
2+
{{- echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ "|number_format(" ~
3+
column.formOptions.precision|default(admingenerator_config('twig.number_format.decimal')) ~ ", '" ~
4+
admingenerator_config('twig.number_format.decimal_point') ~ "', '" ~
5+
admingenerator_config('twig.number_format.thousand_separator')~ "')") -}}
86
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{% block column_money %}
2-
{% apply spaceless %}
3-
{% set currency = column.formOptions.currency|default('EUR') %}
4-
{% set precision = column.formOptions.precision|default(2) %}
5-
{% set grouping = column.formOptions.grouping|default(true) %}
6-
{% set divisor = column.formOptions.divisor|default(1) %}
2+
{% set currency = column.formOptions.currency|default('EUR') %}
3+
{% set precision = column.formOptions.precision|default(2) %}
4+
{% set grouping = column.formOptions.grouping|default(true) %}
5+
{% set divisor = column.formOptions.divisor|default(1) %}
76

8-
{{ echo_twig('localized_money('~ builder.ModelClass~'.'~column.getter ~', "'~ currency ~'", "'~ precision ~'", '~ grouping ~', '~ divisor ~')') }}
9-
{% endapply %}
7+
{{- echo_twig('localized_money('~ builder.ModelClass~'.'~column.getter ~', "'~ currency ~'", "'~ precision ~'", '~ grouping ~', '~ divisor ~')') -}}
108
{% endblock %}

Resources/views/templates/CommonAdmin/object_actions.php.twig

+12-16
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,18 @@
3333
{% set actionParams = action.params ? echo_twig_assoc(action.params) : "{ 'pk': " ~ builder.ModelClass ~ "." ~ builder.getFieldGuesser().getModelPrimaryKeyName(model) ~ ", action: '" ~ action.name ~ "' }" %}
3434
{% set translationDomain = action.type is same as('custom') ? i18n_catalog|default("Admin") : 'Admingenerator' %}
3535

36-
{% apply spaceless %}
37-
{{ echo_spaceless() }}
38-
<a class="object-action btn btn-default {% if builder.yamlKey is same as('list') or builder.yamlKey is same as('nested_list') %}btn-xs {% endif %}{{ action.class|default('') }}"
39-
href="{{ echo_path(actionRoute, actionParams) }}"
40-
title="{{ echo_trans(action.label, {}, translationDomain, 'html_attr') }}"
41-
{%- if action.confirm and not action.forceIntermediate %}
42-
data-confirm="{{ echo_trans(action.confirm, {}, translationDomain, 'html_attr') }}"
43-
data-confirm-modal="{{ action.confirmModal|default('#confirmObjectModal') }}"
44-
data-toggle="modal"
45-
{% endif -%}
46-
{%- if action.csrfProtected and not action.forceIntermediate %} data-csrf-token="{{ echo_path(actionRoute, actionParams, ['csrf_token']) }}" {% endif -%}>
47-
<i class="fa fa-fw {{ action.icon|default('fa-square fa-regular') }}"></i>
48-
<span>{{ echo_trans(action.label, {}, translationDomain, 'html') }}</span>
49-
</a>
50-
{{ echo_endspaceless() }}
51-
{% endapply %}
36+
<a class="object-action btn btn-default {% if builder.yamlKey is same as('list') or builder.yamlKey is same as('nested_list') %}btn-xs {% endif %}{{ action.class|default('') }}"
37+
href="{{ echo_path(actionRoute, actionParams) }}"
38+
title="{{ echo_trans(action.label, {}, translationDomain, 'html_attr') }}"
39+
{%- if action.confirm and not action.forceIntermediate %}
40+
data-confirm="{{ echo_trans(action.confirm, {}, translationDomain, 'html_attr') }}"
41+
data-confirm-modal="{{ action.confirmModal|default('#confirmObjectModal') }}"
42+
data-toggle="modal"
43+
{% endif -%}
44+
{%- if action.csrfProtected and not action.forceIntermediate %} data-csrf-token="{{ echo_path(actionRoute, actionParams, ['csrf_token']) }}" {% endif -%}>
45+
<i class="fa fa-fw {{ action.icon|default('fa-square fa-regular') }}"></i>
46+
<span>{{ echo_trans(action.label, {}, translationDomain, 'html') }}</span>
47+
</a>
5248
{% endblock %}
5349

5450
{% block object_actions_script %}

0 commit comments

Comments
 (0)