Skip to content

confirm

pierr edited this page Sep 12, 2014 · 9 revisions

How to realize a confirmation popin

Simple use case

In order to create a confirm popup, you have to use the messageHelper from the Framework.

Fmk.Helpers.messageHelper
           .confirm("message.key")
           .then(
             function(success){console.info("OK", success)},
             function(err){console.error('error', err)}
);

As you see in the code, the return type is a promise, you just have register success and error handler in order to deal with the treatment.

Initialization

This part should be done only by the person which is responbible of the application technical aspects.
In order to use it, you must initialize the component in the application (only once).

  • First, create a container in the html layout of the application.
<div id="modalConfirmContainer"></div>
  • Then, the helper has an initialize method. Fmk.Helpers.messageHelper.initialize().

Example call: in the _application.js_ ```javascript Application.prototype.initialize = function() { this.on("initialize:after", (function(_this) { return function(options) { Fmk.Helpers.messageHelper.initialize(); Backbone.history.start({ root: config.approot }); return typeof Object.freeze === "function" ? Object.freeze(_this) : void 0; }; })(this)); ```

Customization of the confirm

Clone this wiki locally