Cleaned up script views and bound CTRL+S to save

dashboard
Pat Hartl 2023-01-16 01:54:22 -06:00
parent afc912a648
commit 65f43577b2
2 changed files with 22 additions and 10 deletions

View File

@ -24,7 +24,7 @@
<div class="row row-cards">
<div class="col-12">
<form asp-action="Add" class="card">
<div class="card-body">
<div class="card-body pb-0">
<div class="row">
<div class="col-12">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
@ -64,16 +64,14 @@
</label>
</div>
<div class="mb-3">
<div id="ScriptEditor" style="height: 100%; min-height: 70vh;"></div>
</div>
<input type="hidden" asp-for="Contents" />
<input type="hidden" asp-for="GameId" />
</div>
</div>
</div>
<div id="ScriptEditor" style="height: 100%; min-height: 600px;"></div>
<div class="card-footer">
<div class="d-flex">
<a asp-action="Edit" asp-controller="Games" asp-route-id="@Model.Game.Id" class="btn btn-ghost-primary">Cancel</a>
@ -106,5 +104,13 @@
$('#Contents').val(editor.getModel().getValue());
});
});
document.addEventListener('keydown', e => {
if (e.ctrlKey && e.key === 's') {
e.preventDefault();
$('form').submit();
}
});
</script>
}

View File

@ -24,7 +24,7 @@
<div class="row row-cards">
<div class="col-12">
<form asp-action="Edit" class="card">
<div class="card-body">
<div class="card-body pb-0">
<div class="row">
<div class="col-12">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
@ -64,10 +64,6 @@
</label>
</div>
<div class="mb-3">
<div id="ScriptEditor" style="height: 100%; min-height: 70vh;"></div>
</div>
<input type="hidden" asp-for="Contents" />
<input type="hidden" asp-for="GameId" />
<input type="hidden" asp-for="Id" />
@ -75,6 +71,8 @@
</div>
</div>
<div id="ScriptEditor" style="height: 100%; min-height: 600px;"></div>
<div class="card-footer">
<div class="d-flex">
<a asp-action="Edit" asp-controller="Games" asp-route-id="@Model.Game.Id" class="btn btn-ghost-primary">Cancel</a>
@ -107,5 +105,13 @@
$('#Contents').val(editor.getModel().getValue());
});
});
document.addEventListener('keydown', e => {
if (e.ctrlKey && e.key === 's') {
e.preventDefault();
$('form').submit();
}
});
</script>
}