From: E.Smith <31170571+azlm8t@users.noreply.github.com> Date: Tue, 18 Sep 2018 17:25:15 +0000 (+0100) Subject: ui: Fix createToolbar2 issues on some recent browsers. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=823aabc5211e94311ca70793e40214626570e7e6;p=thirdparty%2Ftvheadend.git ui: Fix createToolbar2 issues on some recent browsers. Recent versions of Firefox had an exception saying the createToolbar2 function does not exist when it was called to create the secondary toolbar that is used for category searching in the EPG. I believe this was due to scoping issues, so rescoped the variables. This worked, but although the toolbar was added it was not displayed on Firefox. So changed the way the toolbar is added and it now works on Firefox and Safari. --- diff --git a/src/webui/static/app/epg.js b/src/webui/static/app/epg.js index 56105e8ab..93b4dfa0c 100644 --- a/src/webui/static/app/epg.js +++ b/src/webui/static/app/epg.js @@ -15,22 +15,6 @@ insertCategoryClearOption = function(scope, records, options) { scope.insert(0,new placeholder({key: '-1', val: _('(Clear filter)')})); }; -tvheadend.category = tvheadend.idnode_get_enum({ - url: 'api/channelcategory/list', - event: 'channelcategory', - listeners: { - 'load': function(scope, records, options) { - insertCategoryClearOption(scope, records, options); - // If we have categories then we create the category - // search toolbar. - if (records.length) { - tvheadend.createToolbar2(); - } - } - } -}); - - tvheadend.contentGroupLookupName = function(code) { ret = ""; if (!code) @@ -838,6 +822,20 @@ tvheadend.epg = function() { }); + var category = tvheadend.idnode_get_enum({ + url: 'api/channelcategory/list', + event: 'channelcategory', + listeners: { + 'load': function(scope, records, options) { + insertCategoryClearOption(scope, records, options); + // If we have categories then we create the category + // search toolbar. + if (records.length) { + createToolbar2(); + } + } + }}); + /// "cat" is the name of the category field. /// We have to pass the name, not the field, since the /// field is deleted and re-created inside clear filter. @@ -846,7 +844,7 @@ tvheadend.epg = function() { loadingText: _('Loading...'), width: 200, displayField: 'val', - store: tvheadend.category, + store: category, mode: 'local', editable: true, forceSelection: true, @@ -1177,15 +1175,16 @@ tvheadend.epg = function() { }); /* Extra toolbar. Only created if we have categories on the server */ - tvheadend.createToolbar2 = function() { - var tbar2 = new Ext.Toolbar({ - items: [ - epgFilterCat1, '-', - epgFilterCat2, '-', - epgFilterCat3, '-' - ] - }); - panel.add(tbar2); + var createToolbar2 = function() { + var tb2container = Ext.DomHelper.append(panel.tbar, {tag:'div', id:Ext.id()}, true); + var tbar2 = new Ext.Toolbar({ + renderTo: tb2container, + items: [ + epgFilterCat1, '-', + epgFilterCat2, '-', + epgFilterCat3, '-' + ] + }); } /**