-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #14101 [Template][Events] Part of new UI bundle events for secu…
…rity and grid (ernestWarwas) This PR was merged into the 1.11 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | master <!-- see the comment below --> | | Bug fix? | no | | New feature? | no | | BC breaks? | no | | Deprecations? | no <!-- don't forget to update the UPGRADE-*.md file --> | | License | MIT | <!-- - Bug fixes must be submitted against the 1.10 or 1.11 branch(the lowest possible) - Features and deprecations must be submitted against the master branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> Commits ------- b0cf8fe [Template Events] Part of new UI bundle events 5baf53c [Template][Events] Use already created event in login form 26180fc [Template][Events] Fix for displaying filters 76208b4 [Template][Events] Changed names of events
- Loading branch information
Showing
12 changed files
with
143 additions
and
99 deletions.
There are no files selected for viewing
This file contains 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
21 changes: 21 additions & 0 deletions
21
src/Sylius/Bundle/UiBundle/Resources/views/Grid/Body/_navigation.html.twig
This file contains 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,21 @@ | ||
{% import '@SyliusUi/Macro/pagination.html.twig' as pagination %} | ||
|
||
<div class="sylius-grid-nav"> | ||
{% if data|length > 0 and definition.actionGroups.bulk is defined and definition.getEnabledActions('bulk')|length > 0 %} | ||
<div class="sylius-grid-nav__bulk"> | ||
{% for action in definition.getEnabledActions('bulk') %} | ||
{{ sylius_grid_render_bulk_action(grid, action, null) }} | ||
{% endfor %} | ||
</div> | ||
{% endif %} | ||
<div class="sylius-grid-nav__pagination"> | ||
{{ pagination.simple(data) }} | ||
</div> | ||
{% if definition.limits|length > 1 and data|length > min(definition.limits) %} | ||
<div class="sylius-grid-nav__perpage"> | ||
<div class="ui fluid one menu sylius-paginate"> | ||
{{ pagination.perPage(data, definition.limits) }} | ||
</div> | ||
</div> | ||
{% endif %} | ||
</div> |
3 changes: 3 additions & 0 deletions
3
src/Sylius/Bundle/UiBundle/Resources/views/Grid/Body/_pagination.html.twig
This file contains 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,3 @@ | ||
{% import '@SyliusUi/Macro/pagination.html.twig' as pagination %} | ||
|
||
{{ pagination.simple(data) }} |
21 changes: 21 additions & 0 deletions
21
src/Sylius/Bundle/UiBundle/Resources/views/Grid/Body/_table.html.twig
This file contains 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,21 @@ | ||
{% import '@SyliusUi/Macro/table.html.twig' as table %} | ||
{% import '@SyliusUi/Macro/messages.html.twig' as messages %} | ||
|
||
{% if data|length > 0 %} | ||
<div class="ui segment spaceless sylius-grid-table-wrapper"> | ||
<table class="ui sortable stackable very basic celled table" {{ sylius_test_html_attribute('grid-table') }}> | ||
<thead> | ||
<tr> | ||
{{ table.headers(grid, definition, app.request.attributes) }} | ||
</tr> | ||
</thead> | ||
<tbody {{ sylius_test_html_attribute('grid-table-body') }}> | ||
{% for row in data %} | ||
{{ table.row(grid, definition, row) }} | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
{% else %} | ||
{{ messages.info('sylius.ui.no_results_to_display') }} | ||
{% endif %} |
25 changes: 25 additions & 0 deletions
25
src/Sylius/Bundle/UiBundle/Resources/views/Grid/Filter/_content.html.twig
This file contains 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,25 @@ | ||
{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %} | ||
|
||
{% if definition.enabledFilters|length > 0 %} | ||
<div class="ui hidden divider"></div> | ||
<div class="ui styled fluid accordion"> | ||
<div class="title {% if criteria is not null %}active{% endif %}"> | ||
<i class="dropdown icon"></i> | ||
<i class="filter icon"></i> | ||
{{ 'sylius.ui.filters'|trans }} | ||
</div> | ||
<div class="content {% if criteria is not null %}active{% endif %}"> | ||
<form method="get" action="{{ path }}" class="ui loadable form" novalidate> | ||
<div class="sylius-filters"> | ||
{% for filter in definition.enabledFilters|filter(filter => filter.enabled)|sort_by('position') %} | ||
<div class="sylius-filters__field"> | ||
{{ sylius_grid_render_filter(grid, filter) }} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
{{ buttons.filter() }} | ||
{{ buttons.resetFilters(path) }} | ||
</form> | ||
</div> | ||
</div> | ||
{% endif %} |
12 changes: 12 additions & 0 deletions
12
src/Sylius/Bundle/UiBundle/Resources/views/Grid/_content.html.twig
This file contains 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,12 @@ | ||
{% set definition = grid.definition %} | ||
{% set data = grid.data %} | ||
|
||
{% set path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %} | ||
{% set criteria = app.request.query.get('criteria') %} | ||
|
||
{{ sylius_template_event('sylius.grid.filters', _context) }} | ||
|
||
<div class="ui hidden divider"></div> | ||
<div class="sylius-grid-wrapper"> | ||
{{ sylius_template_event('sylius.grid.body', _context) }} | ||
</div> |
78 changes: 1 addition & 77 deletions
78
src/Sylius/Bundle/UiBundle/Resources/views/Grid/_default.html.twig
This file contains 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,77 +1 @@ | ||
{% import '@SyliusUi/Macro/pagination.html.twig' as pagination %} | ||
{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %} | ||
{% import '@SyliusUi/Macro/messages.html.twig' as messages %} | ||
{% import '@SyliusUi/Macro/table.html.twig' as table %} | ||
|
||
{% set definition = grid.definition %} | ||
{% set data = grid.data %} | ||
|
||
{% set path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %} | ||
{% set criteria = app.request.query.get('criteria') %} | ||
|
||
{% if definition.enabledFilters|length > 0 %} | ||
<div class="ui hidden divider"></div> | ||
<div class="ui styled fluid accordion"> | ||
<div class="title {% if criteria is not null %}active{% endif %}"> | ||
<i class="dropdown icon"></i> | ||
<i class="filter icon"></i> | ||
{{ 'sylius.ui.filters'|trans }} | ||
</div> | ||
<div class="content {% if criteria is not null %}active{% endif %}"> | ||
<form method="get" action="{{ path }}" class="ui loadable form" novalidate> | ||
<div class="sylius-filters"> | ||
{% for filter in definition.enabledFilters|filter(filter => filter.enabled)|sort_by('position') %} | ||
<div class="sylius-filters__field"> | ||
{{ sylius_grid_render_filter(grid, filter) }} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
{{ buttons.filter() }} | ||
{{ buttons.resetFilters(path) }} | ||
</form> | ||
</div> | ||
</div> | ||
{% endif %} | ||
|
||
<div class="ui hidden divider"></div> | ||
<div class="sylius-grid-wrapper"> | ||
<div class="sylius-grid-nav"> | ||
{% if data|length > 0 and definition.actionGroups.bulk is defined and definition.getEnabledActions('bulk')|length > 0 %} | ||
<div class="sylius-grid-nav__bulk"> | ||
{% for action in definition.getEnabledActions('bulk') %} | ||
{{ sylius_grid_render_bulk_action(grid, action, null) }} | ||
{% endfor %} | ||
</div> | ||
{% endif %} | ||
<div class="sylius-grid-nav__pagination"> | ||
{{ pagination.simple(data) }} | ||
</div> | ||
{% if definition.limits|length > 1 and data|length > min(definition.limits) %} | ||
<div class="sylius-grid-nav__perpage"> | ||
<div class="ui fluid one menu sylius-paginate"> | ||
{{ pagination.perPage(data, definition.limits) }} | ||
</div> | ||
</div> | ||
{% endif %} | ||
</div> | ||
|
||
{% if data|length > 0 %} | ||
<div class="ui segment spaceless sylius-grid-table-wrapper"> | ||
<table class="ui sortable stackable very basic celled table" {{ sylius_test_html_attribute('grid-table') }}> | ||
<thead> | ||
<tr> | ||
{{ table.headers(grid, definition, app.request.attributes) }} | ||
</tr> | ||
</thead> | ||
<tbody {{ sylius_test_html_attribute('grid-table-body') }}> | ||
{% for row in data %} | ||
{{ table.row(grid, definition, row) }} | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
{% else %} | ||
{{ messages.info('sylius.ui.no_results_to_display') }} | ||
{% endif %} | ||
{{ pagination.simple(data) }} | ||
</div> | ||
{{ sylius_template_event('sylius.grid', _context) }} |
4 changes: 4 additions & 0 deletions
4
src/Sylius/Bundle/UiBundle/Resources/views/Security/Form/_credentials.html.twig
This file contains 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,4 @@ | ||
{{ form_row(form._username, {'value': last_username|default('')}) }} | ||
{{ form_row(form._password) }} | ||
{{ form_row(form._remember_me) }} | ||
<input type="hidden" name="_csrf_admin_security_token" value="{{ csrf_token('admin_authenticate') }}"> |
1 change: 1 addition & 0 deletions
1
src/Sylius/Bundle/UiBundle/Resources/views/Security/Form/_submit.html.twig
This file contains 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 @@ | ||
<button type="submit" class="ui fluid large primary submit button">Login</button> |
7 changes: 7 additions & 0 deletions
7
src/Sylius/Bundle/UiBundle/Resources/views/Security/_error.html.twig
This file contains 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,7 @@ | ||
{% import '@SyliusUi/Macro/messages.html.twig' as messages %} | ||
|
||
{% if last_error %} | ||
<div class="ui left aligned basic segment"> | ||
{{ messages.error(last_error.messageKey) }} | ||
</div> | ||
{% endif %} |
25 changes: 3 additions & 22 deletions
25
src/Sylius/Bundle/UiBundle/Resources/views/Security/_login.html.twig
This file contains 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,34 +1,15 @@ | ||
{% form_theme form '@SyliusUi/Form/theme.html.twig' %} | ||
|
||
{% import '@SyliusUi/Macro/messages.html.twig' as messages %} | ||
|
||
<div class="ui middle aligned center aligned grid"> | ||
<div class="column"> | ||
{{ sylius_template_event('sylius.admin.login.before_form', {'form': form}) }} | ||
|
||
{% if paths.logo is defined %} | ||
<div style="max-width: 270px; margin: 0 auto; margin-bottom: 40px;"> | ||
<img src="{{ asset(paths.logo) }}" class="ui fluid image" id="logo"> | ||
</div> | ||
{% endif %} | ||
|
||
{% if last_error %} | ||
<div class="ui left aligned basic segment"> | ||
{{ messages.error(last_error.messageKey) }} | ||
</div> | ||
{% endif %} | ||
{{ sylius_template_event('sylius.admin.login.before_form', _context) }} | ||
|
||
{{ form_start(form, {'action': action|default('/'), 'attr': {'class': 'ui large loadable form', 'novalidate': 'novalidate'}}) }} | ||
<div class="ui left aligned very padded segment"> | ||
{{ form_row(form._username, {'value': last_username|default('')}) }} | ||
{{ form_row(form._password) }} | ||
{{ form_row(form._remember_me) }} | ||
<input type="hidden" name="_csrf_admin_security_token" value="{{ csrf_token('admin_authenticate') }}"> | ||
<button type="submit" class="ui fluid large primary submit button">Login</button> | ||
{{ sylius_template_event('sylius.admin.login.form.content', _context) }} | ||
</div> | ||
|
||
{{ sylius_template_event('sylius.admin.login.form', {'form': form}) }} | ||
|
||
{{ sylius_template_event('sylius.admin.login.form', _context) }} | ||
{{ form_end(form, {'render_rest': false}) }} | ||
</div> | ||
</div> |
5 changes: 5 additions & 0 deletions
5
src/Sylius/Bundle/UiBundle/Resources/views/Security/_logo.html.twig
This file contains 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 @@ | ||
{% if paths.logo is defined %} | ||
<div style="max-width: 270px; margin: 0 auto; margin-bottom: 40px;"> | ||
<img src="{{ asset(paths.logo) }}" class="ui fluid image" id="logo"> | ||
</div> | ||
{% endif %} |