-
Notifications
You must be signed in to change notification settings - Fork 32
Fix templates without configuration or metadata from resource bundle #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 17 additions & 15 deletions
32
src/BootstrapAdminUi/templates/shared/crud/common/content/form.html.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,27 @@ | ||
| {% if form is not defined %} | ||
| {% set form = hookable_metadata.context.form %} | ||
| {% set form = hookable_metadata.context.form|default(null) %} | ||
| {% endif %} | ||
|
|
||
| {% if resource is not defined %} | ||
| {% set resource = hookable_metadata.context.resource|default(null) %} | ||
| {% endif %} | ||
|
|
||
| {% form_theme form '@SyliusBootstrapAdminUi/shared/form_theme.html.twig' %} | ||
| {% if form is not null %} | ||
| {% form_theme form '@SyliusBootstrapAdminUi/shared/form_theme.html.twig' %} | ||
|
|
||
| <div class="container-xl" {% if attributes is defined %} {{ attributes }} {% endif %}> | ||
| {{ form_start(form, {'attr': {'novalidate': 'novalidate', 'id': form.vars.id}}) }} | ||
| <div class="card-body"> | ||
| {% if hookable_metadata.configuration.method is defined %} | ||
| <input type="hidden" name="_method" value="{{ hookable_metadata.configuration.method }}"/> | ||
| {% elseif form.vars.data.id|default(null) is not null %} | ||
| <input type="hidden" name="_method" value="PUT"/> | ||
| {% endif %} | ||
| {{ form_errors(form) }} | ||
| {{ form_widget(form._token) }} | ||
| <div class="container-xl" {% if attributes is defined %} {{ attributes }} {% endif %}> | ||
| {{ form_start(form, {'attr': {'novalidate': 'novalidate', 'id': form.vars.id}}) }} | ||
| <div class="card-body"> | ||
| {% if hookable_metadata.configuration.method is defined %} | ||
| <input type="hidden" name="_method" value="{{ hookable_metadata.configuration.method }}"/> | ||
| {% elseif form.vars.data.id|default(null) is not null %} | ||
| <input type="hidden" name="_method" value="PUT"/> | ||
| {% endif %} | ||
| {{ form_errors(form) }} | ||
| {{ form_widget(form._token) }} | ||
|
|
||
| {% hook 'form' with { form, resource } %} | ||
| {% hook 'form' with { form, resource } %} | ||
| </div> | ||
| {{ form_end(form, {render_rest: hookable_metadata.configuration.render_rest|default(false)}) }} | ||
| </div> | ||
| {{ form_end(form, {render_rest: hookable_metadata.configuration.render_rest|default(false)}) }} | ||
| </div> | ||
| {% endif %} |
2 changes: 1 addition & 1 deletion
2
...ootstrapAdminUi/templates/shared/crud/common/content/header/title_block/actions.html.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletions
14
...pAdminUi/templates/shared/crud/common/content/header/title_block/actions/cancel.html.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| {% import '@SyliusBootstrapAdminUi/shared/helper/button.html.twig' as button %} | ||
|
|
||
| {% set configuration = hookable_metadata.context.configuration %} | ||
| {% set configuration = hookable_metadata.context.configuration|default(null) %} | ||
|
|
||
| {% set index_url = sylius_generate_redirect_path(app.request.headers.get('referer')|default(path( | ||
| configuration.vars.index.route.name|default(configuration.getRouteName('index')), | ||
| configuration.vars.index.route.parameters|default(configuration.vars.route.parameters|default({})) | ||
| ))) %} | ||
| {% if configuration is not null %} | ||
| {% set index_url = sylius_generate_redirect_path(app.request.headers.get('referer')|default(path( | ||
| configuration.vars.index.route.name|default(configuration.getRouteName('index')), | ||
| configuration.vars.index.route.parameters|default(configuration.vars.route.parameters|default({})) | ||
| ))) %} | ||
|
|
||
| {{ button.cancel(sylius_test_form_attribute('cancel-changes-button')|merge({ text: 'sylius.ui.cancel'|trans, url: index_url, class: 'btn' })) }} | ||
| {{ button.cancel(sylius_test_form_attribute('cancel-changes-button')|merge({ text: 'sylius.ui.cancel'|trans, url: index_url, class: 'btn' })) }} | ||
| {% endif %} | ||
4 changes: 2 additions & 2 deletions
4
...pAdminUi/templates/shared/crud/common/content/header/title_block/actions/create.html.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| {% import '@SyliusBootstrapAdminUi/shared/helper/button.html.twig' as button %} | ||
|
|
||
| {% set form = hookable_metadata.context.form %} | ||
| {% set form = hookable_metadata.context.form|default(null) %} | ||
|
|
||
| {{ button.primary({ text: 'sylius.ui.create'|trans, type: 'submit', form: form.vars.id }) }} | ||
| {{ button.primary({ text: 'sylius.ui.create'|trans, type: 'submit', form: form.vars.id|default(null) }) }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/BootstrapAdminUi/templates/shared/crud/index/content/grid/filters.html.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/BootstrapAdminUi/templates/shared/crud/index/content/grid/no_results.html.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 21 additions & 12 deletions
33
src/BootstrapAdminUi/templates/shared/crud/update/content/header/breadcrumbs.html.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,41 @@ | ||
| {% from '@SyliusBootstrapAdminUi/shared/helper/breadcrumbs.html.twig' import breadcrumbs %} | ||
|
|
||
| {% set configuration = hookable_metadata.context.configuration %} | ||
| {% set resource = hookable_metadata.context.resource %} | ||
| {% set metadata = hookable_metadata.context.metadata %} | ||
| {% set configuration = hookable_metadata.context.configuration|default(null) %} | ||
| {% set resource = hookable_metadata.context.resource|default(null) %} | ||
| {% set metadata = hookable_metadata.context.metadata|default(null) %} | ||
|
|
||
| {% if metadata is not null and configuration is not null %} | ||
| {% set resource_index = metadata.applicationName~'.ui.'~metadata.pluralName %} | ||
| {% set index_url = path( | ||
| configuration.vars.index.route.name|default(configuration.getRouteName('index')), | ||
| configuration.vars.index.route.parameters|default(configuration.vars.route.parameters|default({})) | ||
| ) %} | ||
|
loic425 marked this conversation as resolved.
Outdated
|
||
| {% endif %} | ||
|
|
||
| {% set rendered_field_prefix = hookable_metadata.configuration.rendered_field_prefix|default(null) %} | ||
| {% set field_name = hookable_metadata.configuration.rendered_field|default('') %} | ||
| {% set rendered_field = rendered_field_prefix ~ (attribute(resource, field_name) is defined ? attribute(resource, field_name) : null) %} | ||
|
|
||
| {% set resource_edit_name = rendered_field|default(resource.translations[app.locale].name|default(resource.code|default(resource.id))) %} | ||
| {% set show_route_name = configuration.vars.index.route.name|default(configuration.getRouteName('show')) %} | ||
| {% set resource_edit_name = rendered_field|default(resource.translations[app.locale].name|default(resource.code|default(resource.id|default(null)))) %} | ||
| {% set show_route_name = configuration.vars.index.route.name|default(configuration.getRouteName('show')|default(null)) %} | ||
|
|
||
| {% if sylius_route_exists(show_route_name) %} | ||
| {% if show_route_name is not null and sylius_route_exists(show_route_name) %} | ||
| {% set show_url = path(show_route_name, { id: resource.id }) %} | ||
| {% set resource_edit = { name: resource_edit_name, url: show_url} %} | ||
| {% else %} | ||
| {% set resource_edit = { name: resource_edit_name, active: true} %} | ||
| {% endif %} | ||
|
|
||
| {{ breadcrumbs([ | ||
| { name: 'sylius.ui.dashboard', url: path('sylius_admin_ui_dashboard'), active: false }, | ||
| { name: resource_index, url: index_url, active: false }, | ||
| resource_edit, | ||
| { name: 'sylius.ui.edit'|trans, active: false } | ||
| ]) }} | ||
| {% if resource_index is defined %} | ||
| {{ breadcrumbs([ | ||
| { name: 'sylius.ui.dashboard', url: path('sylius_admin_ui_dashboard'), active: false }, | ||
| { name: resource_index, url: index_url, active: false }, | ||
| resource_edit, | ||
| { name: 'sylius.ui.edit'|trans, active: false } | ||
| ]) }} | ||
| {% else %} | ||
| {{ breadcrumbs([ | ||
| { name: 'sylius.ui.dashboard', url: path('sylius_admin_ui_dashboard'), active: false }, | ||
| { name: 'sylius.ui.edit'|trans, active: false } | ||
| ]) }} | ||
| {% endif %} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ sylius: | |
| from: From | ||
| hello: Hello | ||
| in: 'In' | ||
| index: 'Index' | ||
| info: Info | ||
| license: 'License' | ||
| login: Login | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| {% extends '@SyliusAdminUi/base.html.twig' %} | ||
|
|
||
| {% block body %} | ||
| {% hook ['sylius_admin.common.create'] %} | ||
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| {% extends '@SyliusAdminUi/base.html.twig' %} | ||
|
|
||
| {% block body %} | ||
| {% hook ['sylius_admin.common.index'] %} | ||
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| {% extends '@SyliusAdminUi/base.html.twig' %} | ||
|
|
||
| {% block body %} | ||
| {% hook ['sylius_admin.common.show'] %} | ||
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| {% extends '@SyliusAdminUi/base.html.twig' %} | ||
|
|
||
| {% block body %} | ||
| {% hook ['sylius_admin.common.update'] %} | ||
| {% endblock %} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.