From 9ad604fc08f68efacf2903acab05c329f6e85e2e Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 16 Sep 2011 15:59:11 +0200 Subject: [PATCH] improve content panel --- .../sonia.repository.contentpanel.js | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.contentpanel.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.contentpanel.js index 3f00b345ea..0e593c1383 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.contentpanel.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.contentpanel.js @@ -56,7 +56,9 @@ Sonia.repository.ContentPanel = Ext.extend(Ext.Panel, { var config = { title: name, tbar: [{ - text: 'Default' + text: 'Default', + handler: this.openSyntaxPanel, + scope: this },{ text: 'Raw', handler: this.downlaodFile, @@ -78,19 +80,31 @@ Sonia.repository.ContentPanel = Ext.extend(Ext.Panel, { Sonia.repository.ContentPanel.superclass.initComponent.apply(this, arguments); }, + openSyntaxPanel: function(){ + this.openPanel({ + xtype: 'syntaxHighlighterPanel', + syntax: this.getExtension(this.path), + contentUrl: this.contentUrl + }); + }, + openBlamePanel: function(){ - this.removeAll(); - this.add({ + this.openPanel({ xtype: 'blamePanel', blameUrl: this.blameUrl }); - this.doLayout(); }, downlaodFile: function(){ window.open(this.contentUrl); }, + openPanel: function(panel){ + this.removeAll(); + this.add(panel); + this.doLayout(); + }, + appendRepositoryProperties: function(bar){ bar.push('->',this.repository.name); if ( this.revision != null ){