Skip to content

Commit

Permalink
IBX-9463: Disabled field based on passed attribute (#1461)
Browse files Browse the repository at this point in the history
  • Loading branch information
bozatko authored Feb 24, 2025
1 parent 366afe0 commit 6354442
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{% set is_password_input = is_password_input|default(is_password_type) %}
{% set has_search = has_search|default(false) %}
{% set is_multiline = is_multiline|default(false) %}
{% set is_disabled = is_disabled|default(false) %}
{% set extra_btn = extra_btn|default({})|merge({
label: extra_btn.label|default(''),
attr: extra_btn.attr|default({})|merge({
Expand Down Expand Up @@ -33,6 +34,7 @@
type="button"
class="btn ibexa-btn ibexa-btn--ghost ibexa-btn--no-text ibexa-input-text-wrapper__action-btn ibexa-input-text-wrapper__action-btn--clear"
tabindex="-1"
{{ is_disabled ? 'disabled' }}
{% if should_clear_button_send_form %}data-send-form-after-clearing{% endif %}
>
<svg class="ibexa-icon ibexa-icon--tiny-small">
Expand All @@ -44,6 +46,7 @@
type="button"
class="btn ibexa-btn ibexa-btn--ghost ibexa-btn--no-text ibexa-input-text-wrapper__action-btn ibexa-input-text-wrapper__action-btn--password-toggler"
tabindex="5"
{{ is_disabled ? 'disabled' }}
>
<svg class="ibexa-icon ibexa-icon--small ibexa-input-text-wrapper__password-show">
<use xlink:href="{{ ibexa_icon_path('view') }}"></use>
Expand All @@ -53,7 +56,12 @@
</svg>
</button>
{% elseif has_search %}
<button type="{{ search_button_type|default('submit') }}" class="btn ibexa-btn ibexa-btn--ghost ibexa-btn--no-text ibexa-input-text-wrapper__action-btn ibexa-input-text-wrapper__action-btn--search" tabindex="-1">
<button
type="{{ search_button_type|default('submit') }}"
class="btn ibexa-btn ibexa-btn--ghost ibexa-btn--no-text ibexa-input-text-wrapper__action-btn ibexa-input-text-wrapper__action-btn--search"
tabindex="-1"
{{ is_disabled ? 'disabled' }}
>
<svg class="ibexa-icon ibexa-icon--small">
<use xlink:href="{{ ibexa_icon_path('search') }}"></use>
</svg>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

{% set is_small = is_small|default(false) %}
{% set is_datetime_popup_inline = is_datetime_popup_inline|default(false) %}
{% set is_disabled = is_disabled|default(false) %}

{% set wrapper_attr = wrapper_attr|default({})|merge({
class: (wrapper_attr.class|default('')
Expand All @@ -17,6 +18,7 @@
readonly: 'readonly',
type: 'text',
placeholder: input_attr.placeholder|default(' '),
disabled: is_disabled,
}) %}

{% embed '@ibexadesign/ui/component/input_text.html.twig' with { has_search: false } %}
Expand All @@ -30,6 +32,7 @@
<button
type="button"
class="btn ibexa-btn ibexa-btn--ghost ibexa-btn--no-text ibexa-input-text-wrapper__action-btn ibexa-input-text-wrapper__action-btn--calendar"
{{ is_disabled ? 'disabled' }}
>
<svg class="ibexa-icon ibexa-icon--small">
<use xlink:href="{{ ibexa_icon_path('date') }}"></use>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@
{%- block date_time_picker_widget -%}
<div class="ibexa-picker">
{% include '@ibexadesign/ui/component/inputs/input_date_time_picker.html.twig' with {
input_attr: { class: 'ibexa-picker__input' }
input_attr: { class: 'ibexa-picker__input' },
is_disabled: attr.disabled|default(false),
} %}
{% set attr = attr|merge({ 'hidden': true, 'class': 'ibexa-picker__form-input' }) %}
{{ block('form_widget') }}
Expand Down

0 comments on commit 6354442

Please sign in to comment.