]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
WEBUI: channels grid - group number operations to one menu to reduce toolbar width
authorJaroslav Kysela <perex@perex.cz>
Tue, 1 Dec 2015 21:16:12 +0000 (22:16 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 1 Dec 2015 21:16:12 +0000 (22:16 +0100)
src/webui/static/app/chconf.js
src/webui/static/app/idnode.js

index 6c3262fa494e01e98818386e7e16dc294d24f6ff..dd5bb8b560d5d4d2236361719f3dd7b4fa4390b6 100644 (file)
@@ -135,56 +135,48 @@ tvheadend.channel_tab = function(panel, index)
         callback: tvheadend.service_mapper
     };
 
-    var lowNoButton = {
-        name: 'lowno',
+    var chopsButton = {
+        name: 'chops',
         builder: function() {
-            return new Ext.Toolbar.Button({
+            var m = new Ext.menu.Menu()
+            m.add({
+                name: 'lowno',
                 tooltip: _('Assign lowest free channel number'),
                 iconCls: 'bullet_add',
-                text: _('Assign Number'),
-                disabled: false
+                text: _('Assign Number')
             });
-        },
-        callback: assign_low_number
-    };
-
-    var noUpButton = {
-        name: 'noup',
-        builder: function() {
-            return new Ext.Toolbar.Button({
+            m.add({
+                name: 'noup',
                 tooltip: _('Move channel one number up'),
                 iconCls: 'arrow_up',
-                text: _('Number Up'),
-                disabled: false
+                text: _('Number Up')
             });
-        },
-        callback: move_number_up
-    };
-
-    var noDownButton = {
-        name: 'nodown',
-        builder: function() {
-            return new Ext.Toolbar.Button({
+            m.add({
+                name: 'nodown',
                 tooltip: _('Move channel one number down'),
                 iconCls: 'arrow_down',
-                text: _('Number Down'),
-                disabled: false
+                text: _('Number Down')
             });
-        },
-        callback: move_number_down
-    };
-
-    var noSwapButton = {
-        name: 'swap',
-        builder: function() {
-            return new Ext.Toolbar.Button({
+            m.add({
+                name: 'swap',
                 tooltip: _('Swap the numbers for the two selected channels'),
                 iconCls: 'arrow_switch',
-                text: _('Swap Numbers'),
+                text: _('Swap Numbers')
+            });
+            return new Ext.Toolbar.Button({
+                tooltip: _('Channel number operations'),
+                iconCls: 'bullet_add',
+                text: _('Number operations'),
+                menu: m,
                 disabled: false
             });
         },
-        callback: swap_numbers
+        callback: {
+            lowno: assign_low_number,
+            noup: move_number_up,
+            nodown: move_number_down,
+            swap: swap_numbers
+        }
     };
 
     var iconResetButton = {
@@ -216,7 +208,7 @@ tvheadend.channel_tab = function(panel, index)
             create: {}
         },
         del: true,
-        tbar: [mapButton, lowNoButton, noUpButton, noDownButton, noSwapButton, iconResetButton],
+        tbar: [mapButton, chopsButton, iconResetButton],
         lcol: [
             {
                 width: 50,
index 830024e23d4c1344cf16f9bf945248eb0def496b..ab1f70096b84123f2218b0a1b77e565c3ab0f7f2 100644 (file)
@@ -1768,7 +1768,14 @@ tvheadend.idnode_grid = function(panel, conf)
                 var t = conf.tbar[i];
                 if (t.name && t.builder) {
                     var b = t.builder();
-                    if (t.callback) {
+                    if (b.menu) {
+                        b.menu.items.each(function(mi) {
+                            mi.callback = t.callback[mi.name];
+                            mi.setHandler(function(m, e) {
+                                this.callback(this, e, store, select);
+                            });
+                        });
+                    } else if (t.callback) {
                         b.callback = t.callback;
                         b.handler = function(b, e) {
                             this.callback(this, e, store, select);