feat(hemx): reuse todo row partials
Make the canonical v0 todo flow use one TodoRow partial shape for initial list rendering and generated keyed append/replace/remove helpers. Teach hemx-build to treat collection hosts with keyed h-for children as keyed targets, so beginner templates can keep the DRY outer slot + child partial composition. req: canonical_authoring/002 req: canonical_authoring/003 req: examples/004 req: list/001
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
<template h-if="!self.items.is_empty()">
|
||||
<li h-for="todo in &self.items" +data-key="todo.id">{+ todo.title +}</li>
|
||||
</template>
|
||||
@@ -1,10 +1,10 @@
|
||||
<li>
|
||||
<li +data-key="self.id">
|
||||
<span>{+ self.title +}</span>
|
||||
<form data-hemx-handle="rename_todo_row">
|
||||
<form data-hemx-handle="rename_todo">
|
||||
<input type="hidden" name="id" +value="self.id">
|
||||
<button type="submit" name="title" value="Renamed todo">Rename</button>
|
||||
</form>
|
||||
<form data-hemx-handle="delete_todo_row">
|
||||
<form data-hemx-handle="delete_todo">
|
||||
<button type="submit" name="id" +value="self.id">Delete</button>
|
||||
</form>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user