Add option group type to notifier and newsletter config modal

This commit is contained in:
JonnyWong16 2021-06-30 17:43:48 -07:00
parent 741f3d836a
commit 15c7212031
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 14 additions and 6 deletions

View file

@ -326,10 +326,14 @@
<div class="col-md-12">
<select class="form-control" id="${item['name']}" name="${item['name']}">
% for key, value in sorted(item['select_options'].items()):
% if key == item['value']:
<option value="${key}" selected>${value}</option>
% if isinstance(value, list):
<optgroup label="${key}">
% for option in sorted(value, key=lambda x: x['text'].lower()):
<option value="${option['value']}" ${'selected' if option['value'] == item['value'] else ''}>${option['text']}</option>
% endfor
</optgroup>
% else:
<option value="${key}">${value}</option>
<option value="${key}" ${'selected' if key == item['value'] else ''}>${value}</option>
% endif
% endfor
</select>

View file

@ -113,10 +113,14 @@
<div class="col-md-12">
<select class="form-control" id="${item['name']}" name="${item['name']}">
% for key, value in sorted(item['select_options'].items()):
% if key == item['value']:
<option value="${key}" selected>${value}</option>
% if isinstance(value, list):
<optgroup label="${key}">
% for option in sorted(value, key=lambda x: x['text'].lower()):
<option value="${option['value']}" ${'selected' if option['value'] == item['value'] else ''}>${option['text']}</option>
% endfor
</optgroup>
% else:
<option value="${key}">${value}</option>
<option value="${key}" ${'selected' if key == item['value'] else ''}>${value}</option>
% endif
% endfor
</select>