mirror of
https://github.com/zulip/zulip.git
synced 2026-07-09 21:21:47 +08:00
We extract a general purpose widget to create dropdown lists with
search. This widget is used for default code block language, but can
be easily extended to cover notifications_stream and similar options.
The current usage is:
```js
const widget = DropdownListWidget({
setting_name: 'realm_alpha_beta',
data: [{name: 'hello', value: 'world'}, {...}, ...],
subsection: 'msg-editing',
default_text: 'Nothing is selected',
});
```
and
```handlebars
{{> dropdown_list_widget
setting_name="realm_alpha_beta"
list_placeholder=(t 'Filter the data')
reset_button_text=(t '[Unset]')
label=admin_settings_label.realm_alpha_beta }}
```
This can further be refined by shifting more variables from handlebars
to javascript in the future.
8 lines
160 B
Handlebars
8 lines
160 B
Handlebars
{{#with item}}
|
|
<li class="list_item" role="presentation" data-value="{{value}}">
|
|
<a role="menuitem" tabindex="0">
|
|
{{name}}
|
|
</a>
|
|
</li>
|
|
{{/with}}
|