Skip to content

Commit

Permalink
Merge pull request #4 from tienvx/fix-form-theme
Browse files Browse the repository at this point in the history
Fix form theme
  • Loading branch information
tienvx authored Oct 3, 2021
2 parents 9ff24e3 + 26a2804 commit 0edf124
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ class TaskType extends AbstractType
}
```

Then you need to set the form theme:
```yaml
# config/packages/twig.yaml
twig:
# For bootstrap for example
form_themes: ['@CollectionJs/bootstrap_5_layout.html.twig']
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"peerDependencies": {
"stimulus": "^2.0.0",
"symfony-collection-js": "^4.2.0"
"symfony-collection-js": "^4.2.0-js-only"
},
"devDependencies": {
"@babel/cli": "^7.12.1",
Expand All @@ -29,6 +29,6 @@
"@babel/preset-env": "^7.12.7",
"@symfony/stimulus-testing": "^1.1.0",
"stimulus": "^2.0.0",
"symfony-collection-js": "^4.2.0"
"symfony-collection-js": "^4.2.0-js-only"
}
}
10 changes: 5 additions & 5 deletions src/Resources/views/bootstrap_5_layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
{%- set dataController = (attr['data-controller']|default('') ~ ' ' ~ controllerName)|trim -%}
{% set row_attr = row_attr|merge({
'data-controller': dataController,
'data-'~ controllerName ~ '-allow-add': allow_add ? 'true' : 'false',
'data-'~ controllerName ~ '-allow-delete': allow_delete ? 'true' : 'false',
'data-'~ controllerName ~ '-allow-move-up': allow_move_up ? 'true' : 'false',
'data-'~ controllerName ~ '-allow-move-down': allow_move_down ? 'true' : 'false',
('data-'~ controllerName ~ '-allow-add'): allow_add ? 'true' : 'false',
('data-'~ controllerName ~ '-allow-delete'): allow_delete ? 'true' : 'false',
('data-'~ controllerName ~ '-allow-move-up'): allow_move_up ? 'true' : 'false',
('data-'~ controllerName ~ '-allow-move-down'): allow_move_down ? 'true' : 'false',
}) %}

{{ block('form_row') }}
Expand Down Expand Up @@ -48,7 +48,7 @@
{% block collection_js_entry_widget %}
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne">
<h5 class="m-0">{{ value|string }}</h5>
<h5 class="m-0">{{ value }}</h5>
<div>
<button class="accordion-button {{ render_expanded ? '' : 'collapsed' }}" type="button" data-bs-toggle="collapse" data-bs-target="#{{ id }}-contents">
<i class="fas fw fa-chevron-right form-collection-item-collapse-marker"></i>
Expand Down

0 comments on commit 0edf124

Please sign in to comment.