Disable more elements when form is closed

This commit is contained in:
2024-03-02 12:48:34 +01:00
parent abea8aa0c8
commit e0e6ec6bd5
4 changed files with 56 additions and 38 deletions

View File

@ -24,9 +24,9 @@
{% endmacro %}
{# Simple driver select for forms #}
{% macro driver_select(name, label, include_none, drivers=none) %}
{% macro driver_select(name, label, include_none, drivers=none, disabled=false) %}
<div class="form-floating">
<select name="{{ name }}" id="{{ name }}" class="form-select" aria-label="{{ name }}">
<select name="{{ name }}" id="{{ name }}" class="form-select" aria-label="{{ name }}" {% if disabled %}disabled="disabled"{% endif %}>
<option value="" selected disabled hidden></option>
{% if drivers == none %}
@ -42,9 +42,9 @@
{% endmacro %}
{# Driver select for forms where a value might be preselected #}
{% macro driver_select_with_preselect(driver_match, name, label, include_none, drivers=none) %}
{% macro driver_select_with_preselect(driver_match, name, label, include_none, drivers=none, disabled=false) %}
<div class="form-floating">
<select name="{{ name }}" id="{{ name }}" class="form-select" aria-label="{{ name }}">
<select name="{{ name }}" id="{{ name }}" class="form-select" aria-label="{{ name }}" {% if disabled %}disabled="disabled"{% endif %}>
{# Use namespace wrapper to persist scope between loop iterations #}
{% set user_has_chosen = namespace(driverpre=false) %}
@ -75,9 +75,9 @@
{% endmacro %}
{# Simple team select for forms #}
{% macro team_select(name, label, include_none, teams=none) %}
{% macro team_select(name, label, include_none, teams=none, disabled=false) %}
<div class="form-floating">
<select name="{{ name }}" id="{{ name }}" class="form-select" aria-label="{{ name }}">
<select name="{{ name }}" id="{{ name }}" class="form-select" aria-label="{{ name }}" {% if disabled %}disabled="disabled"{% endif %}>
<option value="" selected disabled hidden></option>
{% if teams == none %}
@ -93,9 +93,9 @@
{% endmacro %}
{# Team select for forms where a value might be preselected #}
{% macro team_select_with_preselect(team_match, name, label, include_none, teams=none) %}
{% macro team_select_with_preselect(team_match, name, label, include_none, teams=none, disabled=false) %}
<div class="form-floating">
<select name="{{ name }}" id="{{ name }}" class="form-select" aria-label="{{ name }}">
<select name="{{ name }}" id="{{ name }}" class="form-select" aria-label="{{ name }}" {% if disabled %}disabled="disabled"{% endif %}>
{# Use namespace wrapper to persist scope between loop iterations #}
{% set user_has_chosen = namespace(teampre=false) %}