fix: enforce mutability checks for all fields
This commit is contained in:
@@ -41,7 +41,8 @@
|
||||
{%- for child in form %}
|
||||
{% set choiceData = form.vars.choices[loop.index0] is defined ? form.vars.choices[loop.index0].data : null %}
|
||||
{% set description = child.vars.attr['data-description']|default(null) %}
|
||||
{% set isReadonly = child.vars.attr.readonly is defined %}
|
||||
{% set fieldReadonly = form.vars.attr.readonly is defined %}
|
||||
{% set isReadonly = fieldReadonly or child.vars.attr.readonly is defined %}
|
||||
{%- set child_attr = {} -%}
|
||||
{%- if attr['hx-trigger'] is defined -%}
|
||||
{%- set child_attr = {
|
||||
@@ -51,6 +52,9 @@
|
||||
'hx-swap': attr['hx-swap']
|
||||
} -%}
|
||||
{%- endif -%}
|
||||
{%- if fieldReadonly and child.vars.attr.readonly is not defined -%}
|
||||
{%- set child_attr = child_attr|merge({'readonly': true}) -%}
|
||||
{%- endif -%}
|
||||
<tr>
|
||||
<td class="border border-primary-bg p-2 align-top">
|
||||
<div>{{- child.vars.label -}}</div>
|
||||
|
||||
@@ -205,7 +205,9 @@
|
||||
<div{% if tooltip is not null %} {{ stimulus_controller('tooltip', { 'content': tooltip }) }}{% endif %}>
|
||||
{%- if attr.readonly is defined %}
|
||||
<div class="cursor-not-allowed">
|
||||
{{ parent() }}
|
||||
<div class="pointer-events-none">
|
||||
{{ parent() }}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
{{ parent() }}
|
||||
@@ -223,6 +225,9 @@
|
||||
'hx-swap': attr['hx-swap']
|
||||
}) -%}
|
||||
{%- endif -%}
|
||||
{%- if attr.readonly is defined and child.vars.attr.readonly is not defined -%}
|
||||
{%- set child_attr = child_attr|merge({'readonly': true}) -%}
|
||||
{%- endif -%}
|
||||
{%- if child.vars.attr['data-tooltip'] is defined -%}
|
||||
{%- set child_attr = child_attr|merge({'data-tooltip': child.vars.attr['data-tooltip']}) -%}
|
||||
{%- endif -%}
|
||||
@@ -358,4 +363,3 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user