SmartAdmin is a responsive admin theme which uses Bootstrap made by Myorange.
This doc will help you to add new features in the back office and respect its general design.
smartConfirm function allows to display a confirmation message.
It uses the
SmartMessageBox function of component SmartNotification.
It is called during various events like the deleting of an item (nodes, blocks, contents, ...).
A confirmation message is composed of a logo, a title, a description and two buttons (Yes/No).
smartConfirm takes 4 parameters:
- the logo css class.
- the message title.
- the message description.
- an array of callback functions to be called when buttons are clicked and the parameters of callbacks functions.
The array must contain three keys
which refer respectively to the functions managing the click event on Yes and No buttons.
callBackParams is an array which contains the parameters for callbacks functions.
SmartConfirm uses two templates, one for buttons (
smartConfirmButton._tpl.twig) and another
to display the logo and the title (
The title does not need to include a question mark as the template adds one at the end of it.
The translation of the buttons is done with the translation component of Symfony in the template.
For title and description, they must be translated before being passed to the
smartConfirm function .
This example in coffeeScript show a confirmation message.
confirm_text contains the translated title and the translated description:
smartConfirm( 'fa-trash-o', confirm_title, confirm_text, callBackParams: url: url yesCallback: (params) -> $.ajax url: params.url method: 'DELETE' success: (response) -> if redirectUrl != undefined displayMenu(redirectUrl) else redirectUrl = appRouter.generateUrl 'showDashboard' displayMenu(redirectUrl) return error: (response) -> $('.modal-footer', this.el).html response.responseJSON.error.message return noCallback: -> $("#OrchestraBOModal").modal "show" )