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
|
@ -334,10 +334,12 @@
|
|||
|
||||
.overflowPortraitCard {
|
||||
width: 40%;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.overflowBackdropCard {
|
||||
width: 80%;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.cardProgress {
|
||||
|
|
|
@ -48,16 +48,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detailSection syncSettingsSection">
|
||||
<h1>
|
||||
${HeaderSync}
|
||||
</h1>
|
||||
<div class="detailSectionContent">
|
||||
<paper-checkbox class="chkSyncToExternalCard">${OptionSyncToSDCard}</paper-checkbox>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detailSection requiresUserPreferences">
|
||||
<h1>
|
||||
${HeaderDisplay}<span style="color:#52B54B;margin-left:.5em;">*</span>
|
||||
|
|
|
@ -83,6 +83,16 @@
|
|||
</paper-item-body>
|
||||
</paper-icon-item>
|
||||
</a>
|
||||
|
||||
<a href="#" class="clearLink lnkSync hide">
|
||||
<paper-icon-item>
|
||||
<paper-fab class="avatar" icon="refresh" style="background-color:#673AB7;" item-icon></paper-fab>
|
||||
<paper-item-body two-line>
|
||||
<div>${ButtonSyncSettings}</div>
|
||||
<div secondary>${ButtonSyncHelp}</div>
|
||||
</paper-item-body>
|
||||
</paper-icon-item>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
32
dashboard-ui/mysyncsettings.html
Normal file
32
dashboard-ui/mysyncsettings.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Emby</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="syncPreferencesPage" data-role="page" class="page libraryPage userPreferencesPage noSecondaryNavPage" data-title="${ButtonSyncSettings}" data-require="scripts/mysyncsettings,paperbuttonstyle,jqmicons" data-backbutton="true" data-menubutton="false">
|
||||
|
||||
<div data-role="content">
|
||||
<form class="userProfileSettingsForm" style="margin: 0 auto;">
|
||||
|
||||
<h1>
|
||||
${HeaderSync}
|
||||
</h1>
|
||||
<div class="detailSectionContent">
|
||||
|
||||
<br />
|
||||
<paper-checkbox class="chkSyncToExternalCard">${OptionSyncToSDCard}</paper-checkbox>
|
||||
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<button type="submit" data-role="none" class="clearButton">
|
||||
<paper-button raised class="submit block"><iron-icon icon="check"></iron-icon><span>${ButtonSave}</span></paper-button>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -8,4 +8,11 @@
|
|||
$('.lnkLanguagePreferences', page).attr('href', 'mypreferenceslanguages.html?userId=' + userId);
|
||||
$('.lnkHomeScreenPreferences', page).attr('href', 'mypreferenceshome.html?userId=' + userId);
|
||||
$('.lnkMyProfile', page).attr('href', 'myprofile.html?userId=' + userId);
|
||||
$('.lnkSync', page).attr('href', 'mysyncsettings.html?userId=' + userId);
|
||||
|
||||
if (AppInfo.supportsSyncPathSetting) {
|
||||
page.querySelector('.lnkSync').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.lnkSync').classList.add('hide');
|
||||
}
|
||||
});
|
|
@ -11,7 +11,6 @@
|
|||
$('#selectBackdrop', page).val(appStorage.getItem('enableBackdrops-' + user.Id) || '').selectmenu("refresh");
|
||||
|
||||
page.querySelector('.chkEnableFullScreen').checked = AppSettings.enableFullScreen();
|
||||
page.querySelector('.chkSyncToExternalCard').checked = AppSettings.enableSyncToExternalStorage();
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
@ -28,8 +27,6 @@
|
|||
appStorage.setItem('enableThemeSongs-' + user.Id, $('#selectThemeSong', page).val());
|
||||
appStorage.setItem('enableBackdrops-' + user.Id, $('#selectBackdrop', page).val());
|
||||
|
||||
AppSettings.enableSyncToExternalStorage(page.querySelector('.chkSyncToExternalCard').checked);
|
||||
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).done(function () {
|
||||
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||
|
||||
|
@ -61,15 +58,6 @@
|
|||
|
||||
$('.displayPreferencesForm').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', "#displayPreferencesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
@ -96,12 +84,6 @@
|
|||
} else {
|
||||
$('.fldFullscreen', page).hide();
|
||||
}
|
||||
|
||||
if (AppInfo.supportsSyncPathSetting) {
|
||||
$('.syncSettingsSection', page).show();
|
||||
} else {
|
||||
$('.syncSettingsSection', page).hide();
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery, window, document);
|
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);
|
|
@ -1509,7 +1509,9 @@
|
|||
"ButtonHomeScreenSettingsHelp": "Configure the display of your home screen",
|
||||
"ButtonPlaybackSettingsHelp": "Specify your audio and subtitle preferences, streaming quality, and more.",
|
||||
"ButtonProfileHelp": "Set your profile image and password.",
|
||||
"HeaderHomeScreenSettings": "Home Screen Settings",
|
||||
"HeaderHomeScreenSettings": "Home Screen settings",
|
||||
"HeaderProfile": "Profile",
|
||||
"HeaderLanguage": "Language"
|
||||
"HeaderLanguage": "Language",
|
||||
"ButtonSyncSettings": "Sync settings",
|
||||
"ButtonSyncSettingsHelp": "Configure your sync settings"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue