remove nested form from library create dialog

This commit is contained in:
dkanada 2019-05-07 12:58:16 -07:00
parent b41ae5f483
commit a5bad54c51
2 changed files with 30 additions and 34 deletions

View File

@ -1,10 +1,7 @@
define(["loading", "dialogHelper", "dom", "jQuery", "components/libraryoptionseditor/libraryoptionseditor", "emby-toggle", "emby-input", "emby-select", "paper-icon-button-light", "listViewStyle", "formDialogStyle", "emby-button", "flexStyles"], function(loading, dialogHelper, dom, $, libraryoptionseditor) {
"use strict";
function onSubmit(e) {
e.preventDefault();
e.stopPropagation();
function onAddLibrary() {
if (isCreating) return false;
if (pathInfos.length == 0) {
@ -20,10 +17,9 @@ define(["loading", "dialogHelper", "dom", "jQuery", "components/libraryoptionsed
isCreating = true;
loading.show();
var form = this;
var dlg = $(form).parents(".dialog")[0];
var name = $("#txtValue", form).val();
var type = $("#selectCollectionType", form).val();
var dlg = dom.parentWithClass(this, "dlg-librarycreator");
var name = $("#txtValue", dlg).val();
var type = $("#selectCollectionType", dlg).val();
if (type == "mixed") type = null;
var libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector(".libraryOptions"));
libraryOptions.PathInfos = pathInfos;
@ -73,7 +69,7 @@ define(["loading", "dialogHelper", "dom", "jQuery", "components/libraryoptionsed
});
page.querySelector(".btnAddFolder").addEventListener("click", onAddButtonClick);
page.querySelector("form").addEventListener("submit", onSubmit);
page.querySelector(".btnSubmit").addEventListener("click", onAddLibrary);
page.querySelector(".folderList").addEventListener("click", onRemoveClick);
page.querySelector(".chkAdvanced").addEventListener("change", onToggleAdvancedChange);
}
@ -111,10 +107,10 @@ define(["loading", "dialogHelper", "dom", "jQuery", "components/libraryoptionsed
function addMediaLocation(page, path, networkSharePath) {
var pathLower = path.toLowerCase();
var path = pathInfos.filter(function(p) {
var pathFilter = pathInfos.filter(function(p) {
return p.Path.toLowerCase() == pathLower;
});
if (path.length === 0) {
if (!pathFilter.length) {
var pathInfo = {
Path: path
};

View File

@ -5,7 +5,6 @@
<div class="formDialogContent scrollY" style="padding-top:2em;">
<div class="dialogContentInner dialog-content-centered">
<form style="margin:auto;">
<div class="inputContainer" style="text-align:right;">
<label style="width:auto;">
<input is="emby-toggle" type="checkbox" class="chkAdvanced noautofocus" />
@ -23,21 +22,22 @@
<input is="emby-input" type="text" id="txtValue" required="required" label="${LabelDisplayName}" />
</div>
<div class="folders">
<div style="display: flex; align-items: center;">
<h1 style="margin: .5em 0;">${HeadersFolders}</h1>
<button is="emby-button" type="button" class="fab btnAddFolder submit" style="margin-left:1em;" title="${ButtonAdd}">
<i class="md-icon">add</i>
</button>
</div>
<div class="paperList folderList hide" style="margin-bottom:2em;"></div>
</div>
<div class="libraryOptions"></div>
<div class="formDialogFooter">
<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">
<span>${ButtonOk}</span>
</button>
</div>
</form>
</div>
</div>
<div class="formDialogFooter">
<button is="emby-button" type="button" class="raised btnSubmit button-submit block formDialogFooterItem">
<span>${ButtonOk}</span>
</button>
</div>