app/assets/javascripts/voltron-flash.js in voltron-flash-0.1.4 vs app/assets/javascripts/voltron-flash.js in voltron-flash-0.1.5
- old
+ new
@@ -21,15 +21,18 @@
return {
initialize: function(){
if(!_initialized){
_initialized = true;
Voltron('Dispatch/addEventWatcher', 'click');
- this.on('click:close-alert', 'click:close-notice', 'click:close-warning', this.clear);
this.addListener();
}
},
+ onClickCloseFlash: function(o){
+ this.clear(o, $(o.element).data('flash-options') || {});
+ },
+
setConfig: function(options){
_defaults = $.extend(_defaults, options);
this.afterConfigChange();
return this;
},
@@ -80,10 +83,10 @@
flash.append($.map($.makeArray(messages), function(message){
return $('<p />', { class: 'flash-message' }).html(message).hide();
}));
if(!Voltron.getConfig('flash/group') || !flash.find('.flash-close').length){
- flash.append($('<button />', { class: 'flash-close', type: 'button', id: 'close-' + type, 'data-dispatch': 'click' }));
+ flash.append($('<button />', { class: 'flash-close', type: 'button', id: 'close-' + type, 'data-dispatch': 'flash:click/close_flash' }));
}
if(!this.getContainer(options).length){
Voltron.debug('warn', 'Element with which to bind flash messages to could not be found. The bind selector given was %o. Please ensure an element matching the given selector exists.', options.bind);
}