relaxdiego/redmine_backlogs — Issue #409: Enable/disable auto-refresh link not working on master backlog
Author: k2s
Created: 2012-02-01 09:07:10+00:00
State: open

The reason is that master_backlog.js is loaded executed twice. Don't know what is the reason, but should not be.

Effect is that onclick event is binded twice to auto-refresh and refresh labels.
auto-refresh uses toggle method so it will 1. change and then 2. unchange the autorefresh in the same click event.

This is my quick fix (replaces the whole master_backlog.js file), but we should find out why it is executed twice:

```javascript
// Initialize the backlogs after DOM is loaded
var checkit = window.check_var;

if(checkit === undefined){ //file never entered. the global var was not set.
window.check_var = 1;
}
else {
// THIS FILE IS EXECUTED TWICE (don't know why), WE HAVE TO HOOK ONLY THE SECOND TIME
RB.$(function() {
// Initialize each backlog
RB.$('.backlog').each(function(index){
RB.Factory.initialize(RB.Backlog, this);
});
// RB.$("#project_info").bind('click', function(){ RB.$("#velocity").dialog({ modal: true, title: "Project Info"}); });
RB.BacklogsUpdater.start();

// Workaround for IE7
if(RB.$.browser.msie && RB.$.browser.version <= 7){
var z = 2000;
RB.$('.backlog, .header').each(function(){
RB.$(this).css('z-index', z);
z--;
});
}
});
}
```