From df93637d529a7e45283d640659a433dbc9a584f7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 13 Jun 2011 13:56:20 +0200 Subject: [PATCH] implement changedirectory method --- .../sonia.repository.repositorybrowser.js | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.repositorybrowser.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.repositorybrowser.js index 833d923a5c..8b6219e7f5 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.repositorybrowser.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.repositorybrowser.js @@ -38,6 +38,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, { iconFolder: 'resources/images/folder.gif', iconDocument: 'resources/images/document.gif', templateIcon: '{1}', + templateLink: '{0}', initComponent: function(){ @@ -93,15 +94,39 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, { title: String.format(this.repositoryBrowserTitleText, this.repository.name), store: browserStore, colModel: browserColModel, - loadMask: true + loadMask: true, + listeners: { + click: { + fn: this.onClick, + scope: this + } + } }; Ext.apply(this, Ext.apply(this.initialConfig, config)); Sonia.repository.RepositoryBrowser.superclass.initComponent.apply(this, arguments); }, + onClick: function(e){ + var el = e.getTarget('.scm-browser'); + var path = el.rel; + if ( path.substr(-1) === '/' ){ + path = path.substr( 0, path.length - 1 ); + } + + if (debug){ + console.debug( 'change directory: ' + path ); + } + + this.getStore().load({ + params: { + path: path + } + }); + }, + renderName: function(name, p, record){ - return name; + return String.format(this.templateLink, name, record.data.path); }, renderIcon: function(directory, p, record){