mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
add submit button to library edit dialog
This commit is contained in:
parent
a5bad54c51
commit
aa14b34035
@ -1,6 +1,28 @@
|
|||||||
define(["loading", "dialogHelper", "dom", "components/libraryoptionseditor/libraryoptionseditor", "emby-button", "listViewStyle", "paper-icon-button-light", "formDialogStyle", "emby-toggle", "flexStyles"], function(loading, dialogHelper, dom, libraryoptionseditor) {
|
define(["loading", "dialogHelper", "dom", "components/libraryoptionseditor/libraryoptionseditor", "emby-button", "listViewStyle", "paper-icon-button-light", "formDialogStyle", "emby-toggle", "flexStyles"], function(loading, dialogHelper, dom, libraryoptionseditor) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
function onEditLibrary() {
|
||||||
|
if (isCreating) return false;
|
||||||
|
|
||||||
|
isCreating = true;
|
||||||
|
loading.show();
|
||||||
|
|
||||||
|
var dlg = dom.parentWithClass(this, "dlg-libraryeditor");
|
||||||
|
var libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector(".libraryOptions"));
|
||||||
|
libraryOptions = Object.assign(currentOptions.library.LibraryOptions || {}, libraryOptions);
|
||||||
|
|
||||||
|
ApiClient.updateVirtualFolderOptions(currentOptions.library.ItemId, libraryOptions).then(function() {
|
||||||
|
hasChanges = true;
|
||||||
|
isCreating = false;
|
||||||
|
loading.hide();
|
||||||
|
dialogHelper.close(dlg);
|
||||||
|
}, function() {
|
||||||
|
isCreating = false;
|
||||||
|
loading.hide();
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function addMediaLocation(page, path, networkSharePath) {
|
function addMediaLocation(page, path, networkSharePath) {
|
||||||
var virtualFolder = currentOptions.library;
|
var virtualFolder = currentOptions.library;
|
||||||
var refreshAfterChange = currentOptions.refresh;
|
var refreshAfterChange = currentOptions.refresh;
|
||||||
@ -138,21 +160,13 @@ define(["loading", "dialogHelper", "dom", "components/libraryoptionseditor/libra
|
|||||||
dlg.querySelector(".btnAddFolder").addEventListener("click", onAddButtonClick);
|
dlg.querySelector(".btnAddFolder").addEventListener("click", onAddButtonClick);
|
||||||
dlg.querySelector(".folderList").addEventListener("click", onListItemClick);
|
dlg.querySelector(".folderList").addEventListener("click", onListItemClick);
|
||||||
dlg.querySelector(".chkAdvanced").addEventListener("change", onToggleAdvancedChange);
|
dlg.querySelector(".chkAdvanced").addEventListener("change", onToggleAdvancedChange);
|
||||||
|
dlg.querySelector(".btnSubmit").addEventListener("click", onEditLibrary);
|
||||||
libraryoptionseditor.embed(dlg.querySelector(".libraryOptions"), options.library.CollectionType, options.library.LibraryOptions).then(function() {
|
libraryoptionseditor.embed(dlg.querySelector(".libraryOptions"), options.library.CollectionType, options.library.LibraryOptions).then(function() {
|
||||||
onToggleAdvancedChange.call(dlg.querySelector(".chkAdvanced"));
|
onToggleAdvancedChange.call(dlg.querySelector(".chkAdvanced"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosing() {
|
|
||||||
var dlg = this;
|
|
||||||
var libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector(".libraryOptions"));
|
|
||||||
libraryOptions = Object.assign(currentOptions.library.LibraryOptions || {}, libraryOptions);
|
|
||||||
ApiClient.updateVirtualFolderOptions(currentOptions.library.ItemId, libraryOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
loading.hide();
|
|
||||||
hasChanges = true;
|
|
||||||
currentDeferred.resolveWith(null, [hasChanges]);
|
currentDeferred.resolveWith(null, [hasChanges]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +193,6 @@ define(["loading", "dialogHelper", "dom", "components/libraryoptionseditor/libra
|
|||||||
dlg.innerHTML = Globalize.translateDocument(template);
|
dlg.innerHTML = Globalize.translateDocument(template);
|
||||||
dlg.querySelector(".formDialogHeaderTitle").innerHTML = options.library.Name;
|
dlg.querySelector(".formDialogHeaderTitle").innerHTML = options.library.Name;
|
||||||
initEditor(dlg, options);
|
initEditor(dlg, options);
|
||||||
dlg.addEventListener("closing", onDialogClosing);
|
|
||||||
dlg.addEventListener("close", onDialogClosed);
|
dlg.addEventListener("close", onDialogClosed);
|
||||||
dialogHelper.open(dlg);
|
dialogHelper.open(dlg);
|
||||||
dlg.querySelector(".btnCancel").addEventListener("click", function() {
|
dlg.querySelector(".btnCancel").addEventListener("click", function() {
|
||||||
@ -196,6 +209,7 @@ define(["loading", "dialogHelper", "dom", "components/libraryoptionseditor/libra
|
|||||||
var currentOptions;
|
var currentOptions;
|
||||||
|
|
||||||
var hasChanges = false;
|
var hasChanges = false;
|
||||||
|
var isCreating = false;
|
||||||
|
|
||||||
return editor;
|
return editor;
|
||||||
});
|
});
|
@ -29,3 +29,9 @@
|
|||||||
<div class="libraryOptions"></div>
|
<div class="libraryOptions"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="formDialogFooter">
|
||||||
|
<button is="emby-button" type="button" class="raised btnSubmit button-submit block formDialogFooterItem">
|
||||||
|
<span>${ButtonOk}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user