angular-bootstrap-confirm
Advanced tools
Comparing version 2.0.0 to 2.1.0
{ | ||
"name": "angular-bootstrap-confirm", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"homepage": "https://github.com/mattlewis92/angular-bootstrap-confirm", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -0,1 +1,11 @@ | ||
<a name="2.1.0"></a> | ||
# [2.1.0](https://github.com/mattlewis92/angular-bootstrap-confirm/compare/2.0.0...v2.1.0) (2016-05-06) | ||
### Features | ||
* **buttons:** allow the confirm or cancel buttons to be hidden ([975f053](https://github.com/mattlewis92/angular-bootstrap-confirm/commit/975f053)), closes [#22](https://github.com/mattlewis92/angular-bootstrap-confirm/issues/22) | ||
<a name="2.0.0"></a> | ||
@@ -2,0 +12,0 @@ # [2.0.0](https://github.com/mattlewis92/angular-bootstrap-confirm/compare/1.0.1...v2.0.0) (2016-05-01) |
/** | ||
* angular-bootstrap-confirm - Displays a bootstrap confirmation popover when clicking the given element. | ||
* @version v2.0.0 | ||
* @version v2.1.0 | ||
* @link https://github.com/mattlewis92/angular-bootstrap-confirm | ||
@@ -221,3 +221,5 @@ * @license MIT | ||
focusButton: null, | ||
templateUrl: DEFAULT_POPOVER_URL | ||
templateUrl: DEFAULT_POPOVER_URL, | ||
hideConfirmButton: false, | ||
hideCancelButton: false | ||
}) | ||
@@ -238,3 +240,3 @@ | ||
module.exports = "<div class=\"popover\" ng-class=\"vm.$attrs.placement || vm.defaults.placement\">\n <div class=\"arrow\"></div>\n <h3 class=\"popover-title\" ng-bind-html=\"vm.$attrs.title\"></h3>\n <div class=\"popover-content\">\n <p ng-bind-html=\"vm.$attrs.message\"></p>\n <div class=\"row\">\n <div class=\"col-xs-6\">\n <button\n class=\"btn btn-block confirm-button\"\n ng-class=\"'btn-' + (vm.$attrs.confirmButtonType || vm.defaults.confirmButtonType)\"\n ng-click=\"vm.onConfirm(); vm.hidePopover()\"\n ng-bind-html=\"vm.$attrs.confirmText || vm.defaults.confirmText\">\n </button>\n </div>\n <div class=\"col-xs-6\">\n <button\n class=\"btn btn-block cancel-button\"\n ng-class=\"'btn-' + (vm.$attrs.cancelButtonType || vm.defaults.cancelButtonType)\"\n ng-click=\"vm.onCancel(); vm.hidePopover()\"\n ng-bind-html=\"vm.$attrs.cancelText || vm.defaults.cancelText\">\n </button>\n </div>\n </div>\n </div>\n</div>\n" | ||
module.exports = "<div class=\"popover\" ng-class=\"vm.$attrs.placement || vm.defaults.placement\">\n <div class=\"arrow\"></div>\n <h3 class=\"popover-title\" ng-bind-html=\"vm.$attrs.title\"></h3>\n <div class=\"popover-content\">\n <p ng-bind-html=\"vm.$attrs.message\"></p>\n <div class=\"row\">\n <div\n class=\"col-xs-6\"\n ng-if=\"!vm.$attrs.hideConfirmButton && !vm.defaults.hideConfirmButton\"\n ng-class=\"{'col-xs-offset-3': vm.$attrs.hideCancelButton || vm.defaults.hideCancelButton}\">\n <button\n class=\"btn btn-block confirm-button\"\n ng-class=\"'btn-' + (vm.$attrs.confirmButtonType || vm.defaults.confirmButtonType)\"\n ng-click=\"vm.onConfirm(); vm.hidePopover()\"\n ng-bind-html=\"vm.$attrs.confirmText || vm.defaults.confirmText\">\n </button>\n </div>\n <div\n class=\"col-xs-6\"\n ng-if=\"!vm.$attrs.hideCancelButton && !vm.defaults.hideCancelButton\"\n ng-class=\"{'col-xs-offset-3': vm.$attrs.hideConfirmButton || vm.defaults.hideConfirmButton}\">\n <button\n class=\"btn btn-block cancel-button\"\n ng-class=\"'btn-' + (vm.$attrs.cancelButtonType || vm.defaults.cancelButtonType)\"\n ng-click=\"vm.onCancel(); vm.hidePopover()\"\n ng-bind-html=\"vm.$attrs.cancelText || vm.defaults.cancelText\">\n </button>\n </div>\n </div>\n </div>\n</div>\n" | ||
@@ -241,0 +243,0 @@ /***/ }, |
/** | ||
* angular-bootstrap-confirm - Displays a bootstrap confirmation popover when clicking the given element. | ||
* @version v2.0.0 | ||
* @version v2.1.0 | ||
* @link https://github.com/mattlewis92/angular-bootstrap-confirm | ||
* @license MIT | ||
*/ | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("angular"),require("angular-sanitize")):"function"==typeof define&&define.amd?define(["angular","angular-sanitize"],t):"object"==typeof exports?exports.angularBootstrapConfirmModuleName=t(require("angular"),require("angular-sanitize")):n.angularBootstrapConfirmModuleName=t(n.angular,n["angular-sanitize"])}(this,function(n,t){return function(n){function t(o){if(e[o])return e[o].exports;var i=e[o]={exports:{},id:o,loaded:!1};return n[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var e={};return t.m=n,t.c=e,t.p="",t(0)}([function(n,t,e){"use strict";var o=e(1),i=e(2);e(3),e(1);var r="angular-bootstrap-confirm.html";n.exports=o.module("mwl.confirm",["ngSanitize","ui.bootstrap.position"]).run(["$templateCache",function(n){n.put(r,i)}]).controller("PopoverConfirmCtrl",["$scope","$rootScope","$element","$attrs","$compile","$document","$window","$timeout","$injector","$templateRequest","$parse","confirmationPopoverDefaults",function(n,t,e,i,r,s,a,c,l,p,u,f){function m(t,e){o.isDefined(t)&&u(t).assign(n,e)}function v(t,e){return o.isDefined(t)?u(t)(n):e}function d(){var n=B.positionElements(e,y.popover,i.placement||y.defaults.placement,!0);n.top+="px",n.left+="px",y.popover.css(n)}function b(){var n=i.focusButton||y.defaults.focusButton;if(n){var t=n+"-button";y.popover[0].getElementsByClassName(t)[0].focus()}}function $(){y.isVisible||v(i.isDisabled,!1)||(y.popover.css({display:"block"}),d(),b(),y.isVisible=!0,m(i.isOpen,!0))}function g(){y.isVisible&&(y.popover.css({display:"none"}),y.isVisible=!1,m(i.isOpen,!1))}function x(){y.isVisible?g():$(),n.$apply()}function h(t){!y.isVisible||y.popover[0].contains(t.target)||e[0].contains(t.target)||(g(),n.$apply())}var y=this;y.defaults=f,y.$attrs=i;var C=l.has("$uibPosition")?"$uibPosition":"$position",B=l.get(C),T=i.templateUrl||f.templateUrl,P=t.$new(!0);P.vm=y,p(T).then(function(n){y.popover=o.element(n),y.popover.css("display","none"),r(y.popover)(P),s.find("body").append(y.popover)}),y.isVisible=!1,y.showPopover=$,y.hidePopover=g,y.togglePopover=x,y.onConfirm=function(){v(i.onConfirm)},y.onCancel=function(){v(i.onCancel)},n.$watch(i.isOpen,function(n){c(function(){n?$():g()})}),e.bind("click",x),a.addEventListener("resize",d),s.bind("click",h),s.bind("touchend",h),n.$on("$destroy",function(){y.popover.remove(),e.unbind("click",x),a.removeEventListener("resize",d),s.unbind("click",h),s.unbind("touchend",h),P.$destroy()})}]).directive("mwlConfirm",function(){return{restrict:"A",controller:"PopoverConfirmCtrl"}}).value("confirmationPopoverDefaults",{confirmText:"Confirm",cancelText:"Cancel",confirmButtonType:"success",cancelButtonType:"default",placement:"top",focusButton:null,templateUrl:r}).name},function(t,e){t.exports=n},function(n,t){n.exports='<div class="popover" ng-class="vm.$attrs.placement || vm.defaults.placement">\n <div class="arrow"></div>\n <h3 class="popover-title" ng-bind-html="vm.$attrs.title"></h3>\n <div class="popover-content">\n <p ng-bind-html="vm.$attrs.message"></p>\n <div class="row">\n <div class="col-xs-6">\n <button\n class="btn btn-block confirm-button"\n ng-class="\'btn-\' + (vm.$attrs.confirmButtonType || vm.defaults.confirmButtonType)"\n ng-click="vm.onConfirm(); vm.hidePopover()"\n ng-bind-html="vm.$attrs.confirmText || vm.defaults.confirmText">\n </button>\n </div>\n <div class="col-xs-6">\n <button\n class="btn btn-block cancel-button"\n ng-class="\'btn-\' + (vm.$attrs.cancelButtonType || vm.defaults.cancelButtonType)"\n ng-click="vm.onCancel(); vm.hidePopover()"\n ng-bind-html="vm.$attrs.cancelText || vm.defaults.cancelText">\n </button>\n </div>\n </div>\n </div>\n</div>\n'},function(n,e){n.exports=t}])}); | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("angular"),require("angular-sanitize")):"function"==typeof define&&define.amd?define(["angular","angular-sanitize"],t):"object"==typeof exports?exports.angularBootstrapConfirmModuleName=t(require("angular"),require("angular-sanitize")):n.angularBootstrapConfirmModuleName=t(n.angular,n["angular-sanitize"])}(this,function(n,t){return function(n){function t(o){if(e[o])return e[o].exports;var i=e[o]={exports:{},id:o,loaded:!1};return n[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var e={};return t.m=n,t.c=e,t.p="",t(0)}([function(n,t,e){"use strict";var o=e(1),i=e(2);e(3),e(1);var s="angular-bootstrap-confirm.html";n.exports=o.module("mwl.confirm",["ngSanitize","ui.bootstrap.position"]).run(["$templateCache",function(n){n.put(s,i)}]).controller("PopoverConfirmCtrl",["$scope","$rootScope","$element","$attrs","$compile","$document","$window","$timeout","$injector","$templateRequest","$parse","confirmationPopoverDefaults",function(n,t,e,i,s,r,a,c,l,u,p,f){function m(t,e){o.isDefined(t)&&p(t).assign(n,e)}function d(t,e){return o.isDefined(t)?p(t)(n):e}function v(){var n=y.positionElements(e,x.popover,i.placement||x.defaults.placement,!0);n.top+="px",n.left+="px",x.popover.css(n)}function b(){var n=i.focusButton||x.defaults.focusButton;if(n){var t=n+"-button";x.popover[0].getElementsByClassName(t)[0].focus()}}function $(){x.isVisible||d(i.isDisabled,!1)||(x.popover.css({display:"block"}),v(),b(),x.isVisible=!0,m(i.isOpen,!0))}function g(){x.isVisible&&(x.popover.css({display:"none"}),x.isVisible=!1,m(i.isOpen,!1))}function h(){x.isVisible?g():$(),n.$apply()}function C(t){!x.isVisible||x.popover[0].contains(t.target)||e[0].contains(t.target)||(g(),n.$apply())}var x=this;x.defaults=f,x.$attrs=i;var B=l.has("$uibPosition")?"$uibPosition":"$position",y=l.get(B),T=i.templateUrl||f.templateUrl,P=t.$new(!0);P.vm=x,u(T).then(function(n){x.popover=o.element(n),x.popover.css("display","none"),s(x.popover)(P),r.find("body").append(x.popover)}),x.isVisible=!1,x.showPopover=$,x.hidePopover=g,x.togglePopover=h,x.onConfirm=function(){d(i.onConfirm)},x.onCancel=function(){d(i.onCancel)},n.$watch(i.isOpen,function(n){c(function(){n?$():g()})}),e.bind("click",h),a.addEventListener("resize",v),r.bind("click",C),r.bind("touchend",C),n.$on("$destroy",function(){x.popover.remove(),e.unbind("click",h),a.removeEventListener("resize",v),r.unbind("click",C),r.unbind("touchend",C),P.$destroy()})}]).directive("mwlConfirm",function(){return{restrict:"A",controller:"PopoverConfirmCtrl"}}).value("confirmationPopoverDefaults",{confirmText:"Confirm",cancelText:"Cancel",confirmButtonType:"success",cancelButtonType:"default",placement:"top",focusButton:null,templateUrl:s,hideConfirmButton:!1,hideCancelButton:!1}).name},function(t,e){t.exports=n},function(n,t){n.exports='<div class="popover" ng-class="vm.$attrs.placement || vm.defaults.placement">\n <div class="arrow"></div>\n <h3 class="popover-title" ng-bind-html="vm.$attrs.title"></h3>\n <div class="popover-content">\n <p ng-bind-html="vm.$attrs.message"></p>\n <div class="row">\n <div\n class="col-xs-6"\n ng-if="!vm.$attrs.hideConfirmButton && !vm.defaults.hideConfirmButton"\n ng-class="{\'col-xs-offset-3\': vm.$attrs.hideCancelButton || vm.defaults.hideCancelButton}">\n <button\n class="btn btn-block confirm-button"\n ng-class="\'btn-\' + (vm.$attrs.confirmButtonType || vm.defaults.confirmButtonType)"\n ng-click="vm.onConfirm(); vm.hidePopover()"\n ng-bind-html="vm.$attrs.confirmText || vm.defaults.confirmText">\n </button>\n </div>\n <div\n class="col-xs-6"\n ng-if="!vm.$attrs.hideCancelButton && !vm.defaults.hideCancelButton"\n ng-class="{\'col-xs-offset-3\': vm.$attrs.hideConfirmButton || vm.defaults.hideConfirmButton}">\n <button\n class="btn btn-block cancel-button"\n ng-class="\'btn-\' + (vm.$attrs.cancelButtonType || vm.defaults.cancelButtonType)"\n ng-click="vm.onCancel(); vm.hidePopover()"\n ng-bind-html="vm.$attrs.cancelText || vm.defaults.cancelText">\n </button>\n </div>\n </div>\n </div>\n</div>\n'},function(n,e){n.exports=t}])}); | ||
//# sourceMappingURL=angular-bootstrap-confirm.min.js.map |
{ | ||
"name": "angular-bootstrap-confirm", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Displays a bootstrap confirmation popover when clicking the given element.", | ||
@@ -52,6 +52,6 @@ "browser": "dist/angular-bootstrap-confirm.js", | ||
"karma-chai-plugins": "~0.7.0", | ||
"karma-chrome-launcher": "~0.2.0", | ||
"karma-coverage": "~0.5.1", | ||
"karma-chrome-launcher": "~1.0.1", | ||
"karma-coverage": "~1.0.0", | ||
"karma-coveralls": "~1.1.0", | ||
"karma-mocha": "~0.2.0", | ||
"karma-mocha": "~1.0.1", | ||
"karma-phantomjs-launcher": "~1.0.0", | ||
@@ -58,0 +58,0 @@ "karma-sourcemap-loader": "~0.3.5", |
@@ -28,5 +28,6 @@ # Angular bootstrap confirm | ||
The calendar has a few dependencies, these are as follows, and must be included BEFORE the plugin files: | ||
This module has a few dependencies, and must be included BEFORE the plugin files: | ||
* [AngularJS](https://angularjs.org/) 1.3+ | ||
* Angular sanitize | ||
* [Bootstrap](http://getbootstrap.com/) 3+ (CSS only - optional if you use a custom template) | ||
@@ -44,3 +45,3 @@ * [ui-bootstrap](http://angular-ui.github.io/bootstrap/) (Only the $uibPosition service is required. If you don't want to include the entire ui-bootstrap library the position service is included as a standalone file in this repo in src/ui-bootstrap-position.js) | ||
``` | ||
<script src="bower_components/angular-bootstrap-confirm/dist/angular-bootstrap-confirm.min.js"></script> | ||
<script src="bower_components/angular-bootstrap-confirm/dist/angular-bootstrap-confirm.js"></script> | ||
``` | ||
@@ -124,3 +125,3 @@ | ||
#### is-disabled | ||
Whether to disable showing the popover. Default false. | ||
Whether to disable showing the popover. Default `false`. | ||
@@ -130,2 +131,8 @@ #### template-url | ||
#### hide-confirm-button | ||
When set will hide the confirm button. | ||
#### hide-cancel-button | ||
When set will hide the cancel button. | ||
### confirmationPopoverDefaults | ||
@@ -132,0 +139,0 @@ There is also a value you can use to set the defaults like so: |
@@ -159,5 +159,7 @@ 'use strict'; | ||
focusButton: null, | ||
templateUrl: DEFAULT_POPOVER_URL | ||
templateUrl: DEFAULT_POPOVER_URL, | ||
hideConfirmButton: false, | ||
hideCancelButton: false | ||
}) | ||
.name; |
@@ -167,5 +167,5 @@ 'use strict'; | ||
var element, scope, $compile, $timeout, $document; | ||
var element, scope, $compile, $timeout, $document, confirmationPopoverDefaults; | ||
beforeEach(inject(function(_$compile_, $rootScope, _$timeout_, _$document_) { | ||
beforeEach(inject(function(_$compile_, $rootScope, _$timeout_, _$document_, _confirmationPopoverDefaults_) { | ||
scope = $rootScope.$new(); | ||
@@ -175,2 +175,3 @@ $compile = _$compile_; | ||
$document = _$document_; | ||
confirmationPopoverDefaults = _confirmationPopoverDefaults_; | ||
})); | ||
@@ -392,3 +393,3 @@ | ||
it('should allow the popover default template url to be changed', inject(function($templateCache, confirmationPopoverDefaults) { | ||
it('should allow the popover default template url to be changed', inject(function($templateCache) { | ||
var customTemplateUrl = 'my-custom-popover.html'; | ||
@@ -412,4 +413,36 @@ var customTemplate = '<div class="popover">Custom</div>'; | ||
it('should hide the confirm button', function() { | ||
var popover = createPopover('<button mwl-confirm hide-confirm-button="true">Test</button>'); | ||
expect($(popover).find('button').size()).to.equal(1); | ||
expect($(popover).find('.confirm-button').size()).to.equal(0); | ||
expect($(popover).find('.cancel-button').parent().hasClass('col-xs-offset-3')).to.be.true; | ||
}); | ||
it('should hide the confirm button when configured globally', function() { | ||
confirmationPopoverDefaults.hideConfirmButton = true; | ||
var popover = createPopover('<button mwl-confirm>Test</button>'); | ||
expect($(popover).find('button').size()).to.equal(1); | ||
expect($(popover).find('.confirm-button').size()).to.equal(0); | ||
expect($(popover).find('.cancel-button').parent().hasClass('col-xs-offset-3')).to.be.true; | ||
confirmationPopoverDefaults.hideConfirmButton = false; | ||
}); | ||
it('should hide the cancel button', function() { | ||
var popover = createPopover('<button mwl-confirm hide-cancel-button="true">Test</button>'); | ||
expect($(popover).find('button').size()).to.equal(1); | ||
expect($(popover).find('.cancel-button').size()).to.equal(0); | ||
expect($(popover).find('.confirm-button').parent().hasClass('col-xs-offset-3')).to.be.true; | ||
}); | ||
it('should hide the cancel button when configured globally', function() { | ||
confirmationPopoverDefaults.hideCancelButton = true; | ||
var popover = createPopover('<button mwl-confirm>Test</button>'); | ||
expect($(popover).find('button').size()).to.equal(1); | ||
expect($(popover).find('.cancel-button').size()).to.equal(0); | ||
expect($(popover).find('.confirm-button').parent().hasClass('col-xs-offset-3')).to.be.true; | ||
confirmationPopoverDefaults.hideCancelButton = false; | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90350
1060
183
2