mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update metadata editor
This commit is contained in:
parent
21f8bbba66
commit
40b4010ce4
3 changed files with 113 additions and 39 deletions
65
dashboard-ui/components/metadataeditor/personeditor.js
Normal file
65
dashboard-ui/components/metadataeditor/personeditor.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
define(['paperdialoghelper'], function (paperDialogHelper) {
|
||||
|
||||
return {
|
||||
show: function (person) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'components/metadataeditor/personeditor.template.html', true);
|
||||
|
||||
xhr.onload = function (e) {
|
||||
|
||||
var template = this.response;
|
||||
var dlg = paperDialogHelper.createDialog({
|
||||
removeOnClose: true,
|
||||
size: 'small'
|
||||
});
|
||||
|
||||
dlg.classList.add('ui-body-b');
|
||||
dlg.classList.add('background-theme-b');
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
var html = '';
|
||||
var submitted = false;
|
||||
|
||||
html += Globalize.translateDocument(template);
|
||||
|
||||
dlg.innerHTML = html;
|
||||
document.body.appendChild(dlg);
|
||||
|
||||
$('#txtPersonName', dlg).val(person.Name || '');
|
||||
$('#selectPersonType', dlg).val(person.Type || '');
|
||||
$('#txtPersonRole', dlg).val(person.Role || '');
|
||||
|
||||
paperDialogHelper.open(dlg);
|
||||
|
||||
dlg.addEventListener('iron-overlay-closed', function () {
|
||||
|
||||
if (submitted) {
|
||||
resolve(person);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
|
||||
dlg.querySelector('form').addEventListener('submit', function (e) {
|
||||
|
||||
submitted = true;
|
||||
|
||||
person.Name = $('#txtPersonName', dlg).val();
|
||||
person.Type = $('#selectPersonType', dlg).val();
|
||||
person.Role = $('#txtPersonRole', dlg).val() || null;
|
||||
|
||||
paperDialogHelper.close(dlg);
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue