From d7180c21ca1640e12e8806860419a5dc2ba238be Mon Sep 17 00:00:00 2001 From: petermcneil Date: Sun, 23 Jun 2019 16:54:13 +0100 Subject: [PATCH 1/2] Change channel mapper to sort list --- CONTRIBUTORS.md | 1 + src/components/channelmapper/channelmapper.js | 25 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f9240c1a4c2..ba574b05399 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -22,6 +22,7 @@ - [LogicalPhallacy](https://github.com/LogicalPhallacy) - [thornbill](https://github.com/thornbill) - [Oddstr13](https://github.com/oddstr13) + - [petermcneil](https://github.com/petermcneil) # Emby Contributors diff --git a/src/components/channelmapper/channelmapper.js b/src/components/channelmapper/channelmapper.js index 3a1ae995061..46ce8602af8 100644 --- a/src/components/channelmapper/channelmapper.js +++ b/src/components/channelmapper/channelmapper.js @@ -26,17 +26,20 @@ define(["dialogHelper", "loading", "connectionManager", "globalize", "actionshee } function onChannelsElementClick(e) { - var btnMap = parentWithClass(e.target, "btnMap"); + const btnMap = parentWithClass(e.target, "btnMap"); if (btnMap) { - var channelId = btnMap.getAttribute("data-id"), - providerChannelId = btnMap.getAttribute("data-providerid"), - menuItems = currentMappingOptions.ProviderChannels.map(function(m) { - return { - name: m.Name, - id: m.Id, - selected: m.Id.toLowerCase() === providerChannelId.toLowerCase() - } - }); + const channelId = btnMap.getAttribute("data-id"); + const providerChannelId = btnMap.getAttribute("data-providerid"); + const menuItems = currentMappingOptions.ProviderChannels.map(function(m) { + return { + name: m.Name, + id: m.Id, + selected: m.Id.toLowerCase() === providerChannelId.toLowerCase() + } + }).sort(function (a, b) { + return a.name.localeCompare(b.name); + }); + actionsheet.show({ positionTo: btnMap, items: menuItems @@ -93,4 +96,4 @@ define(["dialogHelper", "loading", "connectionManager", "globalize", "actionshee }) } } -}); \ No newline at end of file +}); From f7376f5d9077d94c08b97e9ce02aee68cc3e3ead Mon Sep 17 00:00:00 2001 From: petermcneil Date: Sun, 23 Jun 2019 16:56:04 +0100 Subject: [PATCH 2/2] ES5 not ES6 --- src/components/channelmapper/channelmapper.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/channelmapper/channelmapper.js b/src/components/channelmapper/channelmapper.js index 46ce8602af8..2abf7e2c9e8 100644 --- a/src/components/channelmapper/channelmapper.js +++ b/src/components/channelmapper/channelmapper.js @@ -26,11 +26,11 @@ define(["dialogHelper", "loading", "connectionManager", "globalize", "actionshee } function onChannelsElementClick(e) { - const btnMap = parentWithClass(e.target, "btnMap"); + var btnMap = parentWithClass(e.target, "btnMap"); if (btnMap) { - const channelId = btnMap.getAttribute("data-id"); - const providerChannelId = btnMap.getAttribute("data-providerid"); - const menuItems = currentMappingOptions.ProviderChannels.map(function(m) { + var channelId = btnMap.getAttribute("data-id"); + var providerChannelId = btnMap.getAttribute("data-providerid"); + var menuItems = currentMappingOptions.ProviderChannels.map(function(m) { return { name: m.Name, id: m.Id,