diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-02-29 13:32:46 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-02-29 13:32:46 +0000 |
| commit | a82d268124ca51ae601514a4e8a9634a1c1d75de (patch) | |
| tree | b1f12cc7df4031381ed16afb2e3e45785bf49a31 | |
| parent | 7d4e4ca61887815b37b1d20d6b2336ce97e9083f (diff) | |
fixes #3767
Closes #3767
Merge request studip/studip!2642
| -rw-r--r-- | resources/assets/javascripts/lib/resources.js | 13 | ||||
| -rw-r--r-- | 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 9acb2e3..0c2980e 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 3ccaae1..3830681 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 ?> |
