diff --git a/dashboard-ui/livetvsettings.html b/dashboard-ui/livetvsettings.html new file mode 100644 index 0000000000..a51ed96dd1 --- /dev/null +++ b/dashboard-ui/livetvsettings.html @@ -0,0 +1,61 @@ + + + + Live TV + + +
+ +
+
+ + +
+
+ + +
+ + diff --git a/dashboard-ui/scripts/livetvsettings.js b/dashboard-ui/scripts/livetvsettings.js new file mode 100644 index 0000000000..48069939ba --- /dev/null +++ b/dashboard-ui/scripts/livetvsettings.js @@ -0,0 +1,59 @@ +(function ($, document, window) { + + function loadPage(page, config, tvServices) { + + if (tvServices.length) { + + $('.liveTvSettingsForm', page).show(); + $('.noLiveTvServices', page).hide(); + + } else { + $('.liveTvSettingsForm', page).hide(); + $('.noLiveTvServices', page).show(); + } + + $('#selectGuideDays', page).val(config.LiveTvOptions.GuideDays || '').selectmenu('refresh'); + + Dashboard.hideLoadingMsg(); + } + + $(document).on('pageshow', "#liveTvSettingsPage", function () { + + Dashboard.showLoadingMsg(); + + var page = this; + + var promise1 = ApiClient.getServerConfiguration(); + + var promise2 = ApiClient.getLiveTvServices(); + + $.when(promise1, promise2).done(function (response1, response2) { + + loadPage(page, response1[0], response2[0]); + + }); + + }); + + window.LiveTvSettingsPage = { + + onSubmit: function() { + + Dashboard.showLoadingMsg(); + + var form = this; + + ApiClient.getServerConfiguration().done(function (config) { + + + config.LiveTvOptions.GuideDays = $('#selectGuideDays', form).val() || null; + + ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult); + }); + + // Disable default form submission + return false; + } + }; + +})(jQuery, document, window); diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 5cecd93e77..0ce8be4904 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -753,6 +753,10 @@ var Dashboard = { name: "Plugins", href: "plugins.html", selected: page.hasClass("pluginConfigurationPage") + }, { + name: "Live TV", + href: "livetvsettings.html", + selected: page.hasClass("liveTvSettingsPage") }, { name: "Users", divider: true,