[pve-devel] [PATCH pve-manager 3/8] add PVEBar class to provide an common menu titlebar

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Sep 23 17:54:41 CEST 2015


PVEBar inherits from Ext.TitleBar and provides an titlebar for the
PVE mobile components to reduce code reuse.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/mobile/Makefile  |  1 +
 www/mobile/PVEBar.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 www/mobile/PVEBar.js

diff --git a/www/mobile/Makefile b/www/mobile/Makefile
index 4d44259..065d2ac 100644
--- a/www/mobile/Makefile
+++ b/www/mobile/Makefile
@@ -8,6 +8,7 @@ JSSRC= 				                 	\
 	Toolkit.js					\
 	PVEProxy.js					\
 	MenuButton.js					\
+	PVEBar.js					\
 	Workspace.js					\
 	NodeSelector.js					\
 	RealmSelector.js				\
diff --git a/www/mobile/PVEBar.js b/www/mobile/PVEBar.js
new file mode 100644
index 0000000..a5f1c70
--- /dev/null
+++ b/www/mobile/PVEBar.js
@@ -0,0 +1,49 @@
+Ext.define('PVE.ATitleBar', {
+    extend: 'Ext.TitleBar',
+    alias: ['widget.pveTitleBar'],
+
+    config: {
+	docked: 'top',
+	pveReloadButton: true,
+	pveBackButton: true,
+	pveStdMenu: true // add 'Login' and 'Datacenter' to menu by default
+    },
+
+    initialize: function() {
+	var me = this;
+
+	me.callParent();
+
+	var items = [];
+
+	if (me.getPveBackButton()) {
+	    items.push({
+		align: 'left',
+		iconCls: 'arrow_left',
+		handler: function() {
+		    PVE.Workspace.goBack();
+		}
+	    });
+	}
+
+	if (me.getPveReloadButton()) {
+	    items.push({
+		align: 'right',
+		iconCls: 'refresh',
+		handler: function() {
+		    this.up('pvePage').reload();
+		}
+	    });
+	}
+
+	items.push({
+	    xtype: 'pveMenuButton',
+	    align: 'right',
+	    pveStdMenu: me.getPveStdMenu()
+	});
+
+	me.setItems(items);
+    }
+
+
+});
-- 
2.1.4




More information about the pve-devel mailing list