Skip to content

Commit 6a9efd8

Browse files
LegendaryLinuxqwint
authored andcommitted
Update options pages macros to respect valid_keys for item and location options (ArchipelagoMW#3347)
1 parent 9259120 commit 6a9efd8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

WebHostLib/templates/playerOptions/macros.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
{% macro ItemDict(option_name, option, world) %}
115115
{{ OptionTitle(option_name, option) }}
116116
<div class="option-container">
117-
{% for item_name in world.item_names|sort %}
117+
{% for item_name in (option.valid_keys|sort if (option.valid_keys|length > 0) else world.item_names|sort) %}
118118
<div class="option-entry">
119119
<label for="{{ option_name }}-{{ item_name }}-qty">{{ item_name }}</label>
120120
<input type="number" id="{{ option_name }}-{{ item_name }}-qty" name="{{ option_name }}||{{ item_name }}||qty" value="{{ option.default[item_name]|default("0") }}" data-option-name="{{ option_name }}" data-item-name="{{ item_name }}" />
@@ -149,7 +149,7 @@
149149
{% if world.location_name_groups.keys()|length > 1 %}
150150
<div class="option-divider">&nbsp;</div>
151151
{% endif %}
152-
{% for location_name in world.location_names|sort %}
152+
{% for location_name in (option.valid_keys|sort if (option.valid_keys|length > 0) else world.location_names|sort) %}
153153
<div class="option-entry">
154154
<input type="checkbox" id="{{ option_name }}-{{ location_name }}" name="{{ option_name }}" value="{{ location_name }}" {{ "checked" if location_name in option.default }} />
155155
<label for="{{ option_name }}-{{ location_name }}">{{ location_name }}</label>
@@ -172,7 +172,7 @@
172172
{% if world.item_name_groups.keys()|length > 1 %}
173173
<div class="option-divider">&nbsp;</div>
174174
{% endif %}
175-
{% for item_name in world.item_names|sort %}
175+
{% for item_name in (option.valid_keys|sort if (option.valid_keys|length > 0) else world.item_names|sort) %}
176176
<div class="option-entry">
177177
<input type="checkbox" id="{{ option_name }}-{{ item_name }}" name="{{ option_name }}" value="{{ item_name }}" {{ "checked" if item_name in option.default }} />
178178
<label for="{{ option_name }}-{{ item_name }}">{{ item_name }}</label>

WebHostLib/templates/weightedOptions/macros.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105

106106
{% macro ItemDict(option_name, option, world) %}
107107
<div class="dict-container">
108-
{% for item_name in world.item_names|sort %}
108+
{% for item_name in (option.valid_keys|sort if (option.valid_keys|length > 0) else world.item_names|sort) %}
109109
<div class="dict-entry">
110110
<label for="{{ option_name }}-{{ item_name }}-qty">{{ item_name }}</label>
111111
<input
@@ -150,7 +150,7 @@
150150
{% if world.location_name_groups.keys()|length > 1 %}
151151
<div class="divider">&nbsp;</div>
152152
{% endif %}
153-
{% for location_name in world.location_names|sort %}
153+
{% for location_name in (option.valid_keys|sort if (option.valid_keys|length > 0) else world.location_names|sort) %}
154154
<div class="set-entry">
155155
<input type="checkbox" id="{{ option_name }}-{{ location_name }}" name="{{ option_name }}||{{ location_name }}" value="1" {{ "checked" if location_name in option.default }} />
156156
<label for="{{ option_name }}-{{ location_name }}">{{ location_name }}</label>
@@ -172,7 +172,7 @@
172172
{% if world.item_name_groups.keys()|length > 1 %}
173173
<div class="set-divider">&nbsp;</div>
174174
{% endif %}
175-
{% for item_name in world.item_names|sort %}
175+
{% for item_name in (option.valid_keys|sort if (option.valid_keys|length > 0) else world.item_names|sort) %}
176176
<div class="set-entry">
177177
<input type="checkbox" id="{{ option_name }}-{{ item_name }}" name="{{ option_name }}||{{ item_name }}" value="1" {{ "checked" if item_name in option.default }} />
178178
<label for="{{ option_name }}-{{ item_name }}">{{ item_name }}</label>

0 commit comments

Comments
 (0)