Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Clean destroy() of ActionsToolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Oct 28, 2013
1 parent ac476d8 commit b1a3f31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/src/plugins/gui.ajax/res/js/ajaxplorer.js

Large diffs are not rendered by default.

Expand Up @@ -51,23 +51,28 @@ Class.create("ActionsToolbar", {
if(this.options.styles){
this.buildActionBarStylingMenu();
this.style = this.options.defaultStyle;
document.observe("ajaxplorer:user_logged", function(){
this.styleObserver = function(){
if(ajaxplorer.user && ajaxplorer.user.getPreference("action_bar_style")){
this.style = ajaxplorer.user.getPreference("action_bar_style");
}else{
this.style = this.options.defaultStyle;
}
this.switchStyle(false, true);
}.bind(this));
}.bind(this);
document.observe("ajaxplorer:user_logged", this.styleObserver);
}
attachMobileScroll(oElement.id, "horizontal");
document.observe("ajaxplorer:actions_loaded", this.actionsLoaded.bind(this));
document.observe("ajaxplorer:actions_refreshed", this.refreshToolbarsSeparator.bind(this));

this.actionsLoadedObserver = this.actionsLoaded.bind(this);
this.refreshToolbarObserver = this.refreshToolbarsSeparator.bind(this);
this.componentConfigHandler = function(event){
if(event.memo.className == "ActionsToolbar"){
this.parseComponentConfig(event.memo.classConfig.get('all'));
}
}.bind(this);

document.observe("ajaxplorer:actions_loaded", this.actionsLoadedObserver);
document.observe("ajaxplorer:actions_refreshed", this.refreshToolbarObserver);
document.observe("ajaxplorer:component_config_changed", this.componentConfigHandler );

},
Expand All @@ -77,7 +82,10 @@ Class.create("ActionsToolbar", {
},
destroy : function(){
this.emptyToolbars();

document.stopObserving("ajaxplorer:actions_loaded", this.actionsLoadedObserver);
document.stopObserving("ajaxplorer:actions_refreshed", this.refreshToolbarObserver);
document.stopObserving("ajaxplorer:component_config_changed", this.componentConfigHandler );
if(this.styleObserver) document.stopObserving("ajaxplorer:user_logged", this.styleObserver);
},

/**
Expand Down

0 comments on commit b1a3f31

Please sign in to comment.