unify watchlist item use.

This commit is contained in:
Joe Ardent 2024-04-15 22:45:47 -07:00
parent 7b41e0f91b
commit 67a69ca0d0
5 changed files with 39 additions and 32 deletions

View file

@ -36,15 +36,13 @@ pub fn get_db_pool() -> SqlitePool {
tracing::info!("Connecting to DB at {db_filename}");
let plugin = conf.julid_plugin;
let conn_opts = SqliteConnectOptions::new()
.foreign_keys(true)
.journal_mode(SqliteJournalMode::Wal)
.synchronous(sqlx::sqlite::SqliteSynchronous::Normal)
.filename(&db_filename)
// be sure to have run `make` so that the libjulid extension is built
.extension(plugin)
// be sure to have run `make julid` so that the libjulid extension is built
.extension(conf.julid_plugin)
.busy_timeout(Duration::from_secs(TIMEOUT))
.create_if_missing(true)
.optimize_on_close(true, None)

View file

@ -26,13 +26,22 @@
<p>Here are your things to watch:</p>
<div class="watchlist">
<ul>
<table>
<thead>
<tr>
<th>Title</th>
<th>Link</th>
<th>Type</th>
<th>Year</th>
<th>Watching?</th>
</tr>
</thead>
<tbody>
{% for watch in watches %}
<li><span class="watchtitle">{{watch.title}}</span> -- {% call m::get_or_default(watch.release_date, "when??")
%}
</li>
{% include "watchlist-item.html" %}
{% endfor %}
</ul>
</tbody>
</table>
</div>
{% else %}
<p>

View file

@ -43,8 +43,8 @@
</tr>
</thead>
<tbody>
{% for res in results %}
{% include "watch-search-result.html" %}
{% for watch in results %}
{% include "watchlist-item.html" %}
{% endfor %}
</tbody>
</table>

View file

@ -1,19 +0,0 @@
<tr id="watchlist-item-{{res.id}}">
<td><span class="watchtitle"><a href="/watch/{{res.id}}">{{res.title}}</a></span></td>
<td><span>
{% match res.metadata_url %}
{% when Some with (mdurl) %}
<a href="{{ mdurl }}">{{ mdurl }}</a>
{% when None %}
{% endmatch %}
</span>
</td>
<td>{{res.kind}}</td>
<td> {% call m::get_or_default(res.release_date, "when??") -%}</td>
<td>
<span id="add-watch-{{res.id}}">
<span hx-get="/watch/status/{{res.id}}" hx-target="this" hx-trigger="load, reveal"
hx-swap="outerHTML">???</span>
</span>
</td>
</tr>

View file

@ -0,0 +1,19 @@
<tr id="watchlist-item-{{watch.id}}">
<td><span class="watchtitle"><a href="/watch/{{watch.id}}">{{watch.title}}</a></span></td>
<td><span>
{% match watch.metadata_url %}
{% when Some with (mdurl) %}
<a href="{{ mdurl }}">{{ mdurl }}</a>
{% when None %}
{% endmatch %}
</span>
</td>
<td>{{watch.kind}}</td>
<td> {% call m::get_or_default(watch.release_date, "when??") -%}</td>
<td>
<span id="add-watch-{{watch.id}}">
<span hx-get="/watch/status/{{watch.id}}" hx-target="this" hx-trigger="load, reveal"
hx-swap="outerHTML">???</span>
</span>
</td>
</tr>