mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add options to library setup
This commit is contained in:
parent
d28cb2cc7e
commit
1895de9249
8 changed files with 94 additions and 45 deletions
|
@ -1728,7 +1728,7 @@
|
||||||
* Adds a virtual folder
|
* Adds a virtual folder
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
*/
|
*/
|
||||||
self.addVirtualFolder = function (name, type, refreshLibrary, initialPaths) {
|
self.addVirtualFolder = function (name, type, refreshLibrary, initialPaths, libraryOptions) {
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
throw new Error("null name");
|
throw new Error("null name");
|
||||||
|
@ -1751,7 +1751,8 @@
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: url,
|
url: url,
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
Paths: initialPaths
|
Paths: initialPaths,
|
||||||
|
LibraryOptions: libraryOptions
|
||||||
}),
|
}),
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
define(['globalize', 'emby-checkbox'], function (globalize) {
|
||||||
|
|
||||||
|
function embed(parent, contentType) {
|
||||||
|
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'components/libraryoptionseditor/libraryoptionseditor.template.html', true);
|
||||||
|
|
||||||
|
xhr.onload = function (e) {
|
||||||
|
|
||||||
|
var template = this.response;
|
||||||
|
parent.innerHTML = globalize.translateDocument(template);
|
||||||
|
|
||||||
|
setContentType(parent, contentType);
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function setContentType(parent, contentType) {
|
||||||
|
|
||||||
|
if (contentType == 'music' || contentType == 'tvshows' || contentType == 'movies' || contentType == 'homevideos' || contentType == 'musicvideos' || contentType == 'mixed') {
|
||||||
|
parent.querySelector('.chkArhiveAsMediaContainer').classList.remove('hide');
|
||||||
|
} else {
|
||||||
|
parent.querySelector('.chkArhiveAsMediaContainer').classList.add('hide');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contentType == 'music' || contentType == 'tvshows' || contentType == 'movies' || contentType == 'homevideos' || contentType == 'musicvideos' || contentType == 'mixed') {
|
||||||
|
parent.classList.remove('hide');
|
||||||
|
} else {
|
||||||
|
parent.classList.add('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLibraryOptions(parent) {
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
EnableVideoArchiveFiles: parent.querySelector('.chkArhiveAsMedia').checked
|
||||||
|
};
|
||||||
|
|
||||||
|
options.EnableAudioArchiveFiles = options.EnableVideoArchiveFiles;
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
embed: embed,
|
||||||
|
setContentType: setContentType,
|
||||||
|
getLibraryOptions: getLibraryOptions
|
||||||
|
};
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
<h1>${HeaderSettings}</h1>
|
||||||
|
<div class="checkboxContainer checkboxContainer-withDescription chkArhiveAsMediaContainer">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" is="emby-checkbox" class="chkArhiveAsMedia" />
|
||||||
|
<span>${OptionDetectArchiveFilesAsMedia}</span>
|
||||||
|
</label>
|
||||||
|
<div class="fieldDescription checkboxFieldDescription">${OptionDetectArchiveFilesAsMediaHelp}</div>
|
||||||
|
</div>
|
|
@ -1,4 +1,4 @@
|
||||||
define(['dialogHelper', 'jQuery', 'emby-input', 'emby-select', 'paper-icon-button-light', 'listViewStyle', 'formDialogStyle'], function (dialogHelper, $) {
|
define(['dialogHelper', 'jQuery', 'components/libraryoptionseditor/libraryoptionseditor', 'emby-input', 'emby-select', 'paper-icon-button-light', 'listViewStyle', 'formDialogStyle'], function (dialogHelper, $, libraryoptionseditor) {
|
||||||
|
|
||||||
var currentDeferred;
|
var currentDeferred;
|
||||||
var hasChanges;
|
var hasChanges;
|
||||||
|
@ -27,7 +27,9 @@
|
||||||
type = null;
|
type = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.addVirtualFolder(name, type, currentOptions.refresh, paths).then(function () {
|
var libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions'));
|
||||||
|
|
||||||
|
ApiClient.addVirtualFolder(name, type, currentOptions.refresh, paths, libraryOptions).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
|
@ -59,12 +61,16 @@
|
||||||
|
|
||||||
$('#selectCollectionType', page).html(getCollectionTypeOptionsHtml(collectionTypeOptions)).val('').on('change', function () {
|
$('#selectCollectionType', page).html(getCollectionTypeOptionsHtml(collectionTypeOptions)).val('').on('change', function () {
|
||||||
|
|
||||||
if (this.value == 'mixed') {
|
var value = this.value;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var dlg = $(this).parents('.dialog')[0];
|
var dlg = $(this).parents('.dialog')[0];
|
||||||
|
|
||||||
|
libraryoptionseditor.setContentType(dlg.querySelector('.libraryOptions'), value);
|
||||||
|
|
||||||
|
if (value == 'mixed') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var index = this.selectedIndex;
|
var index = this.selectedIndex;
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
|
||||||
|
@ -72,8 +78,6 @@
|
||||||
.replace('*', '')
|
.replace('*', '')
|
||||||
.replace('&', '&');
|
.replace('&', '&');
|
||||||
|
|
||||||
var value = this.value;
|
|
||||||
|
|
||||||
$('#txtValue', dlg).val(name);
|
$('#txtValue', dlg).val(name);
|
||||||
|
|
||||||
var folderOption = collectionTypeOptions.filter(function (i) {
|
var folderOption = collectionTypeOptions.filter(function (i) {
|
||||||
|
@ -178,6 +182,10 @@
|
||||||
currentDeferred.resolveWith(null, [hasChanges]);
|
currentDeferred.resolveWith(null, [hasChanges]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initLibraryOptions(dlg) {
|
||||||
|
libraryoptionseditor.embed(dlg.querySelector('.libraryOptions'));
|
||||||
|
}
|
||||||
|
|
||||||
function editor() {
|
function editor() {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -225,6 +233,7 @@
|
||||||
|
|
||||||
paths = [];
|
paths = [];
|
||||||
renderPaths(dlg);
|
renderPaths(dlg);
|
||||||
|
initLibraryOptions(dlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
xhr.send();
|
xhr.send();
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="inputContainer">
|
<div class="inputContainer">
|
||||||
<input is="emby-input" type="text" id="txtValue" required="required" label="${LabelDisplayName}" />
|
<input is="emby-input" type="text" id="txtValue" required="required" label="${LabelDisplayName}"/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div style="display: flex; align-items: center;">
|
||||||
<h1 style="display:inline-block;vertical-align:middle;">${HeadersFolders}</h1>
|
<h1 style="margin: .5em 0;">${HeadersFolders}</h1>
|
||||||
<button is="emby-button" type="button" class="raised btnAddFolder submit mini" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="raised btnAddFolder submit mini" style="margin-left:1em;" title="${ButtonAdd}">
|
||||||
<i class="md-icon">add</i>
|
<i class="md-icon">add</i>
|
||||||
<span>${ButtonAdd}</span>
|
<span>${ButtonAdd}</span>
|
||||||
|
@ -25,6 +25,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="paperList folderList hide" style="padding: .7em 0;"></div>
|
<div class="paperList folderList hide" style="padding: .7em 0;"></div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<div class="libraryOptions"></div>
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised submit block">
|
<button is="emby-button" type="submit" class="raised submit block">
|
||||||
|
|
|
@ -629,8 +629,8 @@ progress {
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-body-a .emby-collapsible-title {
|
.ui-body-a .emby-collapsible-title {
|
||||||
margin: .25em 0;
|
margin: 0;
|
||||||
color: #000;
|
color: #333;
|
||||||
padding: 0 0 0 .5em;
|
padding: 0 0 0 .5em;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
|
|
||||||
new medialibrarycreator().show({
|
new medialibrarycreator().show({
|
||||||
|
|
||||||
collectionTypeOptions: getCollectionTypeOptions(),
|
collectionTypeOptions: getCollectionTypeOptions().filter(function (f) {
|
||||||
|
return !f.hidden;
|
||||||
|
}),
|
||||||
refresh: shouldRefreshLibraryAfterChanges(page)
|
refresh: shouldRefreshLibraryAfterChanges(page)
|
||||||
|
|
||||||
}).then(function (hasChanges) {
|
}).then(function (hasChanges) {
|
||||||
|
@ -245,7 +247,7 @@
|
||||||
{ name: Globalize.translate('FolderTypeTvShows'), value: "tvshows" },
|
{ name: Globalize.translate('FolderTypeTvShows'), value: "tvshows" },
|
||||||
{ name: Globalize.translate('FolderTypeBooks'), value: "books", message: Globalize.translate('MessageBookPluginRequired') },
|
{ name: Globalize.translate('FolderTypeBooks'), value: "books", message: Globalize.translate('MessageBookPluginRequired') },
|
||||||
{ name: Globalize.translate('FolderTypeGames'), value: "games", message: Globalize.translate('MessageGamePluginRequired') },
|
{ name: Globalize.translate('FolderTypeGames'), value: "games", message: Globalize.translate('MessageGamePluginRequired') },
|
||||||
{ name: Globalize.translate('FolderTypeHomeVideos'), value: "homevideos" },
|
{ name: Globalize.translate('OptionHomeVideos'), value: "homevideos" },
|
||||||
{ name: Globalize.translate('FolderTypeMusicVideos'), value: "musicvideos" },
|
{ name: Globalize.translate('FolderTypeMusicVideos'), value: "musicvideos" },
|
||||||
{ name: Globalize.translate('FolderTypePhotos'), value: "photos" },
|
{ name: Globalize.translate('FolderTypePhotos'), value: "photos" },
|
||||||
{ name: Globalize.translate('FolderTypeUnset'), value: "mixed", message: Globalize.translate('MessageUnsetContentHelp') }
|
{ name: Globalize.translate('FolderTypeUnset'), value: "mixed", message: Globalize.translate('MessageUnsetContentHelp') }
|
||||||
|
@ -406,33 +408,6 @@
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
pageClassOn('pageinit', "mediaLibraryPage", function () {
|
|
||||||
|
|
||||||
var page = this;
|
|
||||||
$('#selectCollectionType', page).on('change', function () {
|
|
||||||
|
|
||||||
var index = this.selectedIndex;
|
|
||||||
if (index != -1) {
|
|
||||||
|
|
||||||
var name = this.options[index].innerHTML
|
|
||||||
.replace('*', '')
|
|
||||||
.replace('&', '&');
|
|
||||||
|
|
||||||
var value = this.value;
|
|
||||||
|
|
||||||
$('#txtValue', page).val(name);
|
|
||||||
|
|
||||||
var folderOption = getCollectionTypeOptions().filter(function (i) {
|
|
||||||
|
|
||||||
return i.value == value;
|
|
||||||
|
|
||||||
})[0];
|
|
||||||
|
|
||||||
$('.collectionTypeFieldDescription', page).html(folderOption.message || '');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
window.WizardLibraryPage = {
|
window.WizardLibraryPage = {
|
||||||
|
|
||||||
next: function () {
|
next: function () {
|
||||||
|
|
|
@ -91,7 +91,6 @@
|
||||||
"FolderTypeMusic": "Music",
|
"FolderTypeMusic": "Music",
|
||||||
"FolderTypePhotos": "Photos",
|
"FolderTypePhotos": "Photos",
|
||||||
"FolderTypeMusicVideos": "Music videos",
|
"FolderTypeMusicVideos": "Music videos",
|
||||||
"FolderTypeHomeVideos": "Home videos",
|
|
||||||
"FolderTypeGames": "Games",
|
"FolderTypeGames": "Games",
|
||||||
"FolderTypeBooks": "Books",
|
"FolderTypeBooks": "Books",
|
||||||
"FolderTypeTvShows": "TV",
|
"FolderTypeTvShows": "TV",
|
||||||
|
@ -1862,7 +1861,7 @@
|
||||||
"OptionMusicAlbums": "Music albums",
|
"OptionMusicAlbums": "Music albums",
|
||||||
"OptionMusicVideos": "Music videos",
|
"OptionMusicVideos": "Music videos",
|
||||||
"OptionSongs": "Songs",
|
"OptionSongs": "Songs",
|
||||||
"OptionHomeVideos": "Home videos",
|
"OptionHomeVideos": "Home videos & photos",
|
||||||
"OptionBooks": "Books",
|
"OptionBooks": "Books",
|
||||||
"ButtonUp": "Up",
|
"ButtonUp": "Up",
|
||||||
"ButtonDown": "Down",
|
"ButtonDown": "Down",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue