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:
@@ -4,20 +4,9 @@
|
||||
<button type="submit">Add</button>
|
||||
</form>
|
||||
<p data-hemx-slot="summary">{+ self.summary +}</p>
|
||||
<div data-hemx-slot="todo_list">
|
||||
<ul data-hemx-slot="todo_row">
|
||||
<template h-for="todo in &self.items" h-key="todo.id">
|
||||
<li data-hemx-slot="todo_row" +data-key="todo.id">
|
||||
<span>{+ todo.title +}</span>
|
||||
<form data-hemx-handle="rename_todo">
|
||||
<input type="hidden" name="id" +value="todo.id">
|
||||
<button type="submit" name="title" value="Renamed todo">Rename</button>
|
||||
</form>
|
||||
<form data-hemx-handle="delete_todo">
|
||||
<button type="submit" name="id" +value="todo.id">Delete</button>
|
||||
</form>
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
</div>
|
||||
<ul data-hemx-slot="todo_row">
|
||||
<template h-for="row in &self.rows" h-key="row.id">
|
||||
{+ row +}
|
||||
</template>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user