diff options
Diffstat (limited to 'www/crm/wp-content/plugins/civicrm/civicrm/bower_components/angular-jquery-dialog-service/app.js')
-rw-r--r-- | www/crm/wp-content/plugins/civicrm/civicrm/bower_components/angular-jquery-dialog-service/app.js | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/www/crm/wp-content/plugins/civicrm/civicrm/bower_components/angular-jquery-dialog-service/app.js b/www/crm/wp-content/plugins/civicrm/civicrm/bower_components/angular-jquery-dialog-service/app.js new file mode 100644 index 00000000..2a2e1bd8 --- /dev/null +++ b/www/crm/wp-content/plugins/civicrm/civicrm/bower_components/angular-jquery-dialog-service/app.js @@ -0,0 +1,87 @@ +var app = angular.module('dialogApp', ['dialogService']); + +app.controller('buttonCtrl', ['$scope', '$log', 'dialogService', + function($scope, $log, dialogService) { + + $scope.openFromScriptClick = function() { + doDialog("template-from-script.html"); + }; + + $scope.openFromUrlClick = function() { + doDialog("template-from-url.html"); + }; + + function doDialog(template) { + + // The data for the dialog + var model = { + firstName: "Jason", + lastName: "Stadler" + }; + + // jQuery UI dialog options + var options = { + autoOpen: false, + modal: true, + close: function(event, ui) { + $log.debug("Predefined close"); + } + }; + + // Open the dialog using template from script + dialogService.open("myDialog", template, model, options).then( + function(result) { + $log.debug("Close"); + $log.debug(result); + }, + function(error) { + $log.debug("Cancelled"); + } + ); + + } + } +]); + +app.controller('dialogCtrl', ['$scope', 'dialogService', + function($scope, dialogService) { + + // $scope.model contains the object passed to open in config.model + + $scope.saveClick = function() { + dialogService.close("myDialog", $scope.model); + }; + + $scope.cancelClick = function() { + dialogService.cancel("myDialog"); + }; + + $scope.confirmClick = function() { + // Open another dialog here + dialogService.open("myConfirm", "confirmTemplate.html") + .then( + function(result) { + console.log("Confirm"); + }, + function(error) { + console.log("Cancel"); + } + ); + }; + + } +]); + +app.controller('confirmCtrl', ['$scope', 'dialogService', + function($scope, dialogService) { + + $scope.confirmClick = function() { + dialogService.close("myConfirm"); + }; + + $scope.cancelClick = function() { + dialogService.cancel("myConfirm"); + }; + + } +]); |