Skip to content

Commit

Permalink
refactor: improving collection
Browse files Browse the repository at this point in the history
  • Loading branch information
siganushka committed Nov 14, 2024
1 parent 03bd5ca commit f35aa79
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
{{- parent() -}}
{%- endblock collection_widget -%}

{%- block collection_add_button_widget -%}
{%- block collection_add_button_row -%}
{% set attr = attr|merge({class: (attr.class|default('btn-outline-primary') ~ ' text-nowrap w-100')|trim}) %}
{{- parent() -}}
{%- endblock collection_add_button_widget -%}
{%- endblock collection_add_button_row -%}

{%- block collection_delete_button_widget -%}
{%- block collection_delete_button_row -%}
{% set row_attr = row_attr|merge({style: row_attr.style|default('width: 1px')}) %}
{% set attr = attr|merge({class: (attr.class|default('btn-outline-danger') ~ ' text-nowrap')|trim}) %}
{{- parent() -}}
{%- endblock collection_delete_button_widget -%}
{%- endblock collection_delete_button_row -%}
3 changes: 2 additions & 1 deletion templates/form_theme.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
{%- block collection_entry_row -%}
<tr{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %} style="vertical-align: top">
{% for entry in compound ? form : [form] %}
<td class="{{ entry.vars.attr['data-collection-class']|default('col-auto') }}">
{% set collectionClass = entry.vars.attr['data-collection-class']|default('') %}
<td{% if collectionClass %} class="{{ collectionClass }}"{% endif %}>
{{- form_widget(entry, {attr: {placeholder: entry.vars.label}}) -}}
{{- form_errors(entry) -}}
{{- form_help(entry) -}}
Expand Down
2 changes: 1 addition & 1 deletion translations/messages.en.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'generic.import' => 'Import',
'generic.export' => 'Export',
'generic.action' => 'Action',
'generic.choice' => 'Please Choose!',
'generic.choice' => 'Please Choose',
'generic.choice_all' => 'All',
'generic.yes' => 'Yes',
'generic.no' => 'No',
Expand Down

0 comments on commit f35aa79

Please sign in to comment.