dialog_widget: Add support for rendering a single footer button.

This commit is contained in:
Ganesh Pawar 2021-07-18 17:50:59 +05:30 committed by Tim Abbott
parent c429c5d70e
commit 14b07669cc
2 changed files with 5 additions and 1 deletions

View File

@ -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);

View File

@ -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>