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 support for rendering a single footer button.

Ganesh Pawar14b07669cc34
diff --git a/static/js/dialog_widget.js b/static/js/dialog_widget.js
index 41ea56ee93e..5aa12f83b8a 100644
--- a/static/js/dialog_widget.js
+++ b/static/js/dialog_widget.js
@@ -79,6 +79,7 @@ export function launch(conf) {
// * focus_submit_on_open: Whether to focus submit button on open.
// * help_link: A help link in the heading area.
// * id: Custom id to the container element to modify styles.
+ // * single_footer_button: If true, don't include the "Cancel" button.
for (const f of mandatory_fields) {
if (conf[f] === undefined) {
@@ -99,6 +100,7 @@ export function launch(conf) {
html_submit_button,
html_body: conf.html_body,
id: conf.id,
+ single_footer_button: conf.single_footer_button,
});
const dialog = $(html);
$("body").append(dialog);
diff --git a/static/templates/dialog_widget.hbs b/static/templates/dialog_widget.hbs
index a848c945bce..876038426da 100644
--- a/static/templates/dialog_widget.hbs
+++ b/static/templates/dialog_widget.hbs
@@ -15,8 +15,10 @@
{{{ html_body }}}
</main>
<footer class="modal__footer">
+ {{#unless single_footer_button}}
<button class="modal__btn dialog_cancel_button" aria-label="{{t 'Close this dialog window' }}" data-micromodal-close>{{t "Cancel" }}</button>
- <button class="modal__btn dialog_submit_button">
+ {{/unless}}
+ <button class="modal__btn dialog_submit_button"{{#if single_footer_button}} aria-label="{{t 'Close this dialog window' }}" data-micromodal-close{{/if}}>
<span>{{{ html_submit_button }}}</span>
<div class="modal__spinner"></div>
</button>