3 changed files with 45 additions and 46 deletions
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
/* |
||||
angular-dialog-service |
||||
https://github.com/m-e-conroy/angular-dialog-service/
|
||||
|
||||
Copyright (c) 2013 Michael E Conroy |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of |
||||
this software and associated documentation files (the "Software"), to deal in |
||||
the Software without restriction, including without limitation the rights to |
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
||||
the Software, and to permit persons to whom the Software is furnished to do so, |
||||
subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||||
|
||||
Version: 3.0 - 2014-01-27 |
||||
*/ |
||||
angular.module("dialogs.controllers",["ui.bootstrap.modal"]).controller("errorDialogCtrl",["$scope","$modalInstance","header","msg",function(o,n,e,a){o.header=angular.isDefined(e)?e:"Error",o.msg=angular.isDefined(a)?a:"An unknown error has occurred.",o.close=function(){n.close()}}]).controller("waitDialogCtrl",["$scope","$modalInstance","$timeout","header","msg","progress",function(o,n,e,a,t,r){o.header=angular.isDefined(a)?a:"Please Wait...",o.msg=angular.isDefined(t)?t:"Waiting on operation to complete.",o.progress=angular.isDefined(r)?r:100,o.$on("dialogs.wait.complete",function(){e(function(){n.close()})}),o.$on("dialogs.wait.message",function(n,e){o.msg=angular.isDefined(e.msg)?e.msg:o.msg}),o.$on("dialogs.wait.progress",function(n,e){o.msg=angular.isDefined(e.msg)?e.msg:o.msg,o.progress=angular.isDefined(e.progress)?e.progress:o.progress}),o.getProgress=function(){return{width:o.progress+"%"}}}]).controller("notifyDialogCtrl",["$scope","$modalInstance","header","msg",function(o,n,e,a){o.header=angular.isDefined(e)?e:"Notification",o.msg=angular.isDefined(a)?a:"Unknown application notification.",o.close=function(){n.close()}}]).controller("confirmDialogCtrl",["$scope","$modalInstance","header","msg",function(o,n,e,a){o.header=angular.isDefined(e)?e:"Confirmation",o.msg=angular.isDefined(a)?a:"Confirmation required.",o.no=function(){n.dismiss("no")},o.yes=function(){n.close("yes")}}]),angular.module("dialogs.services",["ui.bootstrap.modal","dialogs.controllers"]).factory("$dialogs",["$modal",function(o){return{error:function(n,e){return o.open({templateUrl:"/dialogs/error.html",controller:"errorDialogCtrl",resolve:{header:function(){return angular.copy(n)},msg:function(){return angular.copy(e)}}})},wait:function(n,e,a){return o.open({templateUrl:"/dialogs/wait.html",controller:"waitDialogCtrl",resolve:{header:function(){return angular.copy(n)},msg:function(){return angular.copy(e)},progress:function(){return angular.copy(a)}}})},notify:function(n,e){return o.open({templateUrl:"/dialogs/notify.html",controller:"notifyDialogCtrl",resolve:{header:function(){return angular.copy(n)},msg:function(){return angular.copy(e)}}})},confirm:function(n,e){return o.open({templateUrl:"/dialogs/confirm.html",controller:"confirmDialogCtrl",resolve:{header:function(){return angular.copy(n)},msg:function(){return angular.copy(e)}}})},create:function(n,e,a,t){var r=angular.isDefined(t.keyboard)?t.keyboard:!0,s=angular.isDefined(t.backdrop)?t.backdrop:!0,l=angular.isDefined(t.windowClass)?t.windowClass:"dialogs-default";return o.open({templateUrl:n,controller:e,keyboard:r,backdrop:s,windowClass:l,resolve:{data:function(){return angular.copy(a)}}})}}}]),angular.module("dialogs",["dialogs.services","ngSanitize"]).run(["$templateCache",function(o){o.put("/dialogs/error.html",'<div class="modal-header dialog-header-error"><button type="button" class="close" ng-click="close()">×</button><h4 class="modal-title text-danger"><span class="glyphicon glyphicon-warning-sign"></span> <span ng-bind-html="header"></span></h4></div><div class="modal-body text-danger" ng-bind-html="msg"></div><div class="modal-footer"><button type="button" class="btn btn-default" ng-click="close()">Close</button></div>'),o.put("/dialogs/wait.html",'<div class="modal-header dialog-header-wait"><h4 class="modal-title"><span class="glyphicon glyphicon-time"></span> Please Wait</h4></div><div class="modal-body"><p ng-bind-html="msg"></p><div class="progress progress-striped active"><div class="progress-bar progress-bar-info" ng-style="getProgress()"></div><span class="sr-only">{{progress}}% Complete</span></div></div>'),o.put("/dialogs/notify.html",'<div class="modal-header dialog-header-notify"><button type="button" class="close" ng-click="close()" class="pull-right">×</button><h4 class="modal-title text-info"><span class="glyphicon glyphicon-info-sign"></span> {{header}}</h4></div><div class="modal-body text-info" ng-bind-html="msg"></div><div class="modal-footer"><button type="button" class="btn btn-primary" ng-click="close()">OK</button></div>'),o.put("/dialogs/confirm.html",'<div class="modal-header dialog-header-confirm"><button type="button" class="close" ng-click="no()">×</button><h4 class="modal-title"><span class="glyphicon glyphicon-check"></span> {{header}}</h4></div><div class="modal-body" ng-bind-html="msg"></div><div class="modal-footer"><button type="button" class="btn btn-default" ng-click="yes()">Yes</button><button type="button" class="btn btn-primary" ng-click="no()">No</button></div>')}]); |
Loading…
Reference in new issue