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

apply suggestion

This commit is contained in:
grafixeyehero 2020-06-26 21:15:00 +03:00
parent 857c1d8e2a
commit 7fe80dcbf1
2 changed files with 22 additions and 25 deletions

View file

@ -89,31 +89,29 @@ import 'emby-input';
}); });
} }
export class editor { export class showEditor {
constructor() { constructor(itemType, options, availableOptions) {
this.show = (itemType, options, availableOptions) => { return import('text!./components/imageOptionsEditor/imageOptionsEditor.template.html').then(({default: template}) => {
return import('text!./components/imageOptionsEditor/imageOptionsEditor.template.html').then(({default: template}) => { return new Promise((resolve) => {
return new Promise((resolve) => { const dlg = dialogHelper.createDialog({
const dlg = dialogHelper.createDialog({ size: 'small',
size: 'small', removeOnClose: true,
removeOnClose: true, scrollY: false
scrollY: false });
}); dlg.classList.add('formDialog');
dlg.classList.add('formDialog'); dlg.innerHTML = globalize.translateDocument(template);
dlg.innerHTML = globalize.translateDocument(template); dlg.addEventListener('close', () => {
dlg.addEventListener('close', () => { saveValues(dlg, options);
saveValues(dlg, options); });
}); loadValues(dlg, itemType, options, availableOptions);
loadValues(dlg, itemType, options, availableOptions); dialogHelper.open(dlg).then(resolve, resolve);
dialogHelper.open(dlg).then(resolve, resolve); dlg.querySelector('.btnCancel').addEventListener('click', () => {
dlg.querySelector('.btnCancel').addEventListener('click', () => { dialogHelper.close(dlg);
dialogHelper.close(dlg);
});
}); });
}); });
}; });
} }
} }
/* eslint-enable indent */ /* eslint-enable indent */
export default editor; export default showEditor;

View file

@ -306,7 +306,7 @@ import 'emby-input';
} }
function showImageOptionsForType(type) { function showImageOptionsForType(type) {
import('imageoptionseditor').then(({default: ImageOptionsEditor}) => { import('imageoptionseditor').then(ImageOptionsEditor => {
let typeOptions = getTypeOptions(currentLibraryOptions, type); let typeOptions = getTypeOptions(currentLibraryOptions, type);
if (!typeOptions) { if (!typeOptions) {
typeOptions = { typeOptions = {
@ -315,8 +315,7 @@ import 'emby-input';
currentLibraryOptions.TypeOptions.push(typeOptions); currentLibraryOptions.TypeOptions.push(typeOptions);
} }
const availableOptions = getTypeOptions(currentAvailableOptions || {}, type); const availableOptions = getTypeOptions(currentAvailableOptions || {}, type);
const imageOptionsEditor = new ImageOptionsEditor(); new ImageOptionsEditor.showEditor(type, typeOptions, availableOptions);
imageOptionsEditor.show(type, typeOptions, availableOptions);
}); });
} }