diff --git a/resources/assets/javascripts/lib/resources.js b/resources/assets/javascripts/lib/resources.js index 9acb2e375b844082503805a5f116b31c8f8be35d..0c2980e1a7a342aee6eff9fdfe02514a367b8510 100644 --- a/resources/assets/javascripts/lib/resources.js +++ b/resources/assets/javascripts/lib/resources.js @@ -292,14 +292,15 @@ class Resources //Something is wrong. return; } - let options_html = ''; + let options = []; for (let option of option_select_options) { - let splitted_option = option.split('~~'); - options_html += '<option value="' + splitted_option[0] + '">' - + (splitted_option[1] ?? splitted_option[0]) - + '</option>'; + const opt = $('<option>', { + value: option, + text: option, + }); + options.push(opt); } - $(new_criteria_select).append(options_html); + $(new_criteria_select).append(options); } else if (option_type === 'date') { let time_inputs = jQuery(new_criteria).find('input[data-time="yes"]'); let date_inputs = jQuery(new_criteria).find('input[type="date"]'); diff --git a/templates/sidebar/room-search-criteria.php b/templates/sidebar/room-search-criteria.php index 3ccaae163611eaebc93638c8e54abfde4fbed625..383068188e079cb6e7c01f222d4321fbec75a196 100644 --- a/templates/sidebar/room-search-criteria.php +++ b/templates/sidebar/room-search-criteria.php @@ -64,14 +64,11 @@ <?= htmlReady($criteria['title']) ?> <select name="<?= htmlReady($criteria['name']) ?>"> <? if (is_array($criteria['options'])): ?> - <? foreach ($criteria['options'] as $title): - $chunks = explode('--', $title, 2); - $value = $chunks[1] ?? $chunks[0]; - ?> - <option value="<?= htmlReady($value) ?>" - <?= $value == $criteria['value'] ? 'selected' : '' ?> + <? foreach ($criteria['options'] as $title): ?> + <option value="<?= htmlReady($title) ?>" + <?= $title == $criteria['value'] ? 'selected' : '' ?> > - <?= htmlReady($chunks[0]) ?> + <?= htmlReady($title) ?> </option> <? endforeach ?> <? endif ?>