From a82d268124ca51ae601514a4e8a9634a1c1d75de Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Thu, 29 Feb 2024 13:32:46 +0000 Subject: [PATCH] fixes #3767 Closes #3767 Merge request studip/studip!2642 --- resources/assets/javascripts/lib/resources.js | 13 +++++++------ templates/sidebar/room-search-criteria.php | 11 ++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/resources/assets/javascripts/lib/resources.js b/resources/assets/javascripts/lib/resources.js index 9acb2e375b8..0c2980e1a7a 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 3ccaae16361..383068188e0 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 ?> -- GitLab