[cmsassets_domain]/javascript/modal.js (require bootstrap, bootstrap.js and jQuery) provides a few methods for managing modals and confirm dialogs in the UI:

Creating a modal

Modals can be created using the following code:

InvModal.showModal({
    title: 'text for title bar' ,
    content: '<p>Put the HTML content for your modal here</p>' ,
    footer: true , //BOOL - defaults to true - are you showing a footer with cancel / save buttons in it?
    closebutton: true , //BOOL default to true - are you showing aclose button in the top right of the modal?
    savebuttonlabel: 'Button Text' ,    // The text to put on the "Save" / "Yes" button in the bottom right
    success: function(){ 
       // This is the event that will be fired when the user hits the "save" button
       // If you leave this undefined, the default behaviour is to return true and close the modal
       alert('here');
       // This would normally have a modalClose call in it. But not necessarily!
       InvModal.closeModal();
       return true;
    }
    close: function(){
        // Optional. This function will be triggered if the modal is closed.
    }
});

Confirm dialogs.

Confirm dialogs can be generated in one of 2 ways:

Manually generated:

InvModal.confirm('<p>Are you sure you want to delete this record?</p>' , '/path/to/url');

The first argument above is the message to be displayed, the second is the URL to continue to after the confirm "Yes" button has been hit.

Auto generated:

You can also generate a confirm dialog on a link by adding the class "confirm" and the attribute "data-confirmmessage="" to it. For example:

<a href="/portal/deletethingy" class="btn confirm" data-confirmmessage="Are  you sure you want to do this?">Delete</a>

Contact Us

Address: 22a Fishergate York, YO10 4AB · Tel: 01904 636677 · Email: info@dotadmin.com