diff --git a/scm-webapp/src/main/webapp/resources/js/group/sonia.group.grid.js b/scm-webapp/src/main/webapp/resources/js/group/sonia.group.grid.js index 9def9bd28c..6ca5822949 100644 --- a/scm-webapp/src/main/webapp/resources/js/group/sonia.group.grid.js +++ b/scm-webapp/src/main/webapp/resources/js/group/sonia.group.grid.js @@ -116,11 +116,7 @@ Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, { console.debug( group.name + ' selected' ); } - var token = Ext.History.getToken(); - if ( token ){ - var parts = token.split('|'); - Ext.History.add(parts[0] + '|' + group.name); - } + Sonia.History.append(group.name); Ext.getCmp('groupRmButton').setDisabled(false); Sonia.group.setEditPanel([{ diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js index bc6c23b9b7..185f0e8012 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.grid.js @@ -103,11 +103,7 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, { console.debug( item.name + ' selected' ); } - var token = Ext.History.getToken(); - if ( token ){ - var parts = token.split('|'); - Ext.History.add(parts[0] + '|' + item.name); - } + Sonia.History.append(item.name); var infoPanel = main.getInfoPanel(item.type); infoPanel.item = item; diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.history.js b/scm-webapp/src/main/webapp/resources/js/sonia.history.js index 3a11dd6250..b1d6eae314 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.history.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.history.js @@ -29,14 +29,64 @@ * */ +Ext.ns('Sonia'); + +Sonia.History = { + + historyElements: [], + recentlyAdded: [], + + add: function(token){ + this.recentlyAdded.push(token); + Ext.History.add(token, true); + }, + + append: function(item){ + var token = Ext.History.getToken(); + if ( token ){ + var parts = token.split('|'); + this.add(parts[0] + '|' + item); + } + }, + + register: function(id, fn){ + this.historyElements.push({ + 'id': id, + 'fn': fn + }); + }, + + handleChange: function(id, params){ + if ( debug ){ + console.debug( 'handle ' + id + ' with "' + params + '"' ); + } + for (var i=0; i