progress or shit, don't feel like devlogging
This commit is contained in:
parent
5dafe72895
commit
fe5f1e7ecd
11 changed files with 208 additions and 144 deletions
63
app/templates/base.html
Normal file
63
app/templates/base.html
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{% block head %}
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Wishthat</title>
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/daisyui@5"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
||||
{% endblock head %}
|
||||
</head>
|
||||
<body class="m-0 p-0 w-full h-screen bg-base-200 flex flex-col">
|
||||
<nav class="w-full p-2 flex-none">
|
||||
<div class="navbar bg-base-100 shadow-sm rounded-md">
|
||||
<div class="navbar-start">
|
||||
<div class="dropdown">
|
||||
<div tabindex="0" role="button" class="btn btn-ghost lg:hidden">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-5 w-5"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M4 6h16M4 12h8m-8 6h16"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<ul
|
||||
tabindex="0"
|
||||
class="menu menu-sm dropdown-content bg-base-100 rounded-box z-1 mt-3 w-52 p-2 shadow"
|
||||
>
|
||||
<li><a></a></li>
|
||||
<li>
|
||||
<a>Parent</a>
|
||||
<ul class="p-2">
|
||||
<li><a>Submenu 1</a></li>
|
||||
<li><a>Submenu 2</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a>Item 3</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<a class="btn btn-ghost text-xl" href="/">wishthat</a>
|
||||
</div>
|
||||
<div class="navbar-end">
|
||||
<a class="btn btn-soft btn-success hidden lg:inline-flex" href="/new">New wishlist</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,121 +1,125 @@
|
|||
{% set cpath = url_for("edit", id=wishlist.editId) %}
|
||||
<main>
|
||||
<h1>Edit '{{wishlist.title}}'</h1>
|
||||
<sub>Manage your wishlist details and items</sub>
|
||||
<br>
|
||||
<form action="{{ cpath }}" method="POST">
|
||||
{{ form_wl_editinfo.hidden_tag() }}
|
||||
{{ form_wl_editinfo.title.label }}
|
||||
{{ form_wl_editinfo.title(placeholder=wishlist.title) }}
|
||||
<!-- <br> -->
|
||||
{{ form_wl_editinfo.description.label }}
|
||||
{{ form_wl_editinfo.description(placeholder=wishlist.description) }}
|
||||
<!-- <br> -->
|
||||
{{ form_wl_editinfo.wl_edit_submit() }}
|
||||
</form>
|
||||
<br>
|
||||
<h1>Urls</h1>
|
||||
<ul>
|
||||
<li>
|
||||
View: <a href={{ url_for("view", id=wishlist.viewId) }}>{{ wishlist.viewId }}</a>
|
||||
</li>
|
||||
<li>
|
||||
Edit: <a href={{ url_for("edit", id=wishlist.editId) }}>{{ wishlist.editId }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form action="{{ cpath }}" method="POST">
|
||||
{{ form_wl_reseturls.hidden_tag() }}
|
||||
{{ form_wl_reseturls.wl_reset_submit() }}
|
||||
</form>
|
||||
<br>
|
||||
<h1>New item</h1>
|
||||
<form action="{{ cpath }}" method="POST">
|
||||
{{ form_it_new.hidden_tag() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.it_new_title.label }}
|
||||
{{ form_it_new.it_new_title() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.description.label }}
|
||||
{{ form_it_new.description() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.price.label }}
|
||||
{{ form_it_new.price() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.url.label }}
|
||||
{{ form_it_new.url() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.image.label }}
|
||||
{{ form_it_new.image() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.it_new_submit() }}
|
||||
<button id="scrape">Scrape</button>
|
||||
</form>
|
||||
<br>
|
||||
<h1>Delete items</h1>
|
||||
{% if wishlist.items|length == 0 %}<p>No items yet</p>{% endif %}
|
||||
<ul>
|
||||
{% for value in wishlist.items %}
|
||||
<li>
|
||||
<form action="{{ cpath }}" method="POST">
|
||||
{{ form_it_delete.csrf_token }}
|
||||
{{ form_it_delete.index(value=loop.index) }}
|
||||
{{ form_it_delete.it_del_submit() }}
|
||||
</form>
|
||||
{{ value.title }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<br>
|
||||
<h1>Delete wishlist</h1>
|
||||
<form action="{{ cpath }}" method="POST">
|
||||
{{ form_wl_delete.hidden_tag() }}
|
||||
{{ form_wl_delete.wl_del_submit() }}
|
||||
</form>
|
||||
<style>
|
||||
form {
|
||||
display:grid;
|
||||
grid-template-columns: max-content max-content;
|
||||
grid-gap:5px;
|
||||
}
|
||||
form label { text-align:right; }
|
||||
form label:after { content: ":"; }
|
||||
</style>
|
||||
</main>
|
||||
{% extends "base.html" %}
|
||||
|
||||
<script>
|
||||
const $q = (...i) => document.querySelector(...i);
|
||||
const title = $q("#it_new_title")
|
||||
const price = $q("#price")
|
||||
const url = $q("#url")
|
||||
const image = $q("#image")
|
||||
// const description = $q("#description")
|
||||
|
||||
$q("#scrape").addEventListener("click", async e => {
|
||||
e.preventDefault()
|
||||
const tUrl = url.value.trim();
|
||||
|
||||
if (!tUrl) {
|
||||
alert("Please provide a valid url.") //TODO: Replace with daisyui modal
|
||||
return
|
||||
}
|
||||
|
||||
const res = await fetch(
|
||||
"/scrape?" + new URLSearchParams({
|
||||
url: tUrl
|
||||
}).toString(),
|
||||
{
|
||||
method: "get",
|
||||
{% block content %}
|
||||
<main class="bg-base-100">
|
||||
<h1>Edit '{{wishlist.title}}'</h1>
|
||||
<sub>Manage your wishlist details and items</sub>
|
||||
<br>
|
||||
<form action="{{ cpath }}" method="POST">
|
||||
{{ form_wl_editinfo.hidden_tag() }}
|
||||
{{ form_wl_editinfo.title.label }}
|
||||
{{ form_wl_editinfo.title(placeholder=wishlist.title) }}
|
||||
<!-- <br> -->
|
||||
{{ form_wl_editinfo.description.label }}
|
||||
{{ form_wl_editinfo.description(placeholder=wishlist.description) }}
|
||||
<!-- <br> -->
|
||||
{{ form_wl_editinfo.wl_edit_submit() }}
|
||||
</form>
|
||||
<br>
|
||||
<h1>Urls</h1>
|
||||
<ul>
|
||||
<li>
|
||||
View: <a href={{ url_for("view", id=wishlist.viewId) }}>{{ wishlist.viewId }}</a>
|
||||
</li>
|
||||
<li>
|
||||
Edit: <a href={{ url_for("edit", id=wishlist.editId) }}>{{ wishlist.editId }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form action="{{ cpath }}" method="POST">
|
||||
{{ form_wl_reseturls.hidden_tag() }}
|
||||
{{ form_wl_reseturls.wl_reset_submit() }}
|
||||
</form>
|
||||
<br>
|
||||
<h1>New item</h1>
|
||||
<form action="{{ cpath }}" method="POST">
|
||||
{{ form_it_new.hidden_tag() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.it_new_title.label }}
|
||||
{{ form_it_new.it_new_title() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.description.label }}
|
||||
{{ form_it_new.description() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.price.label }}
|
||||
{{ form_it_new.price() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.url.label }}
|
||||
{{ form_it_new.url() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.image.label }}
|
||||
{{ form_it_new.image() }}
|
||||
<!-- <br> -->
|
||||
{{ form_it_new.it_new_submit() }}
|
||||
<button id="scrape">Scrape</button>
|
||||
</form>
|
||||
<br>
|
||||
<h1>Delete items</h1>
|
||||
{% if wishlist.items|length == 0 %}<p>No items yet</p>{% endif %}
|
||||
<ul>
|
||||
{% for value in wishlist.items %}
|
||||
<li>
|
||||
<form action="{{ cpath }}" method="POST">
|
||||
{{ form_it_delete.csrf_token }}
|
||||
{{ form_it_delete.index(value=loop.index) }}
|
||||
{{ form_it_delete.it_del_submit() }}
|
||||
</form>
|
||||
{{ value.title }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<br>
|
||||
<h1>Delete wishlist</h1>
|
||||
<form action="{{ cpath }}" method="POST">
|
||||
{{ form_wl_delete.hidden_tag() }}
|
||||
{{ form_wl_delete.wl_del_submit() }}
|
||||
</form>
|
||||
<style>
|
||||
form {
|
||||
display:grid;
|
||||
grid-template-columns: max-content max-content;
|
||||
grid-gap:5px;
|
||||
}
|
||||
)
|
||||
form label { text-align:right; }
|
||||
form label:after { content: ":"; }
|
||||
</style>
|
||||
</main>
|
||||
|
||||
if (res.status !== 200) {
|
||||
alert("Failed to scrape site.")
|
||||
return
|
||||
}
|
||||
<script>
|
||||
const $q = (...i) => document.querySelector(...i);
|
||||
const title = $q("#it_new_title")
|
||||
const price = $q("#price")
|
||||
const url = $q("#url")
|
||||
const image = $q("#image")
|
||||
// const description = $q("#description")
|
||||
|
||||
const json = await res.json()
|
||||
title.value = json.name;
|
||||
image.value = json.image;
|
||||
price.value = json.price;
|
||||
})
|
||||
</script>
|
||||
$q("#scrape").addEventListener("click", async e => {
|
||||
e.preventDefault()
|
||||
const tUrl = url.value.trim();
|
||||
|
||||
if (!tUrl) {
|
||||
alert("Please provide a valid url.") //TODO: Replace with daisyui modal
|
||||
return
|
||||
}
|
||||
|
||||
const res = await fetch(
|
||||
"/scrape?" + new URLSearchParams({
|
||||
url: tUrl
|
||||
}).toString(),
|
||||
{
|
||||
method: "get",
|
||||
}
|
||||
)
|
||||
|
||||
if (res.status !== 200) {
|
||||
alert("Failed to scrape site.")
|
||||
return
|
||||
}
|
||||
|
||||
const json = await res.json()
|
||||
title.value = json.name;
|
||||
image.value = json.image;
|
||||
price.value = json.price;
|
||||
})
|
||||
</script>
|
||||
{% endblock content %}
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
</body>
|
||||
</html>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Wishthat</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/daisyui@5" rel="stylesheet" type="text/css" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
||||
</head>
|
||||
<body class="m-0 p-0 w-full h-screen bg-base-200">
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
{% extends "base.html" %}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
{% include 'header.html' %}
|
||||
{% extends "base.html" %}
|
||||
|
||||
<main class="w-full h-screen flex justify-center items-end md:items-center">
|
||||
{% block content %}
|
||||
|
||||
<main class="w-full flex-grow flex justify-center items-end md:items-center">
|
||||
<form action="{{ url_for("new") }}" method="POST" class="border-2 border-base-300 w-full md:w-md p-6 m-4 rounded-lg shadow-lg bg-base-100">
|
||||
{{ form.hidden_tag() }}
|
||||
|
||||
|
|
@ -13,8 +15,8 @@
|
|||
{{ form.description(class="w-full textarea validator mt-1 mb-2", placeholder="Wishlist Description") }}
|
||||
<div class="validator-hint">Please make sure that both inputs are filled.</div>
|
||||
|
||||
{{ form.submit(class="btn btn-soft w-full") }}
|
||||
{{ form.submit(class="btn btn-soft btn-success w-full") }}
|
||||
</form>
|
||||
</main>
|
||||
|
||||
{% include 'footer.html' %}
|
||||
{% endblock content %}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
{% include 'header.html' %}
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<dialog class="modal modal-bottom md:modal-middle" open>
|
||||
<div class="modal-box">
|
||||
|
|
@ -11,4 +13,4 @@
|
|||
</div>
|
||||
</dialog>
|
||||
|
||||
{% include 'footer.html' %}
|
||||
{% endblock content %}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
{% include 'header.html' %}
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{{wishlist.title}}</h1>
|
||||
<sub>{{wishlist.description}}</sub>
|
||||
|
|
@ -57,4 +59,4 @@
|
|||
|
||||
</script>
|
||||
|
||||
{% include 'footer.html' %}
|
||||
{% endblock content %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue