This commit is contained in:
parent
4eb4b28609
commit
5afeefa0ba
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
__pycache__
|
||||
static/.webassets_cache
|
22
app.py
22
app.py
@ -110,28 +110,6 @@ def post_a_post(post_key):
|
||||
# pass
|
||||
|
||||
|
||||
### stolen
|
||||
@app.route("/todo")
|
||||
def page_todo():
|
||||
return render_template("page1.html")
|
||||
|
||||
|
||||
@app.route("/search", methods=["POST"])
|
||||
def search_todo():
|
||||
search_term = request.form.get("search")
|
||||
|
||||
if not len(search_term):
|
||||
return render_template("todo.html", host_id=docker_short_id, todos=[])
|
||||
|
||||
res_todos = []
|
||||
for todo in todos:
|
||||
if search_term in todo["title"]:
|
||||
res_todos.append(todo)
|
||||
|
||||
return render_template("todo.html", host_id=docker_short_id, todos=res_todos)
|
||||
### /stolen
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True, host='0.0.0.0')
|
Binary file not shown.
Binary file not shown.
@ -1,36 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="panel-block">
|
||||
|
||||
<div class="w-small w-2/3 mx-auto py-10 text-gray-600">
|
||||
<input
|
||||
type="text"
|
||||
name="search"
|
||||
hx-post="/search"
|
||||
hx-trigger="keyup changed delay:250ms"
|
||||
hx-indicator=".htmx-indicator"
|
||||
hx-target="#todo-results"
|
||||
placeholder="Search"
|
||||
class="bg-white h-10 px-5 pr-10 rounded-full text-2xl focus:outline-none"
|
||||
>
|
||||
<span class="htmx-indicator">Searching...</span>
|
||||
</div>
|
||||
+dev 3
|
||||
|
||||
|
||||
<table class="border-collapse w-small w-2/3 mx-auto">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">#</th>
|
||||
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">Title</th>
|
||||
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">Completed</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="todo-results">
|
||||
{% include 'todo.html' %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock content %}
|
@ -1,15 +0,0 @@
|
||||
{% if todos|length>0 %}
|
||||
{% for todo in todos %}
|
||||
<tr class="bg-white lg:hover:bg-gray-100 flex lg:table-row flex-row lg:flex-row flex-wrap lg:flex-no-wrap mb-10 lg:mb-0">
|
||||
<td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">{{todo.id}}</td>
|
||||
<td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">{{todo.title}}</td>
|
||||
<td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">
|
||||
{% if todo.completed %}
|
||||
<span class="rounded bg-green-400 py-1 px-3 text-xs font-bold">Yes</span>
|
||||
{% else %}
|
||||
<span class="rounded bg-red-400 py-1 px-3 text-xs font-bold">No</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
Loading…
Reference in New Issue
Block a user