1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update channels

This commit is contained in:
Luke Pulverenti 2015-08-21 12:54:11 -04:00
parent 949a67054f
commit c0918e89de
2 changed files with 5 additions and 118 deletions

View file

@ -29,36 +29,6 @@
<div class="fieldDescription">${LabelChannelStreamQualityHelp}</div>
</li>
</ul>
<div class="channelDownloading" style="display: none;">
<div>
<label>${LabelEnableChannelContentDownloadingFor}</label>
</div>
<div class="channelDownloadingList"></div>
<div class="fieldDescription">${LabelEnableChannelContentDownloadingForHelp}</div>
<br />
<br />
<ul data-role="listview" class="ulForm">
<li>
<label for="txtCachePath">${LabelChannelDownloadPath}</label>
<div style="display: inline-block; width: 85%;">
<input type="text" id="txtCachePath" name="txtCachePath" />
</div>
<button id="btnSelectCachePath" type="button" data-icon="search" data-iconpos="notext" data-inline="true">${ButtonSelectDirectory}</button>
<div class="fieldDescription">${LabelChannelDownloadPathHelp}</div>
</li>
<li>
<label for="txtDownloadSizeLimit">${LabelChannelDownloadSizeLimit}</label>
<input type="number" id="txtDownloadSizeLimit" pattern="[0-9]*" min="0.1" step=".1" />
<div class="fieldDescription">${LabelChannelDownloadSizeLimitHelpText}</div>
</li>
<li>
<label for="txtDownloadAge">${LabelChannelDownloadAge}</label>
<input type="number" id="txtDownloadAge" pattern="[0-9]*" min="1" />
<div class="fieldDescription">${LabelChannelDownloadAgeHelp}</div>
</li>
</ul>
</div>
<ul data-role="listview" class="ulForm">
<li>
<button type="submit" data-role="none" class="clearButton">

View file

@ -1,55 +1,8 @@
(function ($, document, window) {
function populateDownloadList(page, config, downloadableList) {
function loadPage(page, config) {
if (downloadableList.length) {
$('.channelDownloading', page).show();
} else {
$('.channelDownloading', page).hide();
}
var html = '';
html += '<div data-role="controlgroup">';
for (var i = 0, length = downloadableList.length; i < length; i++) {
var channel = downloadableList[i];
var id = 'chkChannelDownload' + i;
var isChecked = config.DownloadingChannels.indexOf(channel.Id) != -1 ? ' checked="checked"' : '';
html += '<input class="chkChannelDownload" type="checkbox" name="' + id + '" id="' + id + '" data-channelid="' + channel.Id + '"' + isChecked + '>';
html += '<label for="' + id + '">' + channel.Name + '</label>';
}
html += '</div>';
$('.channelDownloadingList', page).html(html).trigger('create');
}
function loadPage(page, config, allChannelFeatures) {
if (allChannelFeatures.length) {
$('.noChannelsHeader', page).hide();
} else {
$('.noChannelsHeader', page).show();
}
var downloadableList = allChannelFeatures.filter(function (i) {
return i.SupportsContentDownloading;
});
populateDownloadList(page, config, downloadableList);
$('#selectChannelResolution', page).val(config.PreferredStreamingWidth || '')
.selectmenu("refresh");
$('#txtDownloadAge', page).val(config.MaxDownloadAge || '');
$('#txtDownloadSizeLimit', page).val(config.DownloadSizeLimit || '');
$('#txtCachePath', page).val(config.DownloadPath || '');
$('#selectChannelResolution', page).val(config.PreferredStreamingWidth || '').selectmenu("refresh");
Dashboard.hideLoadingMsg();
}
@ -64,16 +17,6 @@
// This should be null if empty
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
config.MaxDownloadAge = $('#txtDownloadAge', form).val() || null;
config.DownloadSizeLimit = $('#txtDownloadSizeLimit', form).val() || null;
config.DownloadPath = $('#txtCachePath', form).val() || null;
config.DownloadingChannels = $('.chkChannelDownload:checked', form)
.get()
.map(function (i) {
return i.getAttribute('data-channelid');
});
ApiClient.updateNamedConfiguration("channels", config).done(Dashboard.processServerConfigurationUpdateResult);
});
@ -86,27 +29,7 @@
var page = this;
$('#btnSelectCachePath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtCachePath', page).val(path);
}
picker.close();
},
header: Globalize.translate('HeaderSelectChannelDownloadPath'),
instruction: Globalize.translate('HeaderSelectChannelDownloadPathHelp')
});
});
$('.channelSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
$('.channelSettingsForm', page).off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#channelSettingsPage", function () {
@ -114,15 +37,9 @@
var page = this;
var promise1 = ApiClient.getNamedConfiguration("channels");
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Channels/Features"));
ApiClient.getNamedConfiguration("channels").done(function (config) {
$.when(promise1, promise2).done(function (response1, response2) {
var config = response1[0];
var allFeatures = response2[0];
loadPage(page, config, allFeatures);
loadPage(page, config);
});