AutoBuild at change, Special HTMX Indicator Inline, modernate Feed Inline and other small things
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
|||||||
/target
|
/target
|
||||||
/assets/generated
|
/autoassets
|
||||||
sqlite.db
|
sqlite.db
|
||||||
node_modules
|
node_modules
|
||||||
16
README.md
16
README.md
@@ -1,4 +1,18 @@
|
|||||||
To run the Tailwind Compiler:
|
Install Diesel and Watchexec:
|
||||||
|
```
|
||||||
|
sudo pacman -S diesel-cli watchexec
|
||||||
|
```
|
||||||
|
|
||||||
|
Absolutely use pnpm as packet manager for this project.
|
||||||
|
|
||||||
|
To run the Tailwind Compiler in watch:
|
||||||
```
|
```
|
||||||
pnpm dlx @tailwindcss/cli -i styles/tailwind.css -o assets/generated/main.css --watch
|
pnpm dlx @tailwindcss/cli -i styles/tailwind.css -o assets/generated/main.css --watch
|
||||||
```
|
```
|
||||||
|
or (with or without `--watch`)
|
||||||
|
```
|
||||||
|
pnpm compile
|
||||||
|
```
|
||||||
|
|
||||||
|
My suggestion is to open one terminal and run `pnpm devrun` to continously rebuild
|
||||||
|
the Tailwind css and restart/rebuild the Rust server if a template file change.
|
||||||
@@ -2,6 +2,10 @@
|
|||||||
"name": "htmxtailwindtest",
|
"name": "htmxtailwindtest",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
"scripts": {
|
||||||
|
"devrun": "watchexec -r -e js,css,html 'tailwindcss -i styles/tailwind.css -o autoassets/main.css;cargo run'",
|
||||||
|
"compile": "tailwindcss -i styles/tailwind.css -o autoassets/main.css"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/cli": "^4.0.3",
|
"@tailwindcss/cli": "^4.0.3",
|
||||||
"daisyui": "5.0.0-beta.6",
|
"daisyui": "5.0.0-beta.6",
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ async fn main() -> Result<()> {
|
|||||||
// Launch Web Server
|
// Launch Web Server
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.nest_service("/assets", ServeDir::new("assets"))
|
.nest_service("/assets", ServeDir::new("assets"))
|
||||||
|
.nest_service("/autoassets", ServeDir::new("autoassets"))
|
||||||
.route("/", get(index))
|
.route("/", get(index))
|
||||||
.route("/feed/", get(get_list_feed).post(post_feed))
|
.route("/feed/", get(get_list_feed).post(post_feed))
|
||||||
.route("/feed/:id", get(get_feed).delete(delete_feed).put(put_feed))
|
.route("/feed/:id", get(get_feed).delete(delete_feed).put(put_feed))
|
||||||
|
|||||||
@@ -1,16 +1,27 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="/assets/generated/main.css">
|
<link rel="stylesheet" href="/autoassets/main.css">
|
||||||
<!-- Inter Font is so hot right now! -->
|
<!-- Inter Font is so hot right now! -->
|
||||||
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
|
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
|
||||||
<title>{% block title %}{{ title }}{% endblock %}</title>
|
<title>{% block title %}{{ title }}{% endblock %}</title>
|
||||||
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
|
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.14.8/dist/cdn.min.js"></script>
|
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.14.8/dist/cdn.min.js"></script>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<!--suppress CssUnusedSymbol -->
|
||||||
<style>
|
<style>
|
||||||
[x-cloak] {
|
[x-cloak] {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
.htmx-indicator.htmx-inline{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.htmx-request .htmx-indicator.htmx-inline{
|
||||||
|
display:inline;
|
||||||
|
}
|
||||||
|
.htmx-request.htmx-indicator.htmx-inline{
|
||||||
|
display:inline;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
hx-swap="beforeend">
|
hx-swap="beforeend">
|
||||||
Edit Dialog
|
Edit Dialog
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-error btn-sm"
|
<button class="btn btn-sm btn-error"
|
||||||
hx-confirm="Are you sure?"
|
hx-confirm="Are you sure?"
|
||||||
hx-delete="/feed/{{feed.id}}"
|
hx-delete="/feed/{{feed.id}}"
|
||||||
hx-target="#feed_{{feed.id}}"
|
hx-target="#feed_{{feed.id}}"
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
<tr id="feed_{{feed.id}}">
|
<tr id="feed_{{feed.id}}">
|
||||||
<td>
|
<td>
|
||||||
<label style="width: 100%">
|
<label class="w-full">
|
||||||
<input type="text" name="name" form="update_feed_{{feed.id}}" value="{{feed.name}}">
|
<input type="text" class="input input-sm" name="name" form="update_feed_{{feed.id}}" value="{{feed.name}}"/>
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<label style="width: 100%">
|
<label class="w-full">
|
||||||
<input type="url" name="feed_url" form="update_feed_{{feed.id}}" value="{{feed.feed_url}}">
|
<input type="url" class="input input-sm" name="feed_url" form="update_feed_{{feed.id}}" value="{{feed.feed_url}}">
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
<td>{{feed.last_pub_date.clone().unwrap_or("None".to_string())}}</td>
|
<td>{{feed.last_pub_date.clone().unwrap_or("None".to_string())}}</td>
|
||||||
<td>
|
<td>
|
||||||
<form id="update_feed_{{feed.id}}" hx-put="/feed/{{feed.id}}" hx-target="#feed_{{feed.id}}" hx-swap="outerHTML"
|
<button class="btn btn-sm btn-warning"
|
||||||
hx-indicator="update_feed_{{feed.id}}_indicator" style="padding: 0; background: unset">
|
|
||||||
<button class="btn" type="reset"
|
|
||||||
hx-get="/feed/{{feed.id}}"
|
hx-get="/feed/{{feed.id}}"
|
||||||
hx-target="#feed_{{feed.id}}"
|
hx-target="#feed_{{feed.id}}"
|
||||||
hx-swap="outerHTML">
|
hx-swap="outerHTML">
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button class="btn" type="submit">
|
<button class="btn btn-sm btn-primary" type="submit" form="update_feed_{{feed.id}}">
|
||||||
Confirm
|
Confirm
|
||||||
<img id="update_feed_{{feed.id}}_indicator" class="htmx-indicator" src="/assets/oval.svg"
|
<img id="update_feed_{{feed.id}}_indicator" class="htmx-inline htmx-indicator" src="/assets/oval.svg"
|
||||||
style="height: 1rem; margin-left: 2px" alt="...">
|
style="height: 1rem; margin-left: 2px" alt="...">
|
||||||
</button>
|
</button>
|
||||||
|
<form id="update_feed_{{feed.id}}" hx-put="/feed/{{feed.id}}" hx-target="#feed_{{feed.id}}" hx-swap="outerHTML"
|
||||||
|
hx-indicator="#update_feed_{{feed.id}}_indicator">
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -31,9 +31,9 @@
|
|||||||
<img class="m-2 h-8" src="/assets/logo.svg" alt="RSS Notifier Logo"/>
|
<img class="m-2 h-8" src="/assets/logo.svg" alt="RSS Notifier Logo"/>
|
||||||
<h2 style="margin-bottom: auto; margin-top: auto">RSS Notifier</h2>
|
<h2 style="margin-bottom: auto; margin-top: auto">RSS Notifier</h2>
|
||||||
</a>
|
</a>
|
||||||
<button class="btn" @click="isModalOpen = true">Create</button>
|
<button class="btn btn-primary" @click="isModalOpen = true">Create</button>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="pt-16">
|
<div class="pt-20">
|
||||||
<!-- TODO: Switch overlay and dialog to DaisyUI -->
|
<!-- TODO: Switch overlay and dialog to DaisyUI -->
|
||||||
<div class="overlay" style="z-index: 30" x-show="isModalOpen" x-cloak></div>
|
<div class="overlay" style="z-index: 30" x-show="isModalOpen" x-cloak></div>
|
||||||
<dialog open style="z-index: 31" x-show="isModalOpen" x-cloak x-transition>
|
<dialog open style="z-index: 31" x-show="isModalOpen" x-cloak x-transition>
|
||||||
|
|||||||
Reference in New Issue
Block a user