Skip to content

Commit

Permalink
Fix shenanigans when settings have an empty string as value in web UI
Browse files Browse the repository at this point in the history
  • Loading branch information
TheophileDiot committed Jul 25, 2024
1 parent f74f215 commit d91bca9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ui/templates/setting_input.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
id="{{ inp_name_mult }}"
name="{{ inp_name_mult }}"
class="regular-input"
value="{% if global_config_value %} {{ global_config_value }} {% else %} {{ inp_default }} {% endif %}"
value="{% if global_config_value != None %} {{ global_config_value }} {% else %} {{ inp_default }} {% endif %}"
type="{{ inp_type }}"
pattern="{{ inp_regex|safe }}"
{% if is_multiple %}data-is-multiple{% endif %} />
Expand Down
10 changes: 5 additions & 5 deletions src/ui/templates/setting_select.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{% for item in inp_items %}
<option {% if not item %}label="empty"{% endif %}
value="{{ item }}"
{% if global_config_value and global_config_value == item or not global_config_value and inp_default == item %} selected{% endif %}>
{% if global_config_value != None and global_config_value == item or global_config_value == None and inp_default == item %} selected{% endif %}>
{{ item }}
</option>
{% endfor %}
Expand All @@ -42,11 +42,11 @@
type="button"
class="custom-select-btn">
{% for item in inp_items %}
{% if global_config_value and
{% if global_config_value != None and
global_config_value == item %}
<span data-setting-select-text="{{ inp_id }}"
data-value="{{ global_config_value }}">{{ global_config_value }}</span>
{% elif not global_config_value and inp_default == item %}
{% elif global_config_value == None and inp_default == item %}
<span aria-description="current value"
data-setting-select-text="{{ inp_id }}"
data-value="{{ inp_default }}">{{ inp_default }}</span>
Expand All @@ -67,8 +67,8 @@
data-setting-select-dropdown="{{ inp_id }}"
class="hidden z-[20] fixed h-full flex-col mt-2 max-h-[200px] overflow-auto">
{% for item in inp_items %}
{% if global_config_value and
global_config_value == item or not global_config_value
{% if global_config_value != None and
global_config_value == item or global_config_value == None
and inp_default == item %}
<button role="option"
value="{{ item }}"
Expand Down

0 comments on commit d91bca9

Please sign in to comment.