]> git.proxmox.com Git - pve-manager.git/commitdiff
add PVEBar class to provide an common menu titlebar
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 23 Sep 2015 15:54:41 +0000 (17:54 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 24 Sep 2015 04:49:32 +0000 (06:49 +0200)
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@proxmox.com>
www/mobile/Makefile
www/mobile/PVEBar.js [new file with mode: 0644]

index 4d442592fe41d2327eba214012bd7efe1df42b68..065d2ac3319bd77847fb9800dbb23178425e7b96 100644 (file)
@@ -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 (file)
index 0000000..a5f1c70
--- /dev/null
@@ -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);
+    }
+
+
+});