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

add images table

This commit is contained in:
Luke Pulverenti 2016-06-03 12:24:04 -04:00
parent 417821cb5a
commit 2ebcfe8642
6 changed files with 12 additions and 141 deletions

View file

@ -1,78 +1,18 @@
define(['jQuery'], function ($) {
function load(page, devices, config) {
if (devices.length) {
$('.noDevices', page).hide();
$('.devicesUploadForm', page).show();
} else {
$('.noDevices', page).show();
$('.devicesUploadForm', page).hide();
}
function load(page, config) {
$('#txtUploadPath', page).val(config.CameraUploadPath || '');
$('#chkSubfolder', page).checked(config.EnableCameraUploadSubfolders);
loadDeviceList(page, devices, config);
}
function loadDeviceList(page, devices, config) {
var html = '';
html += '<div class="paperListLabel">';
html += Globalize.translate('LabelEnableCameraUploadFor');
html += '</div>';
html += '<div class="paperCheckboxList paperList">';
var index = 0;
html += devices.map(function (d) {
var deviceHtml = '';
var isChecked = config.EnabledCameraUploadDevices.indexOf(d.Id) != -1;
var checkedHtml = isChecked ? ' checked="checked"' : '';
var label = d.Name;
if (d.AppName) {
label += ' - ' + d.AppName;
}
deviceHtml += '<paper-checkbox class="chkDevice" data-id="' + d.Id + '"' + checkedHtml + '>' + label + '</paper-checkbox>';
index++;
return deviceHtml;
}).join('');
html += '</div>';
html += '<div class="fieldDescription">';
html += Globalize.translate('LabelEnableCameraUploadForHelp');
html += '</div>';
$('.devicesList', page).html(html).trigger('create');
}
function loadData(page) {
Dashboard.showLoadingMsg();
var promise1 = ApiClient.getNamedConfiguration("devices");
var promise2 = ApiClient.getJSON(ApiClient.getUrl('Devices', {
SupportsContentUploading: true
}));
Promise.all([promise1, promise2]).then(function (responses) {
load(page, responses[1].Items, responses[0]);
ApiClient.getNamedConfiguration("devices").then(function (config) {
load(page, config);
Dashboard.hideLoadingMsg();
});
@ -84,16 +24,6 @@
config.CameraUploadPath = $('#txtUploadPath', page).val();
config.EnabledCameraUploadDevices = $('.chkDevice', page).get().filter(function (c) {
return c.checked;
}).map(function (c) {
return c.getAttribute('data-id');
});
config.EnableCameraUploadSubfolders = $('#chkSubfolder', page).checked();
ApiClient.updateNamedConfiguration("devices", config).then(Dashboard.processServerConfigurationUpdateResult);