mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
fix history forward button
This commit is contained in:
@@ -35,13 +35,16 @@ Sonia.History = {
|
|||||||
|
|
||||||
historyElements: [],
|
historyElements: [],
|
||||||
recentlyAdded: [],
|
recentlyAdded: [],
|
||||||
|
recentlyChanged: [],
|
||||||
|
|
||||||
add: function(token){
|
add: function(token){
|
||||||
if ( debug ){
|
if ( debug ){
|
||||||
console.debug('add history element ' + token);
|
console.debug('add history element ' + token);
|
||||||
}
|
}
|
||||||
this.recentlyAdded.push(token);
|
if (this.isInvokeable(this.recentlyChanged, token)){
|
||||||
Ext.History.add(token, true);
|
this.recentlyAdded.push(token);
|
||||||
|
Ext.History.add(token, true);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
append: function(item){
|
append: function(item){
|
||||||
@@ -87,6 +90,29 @@ Sonia.History = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isInvokeable: function(lockList, item){
|
||||||
|
var invokeable = true;
|
||||||
|
var index = lockList.indexOf(item);
|
||||||
|
if ( index >= 0 ){
|
||||||
|
invokeable = false;
|
||||||
|
lockList.splice(index);
|
||||||
|
}
|
||||||
|
return invokeable;
|
||||||
|
},
|
||||||
|
|
||||||
|
onChange: function(token){
|
||||||
|
if(token){
|
||||||
|
if (this.isInvokeable(this.recentlyAdded, token)){
|
||||||
|
var parts = token.split('|');
|
||||||
|
var id = parts[0];
|
||||||
|
this.recentlyChanged.push(token);
|
||||||
|
Sonia.History.handleChange(id, parts.splice(1));
|
||||||
|
}
|
||||||
|
} else if (debug) {
|
||||||
|
console.debug('history token is empty');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
handleChange: function(id, params){
|
handleChange: function(id, params){
|
||||||
var el = this.historyElements[id];
|
var el = this.historyElements[id];
|
||||||
if (el){
|
if (el){
|
||||||
@@ -107,23 +133,5 @@ Sonia.History = {
|
|||||||
|
|
||||||
|
|
||||||
Ext.History.on('change', function(token){
|
Ext.History.on('change', function(token){
|
||||||
if(token){
|
Sonia.History.onChange(token);
|
||||||
var found = false;
|
|
||||||
for ( var i=0; i<Sonia.History.recentlyAdded.length; i++ ){
|
|
||||||
if (Sonia.History.recentlyAdded[i] == token){
|
|
||||||
found = true;
|
|
||||||
Sonia.History.recentlyAdded.splice(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found){
|
|
||||||
var parts = token.split('|');
|
|
||||||
var id = parts[0];
|
|
||||||
Sonia.History.handleChange(id, parts.splice(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (debug) {
|
|
||||||
console.debug('history token is empty');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user