You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.2 KiB

//creates prompt messages
evoapp.factory('message', function($rootScope) {
//http://bootboxjs.com/#examples
//TODO: pass this to global utils!!! there's another one in DataService!!!
//pass specified values to specified function arguments
function callback(fn, args) {
var fnArgs = [].concat(args);
fnArgs.push.apply(fnArgs, arguments);
return fn.apply(this, fnArgs);
};
//globals.message.confirm({
// question: 'your message here',
// answer: function(result){
// if(result)
// {
// }
// }
//});
var confirm = function(){
var me = this;
var question = arguments[0].question,
answerFn = arguments[0].answer;
bootbox.confirm(question, function(result) {
callback(answerFn, [result]);
});
};
//globals.message.alert({
// message: 'your message here',
// callback: function(){
// }
//});
var alert = function(){
var me = this;
var message = arguments[0].message,
callbackFn = arguments[0].callback;
bootbox.alert(message, function() {
callback(callbackFn, [null]);
});
};
var custom = function(){
var me = this;
var message = arguments[0].message,
title = arguments[0].title,
buttons = arguments[0].buttons;
bootbox.dialog({
message: message,
buttons: buttons
});
};
// var custom2 = function(){
//
// var me = this;
//
// var message = arguments[0].message,
// title = arguments[0].title,
// buttons = arguments[0].buttons;
//
// me.show = function(){
//
// bootbox.dialog({
// message: message,
// buttons: buttons
// });
// };
//
// return me;
// };
return {
confirm: confirm,
alert: alert,
custom: custom
};
});