diff --git a/README.md b/README.md
index 095036a..76d871e 100644
--- a/README.md
+++ b/README.md
@@ -190,6 +190,30 @@ app.controller("demoCtrl", ['$scope', 'growl', function($scope, growl) {
}]);
````
+###Disable close button on messages
+
+* Default: false
+
+Turn this on to hide the close button on messages, default behaviour is to display the close button.
+
+````javascript
+var app = angular.module('myApp', ['angular-growl']);
+
+app.config(['growlProvider', function(growlProvider) {
+ growlProvider.globalDisableCloseButton(true);
+}]);
+````
+
+You can override the global option and hide the close button in single messages too:
+
+````javascript
+app.controller("demoCtrl", ['$scope', 'growl', function($scope, growl) {
+ $scope.addSpecialWarnMessage = function() {
+ growl.addWarnMessage("This is a message without a close button", {disableCloseButton: true});
+ }
+}]);
+````
+
###Animations
Beginning with angularJS 1.2 growl messages can be automatically animated with CSS animations when adding and/or closing
diff --git a/build/angular-growl.js b/build/angular-growl.js
index e461296..63644bc 100644
--- a/build/angular-growl.js
+++ b/build/angular-growl.js
@@ -1,7 +1,7 @@
/**
- * angular-growl - v0.4.0 - 2013-11-19
+ * angular-growl - v0.4.0 - 2014-03-12
* https://github.com/marcorinck/angular-growl
- * Copyright (c) 2013 Marco Rinck; Licensed MIT
+ * Copyright (c) 2014 Marco Rinck; Licensed MIT
*/
angular.module('angular-growl', []);
angular.module('angular-growl').directive('growl', [
@@ -10,7 +10,7 @@ angular.module('angular-growl').directive('growl', [
'use strict';
return {
restrict: 'A',
- template: '
',
+ template: '',
replace: false,
scope: true,
controller: [
@@ -65,13 +65,16 @@ angular.module('angular-growl').directive('growl', [
]);
angular.module('angular-growl').provider('growl', function () {
'use strict';
- var _ttl = null, _enableHtml = false, _messagesKey = 'messages', _messageTextKey = 'text', _messageSeverityKey = 'severity', _onlyUniqueMessages = true;
+ var _ttl = null, _enableHtml = false, _messagesKey = 'messages', _messageTextKey = 'text', _messageSeverityKey = 'severity', _onlyUniqueMessages = true, _disableCloseButton = false;
this.globalTimeToLive = function (ttl) {
_ttl = ttl;
};
this.globalEnableHtml = function (enableHtml) {
_enableHtml = enableHtml;
};
+ this.globalDisableCloseButton = function (disableCloseButton) {
+ _disableCloseButton = disableCloseButton;
+ };
this.messagesKey = function (messagesKey) {
_messagesKey = messagesKey;
};
@@ -127,7 +130,8 @@ angular.module('angular-growl').provider('growl', function () {
text: text,
severity: severity,
ttl: _config.ttl || _ttl,
- enableHtml: _config.enableHtml || _enableHtml
+ enableHtml: _config.enableHtml || _enableHtml,
+ disableCloseButton: _config.disableCloseButton || _disableCloseButton
};
broadcastMessage(message);
}
diff --git a/build/angular-growl.min.css b/build/angular-growl.min.css
index e1ed842..2961fdc 100644
--- a/build/angular-growl.min.css
+++ b/build/angular-growl.min.css
@@ -1,7 +1,7 @@
/**
- * angular-growl - v0.4.0 - 2013-11-19
+ * angular-growl - v0.4.0 - 2014-03-12
* https://github.com/marcorinck/angular-growl
- * Copyright (c) 2013 Marco Rinck; Licensed MIT
+ * Copyright (c) 2014 Marco Rinck; Licensed MIT
*/
.growl{position:fixed;top:10px;right:10px;float:right;width:250px}.growl-item.ng-enter,.growl-item.ng-leave{-webkit-transition:.5s linear all;-moz-transition:.5s linear all;-o-transition:.5s linear all;transition:.5s linear all}.growl-item.ng-enter,.growl-item.ng-leave.ng-leave-active{opacity:0}.growl-item.ng-leave,.growl-item.ng-enter.ng-enter-active{opacity:1}
\ No newline at end of file
diff --git a/build/angular-growl.min.js b/build/angular-growl.min.js
index 83798c5..c7803ec 100644
--- a/build/angular-growl.min.js
+++ b/build/angular-growl.min.js
@@ -1,6 +1,6 @@
/**
- * angular-growl - v0.4.0 - 2013-11-19
+ * angular-growl - v0.4.0 - 2014-03-12
* https://github.com/marcorinck/angular-growl
- * Copyright (c) 2013 Marco Rinck; Licensed MIT
+ * Copyright (c) 2014 Marco Rinck; Licensed MIT
*/
-angular.module("angular-growl",[]),angular.module("angular-growl").directive("growl",["$rootScope",function(a){"use strict";return{restrict:"A",template:'',replace:!1,scope:!0,controller:["$scope","$timeout","growl",function(b,c,d){function e(a){b.messages.push(a),a.ttl&&-1!==a.ttl&&c(function(){b.deleteMessage(a)},a.ttl)}var f=d.onlyUnique();b.messages=[],a.$on("growlMessage",function(a,c){var d;f?(angular.forEach(b.messages,function(a){c.text===a.text&&c.severity===a.severity&&(d=!0)}),d||e(c)):e(c)}),b.deleteMessage=function(a){var c=b.messages.indexOf(a);c>-1&&b.messages.splice(c,1)},b.computeClasses=function(a){return{"alert-success":"success"===a.severity,"alert-error":"error"===a.severity,"alert-danger":"error"===a.severity,"alert-info":"info"===a.severity,"alert-warning":"warn"===a.severity}}}]}}]),angular.module("angular-growl").provider("growl",function(){"use strict";var a=null,b=!1,c="messages",d="text",e="severity",f=!0;this.globalTimeToLive=function(b){a=b},this.globalEnableHtml=function(a){b=a},this.messagesKey=function(a){c=a},this.messageTextKey=function(a){d=a},this.messageSeverityKey=function(a){e=a},this.onlyUniqueMessages=function(a){f=a},this.serverMessagesInterceptor=["$q","growl",function(a,b){function d(a){a.data[c]&&a.data[c].length>0&&b.addServerMessages(a.data[c])}function e(a){return d(a),a}function f(b){return d(b),a.reject(b)}return function(a){return a.then(e,f)}}],this.$get=["$rootScope","$filter",function(c,g){function h(a){p&&(a.text=p(a.text)),c.$broadcast("growlMessage",a)}function i(c,d,e){var f,g=d||{};f={text:c,severity:e,ttl:g.ttl||a,enableHtml:g.enableHtml||b},h(f)}function j(a,b){i(a,b,"warn")}function k(a,b){i(a,b,"error")}function l(a,b){i(a,b,"info")}function m(a,b){i(a,b,"success")}function n(a){var b,c,f,g;for(g=a.length,b=0;g>b;b++)if(c=a[b],c[d]&&c[e]){switch(c[e]){case"warn":f="warn";break;case"success":f="success";break;case"info":f="info";break;case"error":f="error"}i(c[d],void 0,f)}}function o(){return f}var p;try{p=g("translate")}catch(q){}return{addWarnMessage:j,addErrorMessage:k,addInfoMessage:l,addSuccessMessage:m,addServerMessages:n,onlyUnique:o}}]});
\ No newline at end of file
+angular.module("angular-growl",[]),angular.module("angular-growl").directive("growl",["$rootScope",function(a){"use strict";return{restrict:"A",template:'',replace:!1,scope:!0,controller:["$scope","$timeout","growl",function(b,c,d){function e(a){b.messages.push(a),a.ttl&&-1!==a.ttl&&c(function(){b.deleteMessage(a)},a.ttl)}var f=d.onlyUnique();b.messages=[],a.$on("growlMessage",function(a,c){var d;f?(angular.forEach(b.messages,function(a){c.text===a.text&&c.severity===a.severity&&(d=!0)}),d||e(c)):e(c)}),b.deleteMessage=function(a){var c=b.messages.indexOf(a);c>-1&&b.messages.splice(c,1)},b.computeClasses=function(a){return{"alert-success":"success"===a.severity,"alert-error":"error"===a.severity,"alert-danger":"error"===a.severity,"alert-info":"info"===a.severity,"alert-warning":"warn"===a.severity}}}]}}]),angular.module("angular-growl").provider("growl",function(){"use strict";var a=null,b=!1,c="messages",d="text",e="severity",f=!0,g=!1;this.globalTimeToLive=function(b){a=b},this.globalEnableHtml=function(a){b=a},this.globalDisableCloseButton=function(a){g=a},this.messagesKey=function(a){c=a},this.messageTextKey=function(a){d=a},this.messageSeverityKey=function(a){e=a},this.onlyUniqueMessages=function(a){f=a},this.serverMessagesInterceptor=["$q","growl",function(a,b){function d(a){a.data[c]&&a.data[c].length>0&&b.addServerMessages(a.data[c])}function e(a){return d(a),a}function f(b){return d(b),a.reject(b)}return function(a){return a.then(e,f)}}],this.$get=["$rootScope","$filter",function(c,h){function i(a){q&&(a.text=q(a.text)),c.$broadcast("growlMessage",a)}function j(c,d,e){var f,h=d||{};f={text:c,severity:e,ttl:h.ttl||a,enableHtml:h.enableHtml||b,disableCloseButton:h.disableCloseButton||g},i(f)}function k(a,b){j(a,b,"warn")}function l(a,b){j(a,b,"error")}function m(a,b){j(a,b,"info")}function n(a,b){j(a,b,"success")}function o(a){var b,c,f,g;for(g=a.length,b=0;g>b;b++)if(c=a[b],c[d]&&c[e]){switch(c[e]){case"warn":f="warn";break;case"success":f="success";break;case"info":f="info";break;case"error":f="error"}j(c[d],void 0,f)}}function p(){return f}var q;try{q=h("translate")}catch(r){}return{addWarnMessage:k,addErrorMessage:l,addInfoMessage:m,addSuccessMessage:n,addServerMessages:o,onlyUnique:p}}]});
\ No newline at end of file
diff --git a/src/growlDirective.js b/src/growlDirective.js
index edad549..c347f13 100644
--- a/src/growlDirective.js
+++ b/src/growlDirective.js
@@ -5,7 +5,7 @@ angular.module("angular-growl").directive("growl", ["$rootScope", function ($roo
restrict: 'A',
template: '' +
'
' +
- '
' +
+ '
' +
'
' +
'
' +
'
' +
diff --git a/src/growlFactory.js b/src/growlFactory.js
index d3e5329..8ac1bcf 100644
--- a/src/growlFactory.js
+++ b/src/growlFactory.js
@@ -6,7 +6,8 @@ angular.module("angular-growl").provider("growl", function() {
_messagesKey = 'messages',
_messageTextKey = 'text',
_messageSeverityKey = 'severity',
- _onlyUniqueMessages = true;
+ _onlyUniqueMessages = true,
+ _disableCloseButton = false;
/**
* set a global timeout (time to live) after which messages will be automatically closed
@@ -26,6 +27,15 @@ angular.module("angular-growl").provider("growl", function() {
_enableHtml = enableHtml;
};
+ /**
+ * set whether the close button should be displayed (default) or hidden
+ *
+ * @param {bool} disableCloseButton true to hide close button on all messages
+ */
+ this.globalDisableCloseButton = function (disableCloseButton) {
+ _disableCloseButton = disableCloseButton;
+ };
+
/**
* sets the key in $http response the serverMessagesInterecptor is looking for server-sent messages, value of key
* needs to be an array of objects
@@ -108,7 +118,8 @@ angular.module("angular-growl").provider("growl", function() {
text: text,
severity: severity,
ttl: _config.ttl || _ttl,
- enableHtml: _config.enableHtml || _enableHtml
+ enableHtml: _config.enableHtml || _enableHtml,
+ disableCloseButton: _config.disableCloseButton || _disableCloseButton
};
broadcastMessage(message);