mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add sync settings page
This commit is contained in:
parent
6b91120cb9
commit
b43195c9aa
8 changed files with 119 additions and 30 deletions
64
dashboard-ui/scripts/mysyncsettings.js
Normal file
64
dashboard-ui/scripts/mysyncsettings.js
Normal file
|
@ -0,0 +1,64 @@
|
|||
(function ($, window, document) {
|
||||
|
||||
function loadForm(page, user) {
|
||||
|
||||
page.querySelector('.chkSyncToExternalCard').checked = AppSettings.enableSyncToExternalStorage();
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
function saveUser(page, user) {
|
||||
|
||||
AppSettings.enableSyncToExternalStorage(page.querySelector('.chkSyncToExternalCard').checked);
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
|
||||
var page = $(this).parents('.page')[0];
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
|
||||
saveUser(page, user);
|
||||
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageinitdepends', "#syncPreferencesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('form').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
$('.btnSelectSyncPath', page).on('click', function () {
|
||||
|
||||
require(['nativedirectorychooser'], function () {
|
||||
NativeDirectoryChooser.chooseDirectory().done(function (path) {
|
||||
$('#txtSyncPath', page).val(path);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}).on('pageshowready', "#syncPreferencesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
|
||||
loadForm(page, user);
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, window, document);
|
Loading…
Add table
Add a link
Reference in a new issue