Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{% block column_boolean %}
{% apply spaceless %}
{{ echo_if(builder.ModelClass ~ '.' ~ column.getter) }}
<i class="fa fa-check"></i>
{{ echo_else() }}
<i class="fa fa-times"></i>
{{ echo_endif() }}
{% endapply %}
{{- echo_if(builder.ModelClass ~ '.' ~ column.getter) -}}
<i class="fa fa-check"></i>
{{- echo_else() -}}
<i class="fa fa-times"></i>
{{- echo_endif() -}}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{% block column_collection %}
{% apply spaceless %}
<ul>
{{ echo_for('object', builder.ModelClass ~ '.' ~ column.getter ) }}
<li>{{ echo_twig('object') }}</li>
{{ echo_endfor() }}
</ul>
{% endapply %}
<ul>
{{- echo_for('object', builder.ModelClass ~ '.' ~ column.getter ) -}}
<li>{{ echo_twig('object') }}</li>
{{- echo_endfor() -}}
</ul>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
{% block column_date %}
{% apply spaceless %}
{%- if builder.generator.bundleConfig.twig.use_localized_date == true -%}
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
{%- if column.localized_date_format is defined -%}
{{ echo_set('localized_date_format', column.formOptions.localized_date_format) }}
{%- else -%}
{{ echo_set('localized_date_format', builder.generator.bundleConfig.twig.localized_date_format) }}
{%- endif -%}
{%- if column.formOptions.format is defined -%}
{{ echo_set('date_format', column.formOptions.format) }}
{%- else -%}
{{ echo_set('date_format', builder.generator.bundleConfig.twig.date_format) }}
{%- endif -%}
{%- if builder.generator.bundleConfig.twig.use_localized_date == true -%}
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
{%- if column.localized_date_format is defined -%}
{{ echo_set('localized_date_format', column.formOptions.localized_date_format) }}
{%- else -%}
{{ echo_set('localized_date_format', builder.generator.bundleConfig.twig.localized_date_format) }}
{%- endif -%}
{%- if column.formOptions.format is defined -%}
{{ echo_set('date_format', column.formOptions.format) }}
{%- else -%}
{{ echo_set('date_format', builder.generator.bundleConfig.twig.date_format) }}
{%- endif -%}

{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|format_date(localized_date_format, pattern=date_format)') }}
{{ echo_endif() }}
{%- else -%}
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
{%- if column.formOptions.format is defined -%}
{{ echo_set('date_format', column.formOptions.format) }}
{%- else -%}
{{ echo_set('date_format', builder.generator.bundleConfig.twig.date_format) }}
{%- endif -%}
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|format_date(localized_date_format, pattern=date_format)') }}
{{ echo_endif() }}
{%- else -%}
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
{%- if column.formOptions.format is defined -%}
{{ echo_set('date_format', column.formOptions.format) }}
{%- else -%}
{{ echo_set('date_format', builder.generator.bundleConfig.twig.date_format) }}
{%- endif -%}

{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(date_format)') }}
{{ echo_endif() }}
{%- endif -%}
{% endapply %}
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(date_format)') }}
{{- echo_endif() }}
{%- endif -%}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
{% block column_datetime %}
{% apply spaceless %}
{% if builder.generator.bundleConfig.twig.use_localized_date == true -%}
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
{%- if column.localized_date_format is defined -%}
{{ echo_set('localized_date_format', column.formOptions.localized_date_format) }}
{%- else -%}
{{ echo_set('localized_date_format', builder.generator.bundleConfig.twig.localized_date_format) }}
{%- endif -%}
{%- if column.localized_time_format is defined -%}
{{ echo_set('localized_time_format', column.formOptions.localized_datetime_format) }}
{%- else -%}
{{ echo_set('localized_time_format', builder.generator.bundleConfig.twig.localized_datetime_format) }}
{%- endif -%}
{%- if column.formOptions.format is defined -%}
{{ echo_set('datetime_format', column.formOptions.format) }}
{%- else -%}
{{ echo_set('datetime_format', builder.generator.bundleConfig.twig.datetime_format) }}
{%- endif -%}
{% if builder.generator.bundleConfig.twig.use_localized_date == true -%}
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
{%- if column.localized_date_format is defined -%}
{{ echo_set('localized_date_format', column.formOptions.localized_date_format) }}
{%- else -%}
{{ echo_set('localized_date_format', builder.generator.bundleConfig.twig.localized_date_format) }}
{%- endif -%}
{%- if column.localized_time_format is defined -%}
{{ echo_set('localized_time_format', column.formOptions.localized_datetime_format) }}
{%- else -%}
{{ echo_set('localized_time_format', builder.generator.bundleConfig.twig.localized_datetime_format) }}
{%- endif -%}
{%- if column.formOptions.format is defined -%}
{{ echo_set('datetime_format', column.formOptions.format) }}
{%- else -%}
{{ echo_set('datetime_format', builder.generator.bundleConfig.twig.datetime_format) }}
{%- endif -%}

{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|format_datetime(localized_date_format, localized_time_format, pattern=datetime_format)') }}
{{ echo_endif() }}
{%- else -%}
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
{% if column.formOptions.format is defined %}
{{ echo_set('datetime_format', column.formOptions.format) }}
{% else %}
{{ echo_set('datetime_format', builder.generator.bundleConfig.twig.datetime_format) }}
{% endif %}
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|format_datetime(localized_date_format, localized_time_format, pattern=datetime_format)') }}
{{ echo_endif() }}
{%- else -%}
{{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }}
{% if column.formOptions.format is defined %}
{{ echo_set('datetime_format', column.formOptions.format) }}
{% else %}
{{ echo_set('datetime_format', builder.generator.bundleConfig.twig.datetime_format) }}
{% endif %}

{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(datetime_format)') }}
{{ echo_endif() }}
{%- endif %}
{% endapply %}
{{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(datetime_format)') }}
{{ echo_endif() }}
{%- endif %}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% block column_decimal %}
{% apply spaceless %}
{{- echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ "|number_format(" ~
column.formOptions.precision|default(admingenerator_config('twig.number_format.decimal')) ~ ", '" ~
admingenerator_config('twig.number_format.decimal_point') ~ "', '" ~
admingenerator_config('twig.number_format.thousand_separator')~ "')") -}}
{% endapply %}
{{- echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ "|number_format(" ~
column.formOptions.precision|default(admingenerator_config('twig.number_format.decimal')) ~ ", '" ~
admingenerator_config('twig.number_format.decimal_point') ~ "', '" ~
admingenerator_config('twig.number_format.thousand_separator')~ "')") -}}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{% block column_money %}
{% apply spaceless %}
{% set currency = column.formOptions.currency|default('EUR') %}
{% set precision = column.formOptions.precision|default(2) %}
{% set grouping = column.formOptions.grouping|default(true) %}
{% set divisor = column.formOptions.divisor|default(1) %}
{% set currency = column.formOptions.currency|default('EUR') %}
{% set precision = column.formOptions.precision|default(2) %}
{% set grouping = column.formOptions.grouping|default(true) %}
{% set divisor = column.formOptions.divisor|default(1) %}

{{ echo_twig('localized_money('~ builder.ModelClass~'.'~column.getter ~', "'~ currency ~'", "'~ precision ~'", '~ grouping ~', '~ divisor ~')') }}
{% endapply %}
{{- echo_twig('localized_money('~ builder.ModelClass~'.'~column.getter ~', "'~ currency ~'", "'~ precision ~'", '~ grouping ~', '~ divisor ~')') -}}
{% endblock %}
28 changes: 12 additions & 16 deletions Resources/views/templates/CommonAdmin/object_actions.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,18 @@
{% set actionParams = action.params ? echo_twig_assoc(action.params) : "{ 'pk': " ~ builder.ModelClass ~ "." ~ builder.getFieldGuesser().getModelPrimaryKeyName(model) ~ ", action: '" ~ action.name ~ "' }" %}
{% set translationDomain = action.type is same as('custom') ? i18n_catalog|default("Admin") : 'Admingenerator' %}

{% apply spaceless %}
{{ echo_spaceless() }}
<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('') }}"
href="{{ echo_path(actionRoute, actionParams) }}"
title="{{ echo_trans(action.label, {}, translationDomain, 'html_attr') }}"
{%- if action.confirm and not action.forceIntermediate %}
data-confirm="{{ echo_trans(action.confirm, {}, translationDomain, 'html_attr') }}"
data-confirm-modal="{{ action.confirmModal|default('#confirmObjectModal') }}"
data-toggle="modal"
{% endif -%}
{%- if action.csrfProtected and not action.forceIntermediate %} data-csrf-token="{{ echo_path(actionRoute, actionParams, ['csrf_token']) }}" {% endif -%}>
<i class="fa fa-fw {{ action.icon|default('fa-square fa-regular') }}"></i>
<span>{{ echo_trans(action.label, {}, translationDomain, 'html') }}</span>
</a>
{{ echo_endspaceless() }}
{% endapply %}
<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('') }}"
href="{{ echo_path(actionRoute, actionParams) }}"
title="{{ echo_trans(action.label, {}, translationDomain, 'html_attr') }}"
{%- if action.confirm and not action.forceIntermediate %}
data-confirm="{{ echo_trans(action.confirm, {}, translationDomain, 'html_attr') }}"
data-confirm-modal="{{ action.confirmModal|default('#confirmObjectModal') }}"
data-toggle="modal"
{% endif -%}
{%- if action.csrfProtected and not action.forceIntermediate %} data-csrf-token="{{ echo_path(actionRoute, actionParams, ['csrf_token']) }}" {% endif -%}>
<i class="fa fa-fw {{ action.icon|default('fa-square fa-regular') }}"></i>
<span>{{ echo_trans(action.label, {}, translationDomain, 'html') }}</span>
</a>
{% endblock %}

{% block object_actions_script %}
Expand Down