Use InstructionViewModel

This commit is contained in:
franc
2025-04-28 15:00:50 +02:00
parent 9c1584d621
commit aa5cc3d683
@@ -1,16 +1,17 @@
@Html.AntiForgeryToken()
@model Francesco.Recipes.World.Models.InstructionViewModel
@Html.AntiForgeryToken()
<div id="instructions-container">
@for (int i = 0; i < Model.Count; i++)
@for (int i = 0; i < Model.Instructions.Count; i++)
{
<div class="instruction-item" id="instruction-@Model[i].Id">
<div class="instruction-item" id="instruction-@Model.Instructions[i].Id">
<div class="instruction-controls">
<input type="file" />
<textarea placeholder="Beschreibung" class="form-control">@Model[i].Description</textarea>
<button type="button" class="btn-delete" onclick="removeInstruction('@Model[i].Id')">🗑️</button>
<textarea placeholder="Beschreibung" class="form-control">@Model.Instructions[i].Description</textarea>
<button type="button" class="btn-delete" onclick="removeInstruction('@Model.Instructions[i].Id')">🗑️</button>
</div>
<div class="instruction-actions">
<button type="button" class="btn-move-up" onclick="moveInstructionUp('@Model[i].Id')">⬆️</button>
<button type="button" class="btn-move-down" onclick="moveInstructionDown('@Model[i].Id')">⬇️</button>
<button type="button" class="btn-move-up" onclick="moveInstructionUp('@Model.Instructions[i].Id')">⬆️</button>
<button type="button" class="btn-move-down" onclick="moveInstructionDown('@Model.Instructions[i].Id')">⬇️</button>
</div>
</div>
}
@@ -18,6 +19,7 @@
<button type="button" class="btn-add" onclick="addInstruction()">Schritte hinzufügen</button>
@section Scripts {
<script>
htmx.on('htmx:afterSwap', (event) => {