Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

dialog_widget: Add option to show non-html heading.

Aman Agrawal0930cc4cecc3
diff --git a/web/src/dialog_widget.ts b/web/src/dialog_widget.ts
index 904a19f7d61..d10a72e4781 100644
--- a/web/src/dialog_widget.ts
+++ b/web/src/dialog_widget.ts
@@ -59,7 +59,8 @@ function current_dialog_widget_selector(): string {
*/
export type DialogWidgetConfig = {
- html_heading: string;
+ html_heading?: string;
+ text_heading?: string;
html_body: string;
on_click: (e: JQuery.ClickEvent) => void;
html_submit_button?: string;
@@ -136,7 +137,7 @@ export function get_current_values($inputs: JQuery): Record<string, unknown> {
export function launch(conf: DialogWidgetConfig): string {
// Mandatory fields:
- // * html_heading
+ // * html_heading | text_heading
// * html_body
// * on_click
// The html_ fields should be safe HTML. If callers
@@ -172,7 +173,8 @@ export function launch(conf: DialogWidgetConfig): string {
const html_exit_button = conf.html_exit_button ?? $t_html({defaultMessage: "Cancel"});
const html = render_dialog_widget({
modal_unique_id,
- heading_text: conf.html_heading,
+ html_heading: conf.html_heading,
+ text_heading: conf.text_heading,
link: conf.help_link,
html_submit_button,
html_exit_button,
diff --git a/web/templates/dialog_widget.hbs b/web/templates/dialog_widget.hbs
index 12a40e95847..cdc01c1ad70 100644
--- a/web/templates/dialog_widget.hbs
+++ b/web/templates/dialog_widget.hbs
@@ -3,7 +3,11 @@
<div {{#if id}}id="{{id}}" {{/if}}class="modal__container" role="dialog" aria-modal="true" aria-labelledby="dialog_title">
<header class="modal__header">
<h1 class="modal__title dialog_heading">
- {{{ heading_text }}}
+ {{#if html_heading}}
+ {{{ html_heading }}}
+ {{else}}
+ {{ text_heading }}
+ {{/if}}
{{#if link}}
{{> help_link_widget . }}
{{/if}}