-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
![Capture d’écran du 2024-09-18 21-44-54](https://github.com/user-attachments/assets/b4d95ede-b7e7-4b4e-af87-5d7dc605b7e1) ![image](https://github.com/user-attachments/assets/7862515f-4888-4d20-8137-eed803414f67)
- Loading branch information
Showing
13 changed files
with
268 additions
and
3 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
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,44 @@ | ||
/*! | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
textarea.form-control { | ||
min-height: 8rem; | ||
height: 12rem; | ||
} | ||
|
||
.tab-error { | ||
@extend .float-end; | ||
@extend .badge; | ||
@extend .bg-danger; | ||
@extend .rounded-pill; | ||
@extend .text-white; | ||
} | ||
|
||
.accordion-error { | ||
@extend .position-absolute; | ||
@extend .top-50; | ||
@extend .start-0; | ||
@extend .translate-middle; | ||
@extend .badge; | ||
@extend .rounded-pill; | ||
@extend .bg-danger; | ||
@extend .text-white; | ||
} | ||
|
||
.accordion-item:has(.accordion-error), | ||
.list-group-item:has(.tab-error), | ||
.list-group-item.active:has(.tab-error) { | ||
border-left-style: solid; | ||
border-left-width: 2px; | ||
border-left-color: #ff0017; | ||
} | ||
|
||
.form-select:disabled { | ||
color: var(--tblr-gray-500); | ||
} |
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 |
---|---|---|
|
@@ -19,6 +19,7 @@ body { | |
|
||
@import "alert"; | ||
@import "datatable"; | ||
@import "form"; | ||
@import "sidebar"; | ||
|
||
@import "body"; |
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
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/BootstrapAdminUi/templates/shared/crud/common/content/form.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 @@ | ||
{% if form is not defined %} | ||
{% set form = hookable_metadata.context.form %} | ||
{% endif %} | ||
|
||
{% 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 is not null %} | ||
<input type="hidden" name="_method" value="PUT"/> | ||
{% endif %} | ||
{{ form_errors(form) }} | ||
{{ form_widget(form._token) }} | ||
|
||
{% hook 'form' with { form } %} | ||
</div> | ||
{{ form_end(form, {render_rest: hookable_metadata.configuration.render_rest|default(false)}) }} | ||
</div> |
3 changes: 3 additions & 0 deletions
3
src/BootstrapAdminUi/templates/shared/crud/common/content/form/sections.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 @@ | ||
<div class="row"> | ||
{% hook 'sections' %} | ||
</div> |
9 changes: 9 additions & 0 deletions
9
src/BootstrapAdminUi/templates/shared/crud/common/content/form/sections/general.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,9 @@ | ||
<div class="col-12"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<div class="row align-items-center"> | ||
{% hook 'general' %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
1 change: 1 addition & 0 deletions
1
...strapAdminUi/templates/shared/crud/common/content/form/sections/general/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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ form_widget(hookable_metadata.context.form) }} |
17 changes: 17 additions & 0 deletions
17
src/BootstrapAdminUi/templates/shared/crud/common/content/form_error_alert.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,17 @@ | ||
{% from '@SyliusBootstrapAdminUi/shared/helper/icon.html.twig' import icon %} | ||
|
||
{% set form = hookable_metadata.context.form|default(null) %} | ||
|
||
{% if form is not null and form.vars.valid == false %} | ||
<div class="container-xl"> | ||
<div class="sylius alert alert-danger" role="alert" {{ sylius_test_html_attribute('form-error-alert') }}> | ||
<div class="d-flex"> | ||
<div>{{ icon({ icon: 'danger' }) }}</div> | ||
<div class="mx-2"> | ||
<h4 class="alert-title">{{ 'sylius.ui.error'|trans }}</h4> | ||
<div class="text-secondary">{{ 'sylius.ui.this_form_contains_errors'|trans }}</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endif %} |
45 changes: 45 additions & 0 deletions
45
src/BootstrapAdminUi/templates/shared/form_theme.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,45 @@ | ||
{% extends 'bootstrap_5_layout.html.twig' %} | ||
|
||
{%- block form_start -%} | ||
{%- do form.setMethodRendered() -%} | ||
{% set method = method|upper %} | ||
{%- if method in ["GET", "POST"] -%} | ||
{% set form_method = method %} | ||
{%- else -%} | ||
{% set form_method = "POST" %} | ||
{%- endif -%} | ||
<form{% if name != '' %} name="{{ name }}"{% endif %} method="{{ form_method|lower }}"{% if action != '' %} action="{{ action }}"{% endif %}{{ block('attributes') }}{% if multipart %} enctype="multipart/form-data"{% endif %} {{ stimulus_controller('compound-form-errors') }}> | ||
{%- if form_method != method -%} | ||
<input type="hidden" name="_method" value="{{ method }}" /> | ||
{%- endif -%} | ||
{%- endblock form_start -%} | ||
|
||
{%- block form_row -%} | ||
{% set row_attr = row_attr|default({})|merge({ class: (row_attr.class|default('mb-3') ~ ' field')|trim }) %} | ||
{{ parent() }} | ||
{%- endblock form_row %} | ||
|
||
{% block sylius_resource_autocomplete_choice_row %} | ||
<div class="{% if required %}required {% endif %}{% if disabled %}disabled {% endif %}field{% if (not compound or force_error|default(false)) and not valid %} error{% endif %}"> | ||
{{- form_label(form) -}} | ||
<select | ||
class="form-control" | ||
data-choices="true" | ||
data-choice-label-field="{{ choice_name }}" | ||
data-choice-value-field="{{ choice_value }}" | ||
data-input-id="{{ form.vars.id }}" | ||
data-init-url="{{ init_load_url|default(null) }}" | ||
{% if search_url is defined %}data-search-url="{{ search_url }}"{% endif %} | ||
data-no-choices-text="{{ no_choices_translation|default('sylius.ui.start_typing_to_search')|trans }}" | ||
{% if form.vars.disabled %}disabled{% endif %} | ||
{% if multiple %}multiple{% endif %} | ||
></select> | ||
{{ form_widget(form) }} | ||
{{- form_errors(form) -}} | ||
</div> | ||
{% endblock %} | ||
|
||
{%- block button_widget -%} | ||
{% set attr = attr|merge({'class': (attr.class|default('') ~ ' btn btn-outline-primary')|trim}) %} | ||
{{ parent() }} | ||
{%- endblock -%} |
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
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