#63729API for twbs modals
Description
Bootstrap brings modal to us. That’s nice, but currently hard to implement in the TYPO3 backend.
We need an API to create modals easiliy, similar to our Flashmessages.
Example:
TYPO3.Modal({
title: 'Fnord',
closable: false,
severity: TYPO3.Severity.ok
content: '<p>I\'m a content, I contain content.</p>',
actions = [
{
text: 'Login',
trigger: TYPO3.Loginrefresh.triggerSubmit()
}, {
text: 'No, log out.',
trigger: TYPO3.Loginrefresh.logout()
}
]
});
This call would return the generated modal. You may need it to do things with the modal, the API does not provide (yet).
.show() displays the modal directly.
- title* (string): The header displayed in the top bar of the modal
- content* (string): The content (duh!) in the modal body
- closable (bool): Marks the modal as closable. Default:
true - severity (int): Marks the severity of the modal and draws a left border. Default:
TYPO3.Severity.info(-1) - actions (array): The action buttons rendered into the modal footer. If empty or undefined, the footer is not rendered
A minimal API call would look like this:
TYPO3.Modal({
title: 'Fnord',
content: '<p>I\'m a content, I contain content.</p>',
}).show();
Some thoughts:
- Generated modals are kept in the DOM, so they don’t need to be created again if they are needed.
- To avoid bloating the DOM, we just keep the ten(?) latest modals
- Make sure modals are attached to window.top, not the frame that calls it (Kudos to Kay Strobach)