Skip to content
Beecher edited this page Sep 29, 2015 · 3 revisions

Confirm / Prompt

  • Based on the window.confirm method, but with greater styling and functional possibilities.

  • We're using a "yarp/narp" convention instead of "confirm/cancel".

  • Specify button text like (defaults to 'confirm' and 'cancel'):

var confrimArgs = {
   yarp : {
   	text: "the confirm button text",
   	disabled: true // optional
   },
   narp : { 
   	text: { // if you want translations
   		"en" : "cancel in english",
   		"es" : "como se dice, 'cancel'?"
   	}
   }
};

// then you'd pass it to the show method like
_mb.show({
   body: "whatever?",
   confirm: confrimArgs
});
  • Specify functionality within the callbacks 'yarp' and 'narp' :
var confirmAction = function(_mb) {
   // whatver you want, really ...
},
cancelAction = function(_mb) {
   // whatver you want, really ...
};

_mb.show({
   	body: "whatever?",
   	callbacks: {
   		yarp : confirmAction,
   		narp : cancelAction
   	}
   });

Clone this wiki locally