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 4d157f0dcb..a9428d2413 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 @@ -86,8 +86,6 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, { name: 'description' },{ name: 'creationDate' - },{ - name:'url' },{ name: 'public' },{ @@ -150,8 +148,9 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, { },{ id: 'Url', header: this.colUrlText, - dataIndex: 'url', - renderer: this.renderUrl, + dataIndex: 'name', + renderer: this.renderRepositoryUrl, + scope: this, width: 250 },{ id: 'Archive', @@ -219,6 +218,13 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, { } }, + renderRepositoryUrl: function(name, meta, record){ + var type = record.get('type'); + return this.renderUrl( + Sonia.repository.createUrl(type, name) + ); + }, + renderArchive: function(v){ return v ? ' + v + ' : ''; }, diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js index 20c40c62a7..01f4bdffa9 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js @@ -74,7 +74,7 @@ Sonia.repository.InfoPanel = Ext.extend(Ext.Panel, { text: this.urlText },{ xtype: 'box', - html: String.format(this.linkTemplate, this.item.url) + html: String.format(this.linkTemplate, Sonia.repository.createUrlFromObject(this.item)) }]; var config = { @@ -105,7 +105,7 @@ Sonia.repository.InfoPanel = Ext.extend(Ext.Panel, { }, getRepositoryUrlWithUsername: function(){ - var uri = this.item.url; + var uri = Sonia.repository.createUrlFromObject(this.item); if ( state.user.name != 'anonymous' ){ var index = uri.indexOf("://"); if ( index > 0 ){ diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js index 13d1d1af56..0c3dad29f8 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js @@ -78,6 +78,16 @@ Sonia.repository.setEditPanel = function(panels){ editPanel.doLayout(); } +Sonia.repository.createUrl = function(type, name){ + return Sonia.util.getBaseUrl() + '/' + type + '/' + name +} + +Sonia.repository.createUrlFromObject = function(repository){ + var url = Sonia.repository.createUrl(repository.type, repository.name); + console.debug(url); + return url; +} + /** * default panel */ diff --git a/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js b/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js index 450ba16a57..4f80ed7b09 100644 --- a/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js +++ b/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js @@ -59,6 +59,21 @@ Sonia.util.getContextPath = function(){ return path; } +Sonia.util.getBaseUrl = function(){ + var url = location.href; + var i = url.indexOf('#'); + if ( i > 0 ){ + url = url.substring(0, i); + } + + if ( url.endsWith('/index.html') ){ + url = url.substring(0, url.length - '/index.html'.length); + } else if ( url.endsWith('/') ){ + url = url.substring(0, url.length -1); + } + return url; +} + Sonia.util.getName = function(path){ var name = path; var index = path.lastIndexOf('/');