TODO App example is broken #1483
Replies: 4 comments 4 replies
-
My copy of the 'TODO App' project (feel free to comment / criticize / add / whatever): |
Beta Was this translation helpful? Give feedback.
-
This is an interesting one, because what we show in the View Code actually implicitly depends on the HTML content of the demo itself, represented by: <section>
<div class="text-center w-full mb-8">
<h1
class="text-3xl font-bold text-gray-800 uppercase tracking-tight"
>
To Do List
</h1>
</div>
<div>
<input
id="new-task-content"
class="py-input"
type="text"
/>
<button
id="new-task-btn"
class="py-button"
type="submit"
py-click="add_task()"
>
Add task
</button>
</div>
<py-list id="myList"></py-list>
<div
id="list-tasks-container"
class="flex flex-col-reverse mt-4"
></div>
<template id="task-template">
<section class="task py-li-element">
<label for="flex items-center p-2 ">
<input class="mr-2" type="checkbox" />
<p class="m-0 inline"></p>
</label>
</section>
</template>
</section> and needed by the Python code: # define the task template that will be use to render new templates to the page
task_template = Element("task-template").select(".task", from_content=True)
task_list = Element("list-tasks-container")
new_task_content = Element("new-task-content") I don't know how to best move forward in fixing this View Code gotcha because it's clear to me users trying our demo that depend on specific template and other DOM nodes won't ever see these within a /cc @FabioRosado @fpliger @antocuni @JeffersGlass any idea what'd be the way forward? |
Beta Was this translation helpful? Give feedback.
-
The issue here is that, in your example @WebReflection You are right in that the |
Beta Was this translation helpful? Give feedback.
-
Yeah yeah, wasn't a formal proposal but "having the ability to... somehow". +1 on the idea of specifying selectors as well.
Good question. I see pros and cons.. I'll open a separate discussion so we can discuss there (as I think there are a few extra nuances too). |
Beta Was this translation helpful? Give feedback.
-
TODO App example is broken
About the TODO App example (https://pyscript.net/examples/todo.html).
I was trying to recreate the TODO App based on its example (View code), and got this error instantly:
Beta Was this translation helpful? Give feedback.
All reactions