Skip to content
Snippets Groups Projects
Commit e0939561 authored by florian's avatar florian
Browse files

ENH: Add function for creating a form modal HTML element

parent cea7829f
No related branches found
No related tags found
2 merge requests!103Quick main-release of documentation,!97F form helpers
......@@ -1563,6 +1563,37 @@ var form_elements = new function () {
}
}
/**
* Return a modal HTML element containing the given form.
*
* @param {HTMLElement} form - the form to be shown in the modal
* @param {string} title - the title of the form modal
* @param {string} explanation_text - An optional paragraph shown between
* modal title and form.
*/
this.make_for_modal = function (form, title, explanation_text) {
const modal = $(`
<div class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">${title}</h4>
<p>{explanation_text}</p>
<button type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close">
</button>
</div>
<div class="modal-body">
</div>
</div>
</div>`);
modal.find(".modal-body").append(form);
return modal[0];
}
/**
* Return an input and a label, wrapped in a div with class
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment