From 0df1f147b8a45f94c9a80384ff548c124804d6e8 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 13 Jun 2011 14:07:21 +0200 Subject: [PATCH] only call changedirectory if the file is a directory --- .../sonia.repository.repositorybrowser.js | 23 +++++++++++++++++-- 1 file changed, 21 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 8b6219e7f5..1da2f2d67b 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 @@ -109,7 +109,24 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, { onClick: function(e){ var el = e.getTarget('.scm-browser'); - var path = el.rel; + + var rel = el.rel.split(':'); + var path = rel[1]; + + if ( rel[0] == 'dir' ){ + this.changeDirectory(path); + } else { + this.openFile(path); + } + }, + + openFile: function(path){ + if ( debug ){ + console.debug( 'open file: ' + path ); + } + }, + + changeDirectory: function(path){ if ( path.substr(-1) === '/' ){ path = path.substr( 0, path.length - 1 ); } @@ -126,7 +143,9 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, { }, renderName: function(name, p, record){ - return String.format(this.templateLink, name, record.data.path); + var path = record.data.directory ? 'dir:' : 'file:'; + path += record.data.path; + return String.format(this.templateLink, name, path); }, renderIcon: function(directory, p, record){