mirror of
https://github.com/zulip/zulip.git
synced 2025-10-22 20:42:14 +00:00
dropdown-list-widget: Allow customization for "Disable" option.
We currently always show fa-ban icon and "Disable" text for "Disabled" or "None selected" option in dropdown-list widget. This commit adds code to provide an option for not showing the fa-ban icon and having the option text be something other than "Disable". This will be used in channel folder dropdown widget where we want to have "None" text in the option without icon.
This commit is contained in:
@@ -1121,6 +1121,8 @@ export let init_dropdown_widgets = (): void => {
|
||||
|
||||
const disabled_option = {
|
||||
is_setting_disabled: true,
|
||||
show_disabled_icon: true,
|
||||
show_disabled_option_name: false,
|
||||
unique_id: DISABLED_STATE_ID,
|
||||
name: $t({defaultMessage: "Disabled"}),
|
||||
};
|
||||
@@ -1169,6 +1171,8 @@ export const combined_code_language_options = (): dropdown_widget.Option[] => {
|
||||
|
||||
const disabled_option = {
|
||||
is_setting_disabled: true,
|
||||
show_disabled_icon: true,
|
||||
show_disabled_option_name: false,
|
||||
unique_id: "",
|
||||
name: $t({defaultMessage: "No language set"}),
|
||||
};
|
||||
|
@@ -26,7 +26,16 @@
|
||||
{{else if is_direct_message}}
|
||||
<i class="zulip-icon zulip-icon-users channel-privacy-type-icon"></i> <span class="decorated-dm-name">{{name}}</span>
|
||||
{{else if is_setting_disabled}}
|
||||
<span class="setting-disabled-option"><i class="setting-disabled-option-icon fa fa-ban" aria-hidden="true"></i>{{t "Disable" }}</span>
|
||||
<span class="setting-disabled-option">
|
||||
{{#if show_disabled_icon}}
|
||||
<i class="setting-disabled-option-icon fa fa-ban" aria-hidden="true"></i>
|
||||
{{/if}}
|
||||
{{#if show_disabled_option_name}}
|
||||
{{name}}
|
||||
{{else}}
|
||||
{{t "Disable" }}
|
||||
{{/if}}
|
||||
</span>
|
||||
{{else}}
|
||||
{{#if bold_current_selection}}
|
||||
<span class="dropdown-list-bold-selected">{{name}}</span>
|
||||
|
@@ -718,7 +718,13 @@ test("test combined_code_language_options", ({override}) => {
|
||||
}));
|
||||
|
||||
const expected_options_without_realm_playgrounds = [
|
||||
{is_setting_disabled: true, unique_id: "", name: $t({defaultMessage: "No language set"})},
|
||||
{
|
||||
is_setting_disabled: true,
|
||||
unique_id: "",
|
||||
name: $t({defaultMessage: "No language set"}),
|
||||
show_disabled_icon: true,
|
||||
show_disabled_option_name: false,
|
||||
},
|
||||
...default_options,
|
||||
];
|
||||
|
||||
@@ -731,7 +737,13 @@ test("test combined_code_language_options", ({override}) => {
|
||||
]);
|
||||
|
||||
const expected_options_with_realm_playgrounds = [
|
||||
{is_setting_disabled: true, unique_id: "", name: $t({defaultMessage: "No language set"})},
|
||||
{
|
||||
is_setting_disabled: true,
|
||||
unique_id: "",
|
||||
name: $t({defaultMessage: "No language set"}),
|
||||
show_disabled_icon: true,
|
||||
show_disabled_option_name: false,
|
||||
},
|
||||
{unique_id: "custom_lang_1", name: "custom_lang_1"},
|
||||
{unique_id: "custom_lang_2", name: "custom_lang_2"},
|
||||
...default_options,
|
||||
|
Reference in New Issue
Block a user