diff --git a/scm-webapp/src/main/webapp/index.mustache b/scm-webapp/src/main/webapp/index.mustache
index 4c2c3c913c..fec01e96ca 100644
--- a/scm-webapp/src/main/webapp/index.mustache
+++ b/scm-webapp/src/main/webapp/index.mustache
@@ -115,6 +115,8 @@
+
+
diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.branchcombobox.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.branchcombobox.js
new file mode 100644
index 0000000000..9ba2575c11
--- /dev/null
+++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.branchcombobox.js
@@ -0,0 +1,65 @@
+/* *
+ * Copyright (c) 2014, Sebastian Sdorra
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of SCM-Manager; nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * http://bitbucket.org/sdorra/scm-manager
+ *
+ */
+
+
+Sonia.repository.BranchComboBox = Ext.extend(Ext.form.ComboBox, {
+
+ repositoryId: null,
+
+ initComponent: function(){
+ var branchStore = new Sonia.rest.JsonStore({
+ proxy: new Ext.data.HttpProxy({
+ url: restUrl + 'repositories/' + this.repositoryId + '/branches.json',
+ method: 'GET',
+ disableCaching: false
+ }),
+ root: 'branch',
+ idProperty: 'name',
+ fields: ['name', 'revision']
+ });
+
+ var config = {
+ valueField: 'revision',
+ displayField: 'name',
+ typeAhead: false,
+ editable: false,
+ triggerAction: 'all',
+ store: branchStore
+ };
+
+ Ext.apply(this, Ext.apply(this.initialConfig, config));
+ Sonia.repository.BranchComboBox.superclass.initComponent.apply(this, arguments);
+ }
+
+});
+
+// register xtype
+Ext.reg('repositoryBranchComboBox', Sonia.repository.BranchComboBox);
\ No newline at end of file
diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetviewerpanel.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetviewerpanel.js
index 3e276d2c27..aa18d29e0d 100644
--- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetviewerpanel.js
+++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetviewerpanel.js
@@ -120,33 +120,14 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
},
createTopToolbar: function(){
- var branchStore = new Sonia.rest.JsonStore({
- proxy: new Ext.data.HttpProxy({
- url: restUrl + 'repositories/' + this.repository.id + '/branches.json',
- method: 'GET',
- disableCaching: false
- }),
- root: 'branch',
- idProperty: 'name',
- fields: [ 'name' ],
- sortInfo: {
- field: 'name'
- }
- });
-
return {
xtype: 'toolbar',
items: [
this.repository.name,
'->',
'Branches:', ' ',{
- xtype: 'combo',
- valueField: 'name',
- displayField: 'name',
- typeAhead: false,
- editable: false,
- triggerAction: 'all',
- store: branchStore,
+ xtype: 'repositoryBranchComboBox',
+ repositoryId: this.repository.id,
listeners: {
select: {
fn: this.selectBranch,
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 7ec444222c..489dd3c06c 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
@@ -159,26 +159,10 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
branches = true;
- var branchStore = new Sonia.rest.JsonStore({
- proxy: new Ext.data.HttpProxy({
- url: restUrl + 'repositories/' + this.repository.id + '/branches.json',
- method: 'GET',
- disableCaching: false
- }),
- root: 'branch',
- idProperty: 'name',
- fields: [ 'name', 'revision' ]
- });
-
items.push('->','Branches:', ' ',{
id: 'branchComboBox',
- xtype: 'combo',
- valueField: 'revision',
- displayField: 'name',
- typeAhead: false,
- editable: false,
- triggerAction: 'all',
- store: branchStore,
+ xtype: 'repositoryBranchComboBox',
+ repositoryId: this.repository.id,
listeners: {
select: {
fn: this.selectBranch,
@@ -191,17 +175,6 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
if ( type && type.supportedCommands && type.supportedCommands.indexOf('TAGS') >= 0){
- var tagStore = new Sonia.rest.JsonStore({
- proxy: new Ext.data.HttpProxy({
- url: restUrl + 'repositories/' + this.repository.id + '/tags.json',
- method: 'GET',
- disableCaching: false
- }),
- root: 'tag',
- idProperty: 'name',
- fields: [ 'name', 'revision' ]
- });
-
if (branches){
items.push(' ');
} else {
@@ -210,13 +183,8 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
items.push('Tags:', ' ',{
id: 'tagComboBox',
- xtype: 'combo',
- valueField: 'revision',
- displayField: 'name',
- typeAhead: false,
- editable: false,
- triggerAction: 'all',
- store: tagStore,
+ xtype: 'repositoryTagComboBox',
+ repositoryId: this.repository.id,
listeners: {
select: {
fn: this.selectTag,
diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.tagcombobox.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.tagcombobox.js
new file mode 100644
index 0000000000..0db635f8cd
--- /dev/null
+++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.tagcombobox.js
@@ -0,0 +1,65 @@
+/* *
+ * Copyright (c) 2014, Sebastian Sdorra
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of SCM-Manager; nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * http://bitbucket.org/sdorra/scm-manager
+ *
+ */
+
+
+Sonia.repository.TagComboBox = Ext.extend(Ext.form.ComboBox, {
+
+ repositoryId: null,
+
+ initComponent: function(){
+ var tagStore = new Sonia.rest.JsonStore({
+ proxy: new Ext.data.HttpProxy({
+ url: restUrl + 'repositories/' + this.repositoryId + '/tags.json',
+ method: 'GET',
+ disableCaching: false
+ }),
+ root: 'tag',
+ idProperty: 'name',
+ fields: [ 'name', 'revision' ]
+ });
+
+ var config = {
+ valueField: 'revision',
+ displayField: 'name',
+ typeAhead: false,
+ editable: false,
+ triggerAction: 'all',
+ store: tagStore,
+ };
+
+ Ext.apply(this, Ext.apply(this.initialConfig, config));
+ Sonia.repository.TagComboBox.superclass.initComponent.apply(this, arguments);
+ }
+
+});
+
+// register xtype
+Ext.reg('repositoryTagComboBox', Sonia.repository.TagComboBox);
\ No newline at end of file