forked from Coded/SIPRP
				
			
			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.
		
		
		
		
		
			
		
			
				
					
					
						
							80 lines
						
					
					
						
							1.8 KiB
						
					
					
				
			
		
		
	
	
							80 lines
						
					
					
						
							1.8 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
 | |
|         });
 | |
|     };
 | |
| 
 | |
|     return {
 | |
|         confirm: confirm,
 | |
|         alert: alert,
 | |
|         custom: custom
 | |
|     };
 | |
| });
 |