You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 3 Next »
In package.json, turn includeModal:'true'
includeModal:'true'
Using modal dialogs is a common design pattern with core apps. This helper does most of the work for you, including AODA compliance.
The method below is a static method of the cot_app (if your app is standalone) or CotApp (if your app is embedded) class.
Use it like this:
CotApp.showModal(options); //embedded apps cot_app.showModal(options); //standalone apps
preset
string Optional.
Loads template.
Default is false.
false
Possible values are 'confirm' or 'alert'
'confirm'
'alert'
title
String
Title of the modal. Accepts HTML
title: <h2>This is my modal</h2>,
body
Body of the modal. Accepts HTML
zoom
modalSize
Set the default bootstrap size of the modal. Possible values : 'modal-sm', 'modal-lg'
modalSize:'modal-lg'
originatingElement
String Required
An element (DOM or $-selected) to set focus to after the modal is closed, use for accessibility
originatingElement: $('#myButton')
className
String Optional,
CSS class to put on the root div.modal element
className: 'myCustomClass
bootstrapType
When preset='alert', sets a bootstrap alert class to the modal.
Default is 'default'.
Possible values are 'primary' 'success''info' 'warning' 'danger'
'primary'
'success'
'info'
'warning'
'danger'
callback
Function Required
if preset='confirm'. Callback function when user confirms the message
buttons
Object Optional.
When preset='confirm' will change the buttons content and class
buttons: { cancel: { label: ' Cancel', bootstrapType: 'default' }, confirm: { label: ' Confirm', bootstrapType: 'primary' } }
onShow
Function
Hook into boostrap modal events
onShown
onHide
onHidden
CotApp.showModal({ originatingElement:$('#target_to_focus_when_modal_close'), title: "This is the title", body: "<p>Content goes here</p><p>Include <strong>HTML</strong> if you <em>want</em></p>", modalSize: "modal-lg" })
Page Tree