mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-16 18:38:25 -07:00
apply suggestion
This commit is contained in:
parent
7fe80dcbf1
commit
f54b13224d
@ -89,29 +89,37 @@ import 'emby-input';
|
||||
});
|
||||
}
|
||||
|
||||
export class showEditor {
|
||||
constructor(itemType, options, availableOptions) {
|
||||
return import('text!./components/imageOptionsEditor/imageOptionsEditor.template.html').then(({default: template}) => {
|
||||
return new Promise((resolve) => {
|
||||
const dlg = dialogHelper.createDialog({
|
||||
size: 'small',
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
});
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.innerHTML = globalize.translateDocument(template);
|
||||
dlg.addEventListener('close', () => {
|
||||
saveValues(dlg, options);
|
||||
});
|
||||
loadValues(dlg, itemType, options, availableOptions);
|
||||
dialogHelper.open(dlg).then(resolve, resolve);
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
});
|
||||
async function showEditor(itemType, options, availableOptions) {
|
||||
const response = await fetch('components/imageOptionsEditor/imageOptionsEditor.template.html');
|
||||
const template = await response.text();
|
||||
|
||||
var dlg = dialogHelper.createDialog({
|
||||
size: 'small',
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
});
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.innerHTML = globalize.translateDocument(template);
|
||||
dlg.addEventListener('close', function () {
|
||||
saveValues(dlg, options);
|
||||
});
|
||||
loadValues(dlg, itemType, options, availableOptions);
|
||||
dialogHelper.open(dlg).then(() => {
|
||||
return;
|
||||
}).catch(() => {
|
||||
return;
|
||||
});
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
export class editor {
|
||||
constructor() {
|
||||
this.show = showEditor;
|
||||
}
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
export default showEditor;
|
||||
export default editor;
|
||||
|
@ -306,7 +306,7 @@ import 'emby-input';
|
||||
}
|
||||
|
||||
function showImageOptionsForType(type) {
|
||||
import('imageoptionseditor').then(ImageOptionsEditor => {
|
||||
import('imageoptionseditor').then(({default: ImageOptionsEditor}) => {
|
||||
let typeOptions = getTypeOptions(currentLibraryOptions, type);
|
||||
if (!typeOptions) {
|
||||
typeOptions = {
|
||||
@ -315,7 +315,8 @@ import 'emby-input';
|
||||
currentLibraryOptions.TypeOptions.push(typeOptions);
|
||||
}
|
||||
const availableOptions = getTypeOptions(currentAvailableOptions || {}, type);
|
||||
new ImageOptionsEditor.showEditor(type, typeOptions, availableOptions);
|
||||
const imageOptionsEditor = new ImageOptionsEditor();
|
||||
imageOptionsEditor.show(type, typeOptions, availableOptions);
|
||||
});
|
||||
}
|
||||
|
||||
@ -356,25 +357,23 @@ import 'emby-input';
|
||||
parent.querySelector('.imageFetchers').addEventListener('click', onImageFetchersContainerClick);
|
||||
}
|
||||
|
||||
export function embed(parent, contentType, libraryOptions) {
|
||||
export async function embed(parent, contentType, libraryOptions) {
|
||||
currentLibraryOptions = {
|
||||
TypeOptions: []
|
||||
};
|
||||
currentAvailableOptions = null;
|
||||
const isNewLibrary = null === libraryOptions;
|
||||
isNewLibrary && parent.classList.add('newlibrary');
|
||||
return import('text!./libraryoptionseditor.template.html').then(({default: template}) => {
|
||||
return new Promise((resolve) => {
|
||||
parent.innerHTML = globalize.translateDocument(template);
|
||||
populateRefreshInterval(parent.querySelector('#selectAutoRefreshInterval'));
|
||||
const promises = [populateLanguages(parent), populateCountries(parent.querySelector('#selectCountry'))];
|
||||
Promise.all(promises).then(() => {
|
||||
return setContentType(parent, contentType).then(() => {
|
||||
libraryOptions && setLibraryOptions(parent, libraryOptions);
|
||||
bindEvents(parent);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
const response = await fetch('components/libraryoptionseditor/libraryoptionseditor.template.html');
|
||||
const template = await response.text();
|
||||
parent.innerHTML = globalize.translateDocument(template);
|
||||
populateRefreshInterval(parent.querySelector('#selectAutoRefreshInterval'));
|
||||
const promises = [populateLanguages(parent), populateCountries(parent.querySelector('#selectCountry'))];
|
||||
Promise.all(promises).then(function() {
|
||||
return setContentType(parent, contentType).then(function() {
|
||||
libraryOptions && setLibraryOptions(parent, libraryOptions);
|
||||
bindEvents(parent);
|
||||
return;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user