From 67a69ca0d0f61685c1c4e0487b2b50027153f391 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Mon, 15 Apr 2024 22:45:47 -0700 Subject: [PATCH] unify watchlist item use. --- src/db.rs | 6 ++---- templates/my_watches_page.html | 23 ++++++++++++++++------- templates/search_watches_page.html | 4 ++-- templates/watch-search-result.html | 19 ------------------- templates/watchlist-item.html | 19 +++++++++++++++++++ 5 files changed, 39 insertions(+), 32 deletions(-) delete mode 100644 templates/watch-search-result.html create mode 100644 templates/watchlist-item.html diff --git a/src/db.rs b/src/db.rs index 3e3cd47..9cca161 100644 --- a/src/db.rs +++ b/src/db.rs @@ -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) diff --git a/templates/my_watches_page.html b/templates/my_watches_page.html index fad8f67..c6582a3 100644 --- a/templates/my_watches_page.html +++ b/templates/my_watches_page.html @@ -26,13 +26,22 @@

Here are your things to watch:

- + + + + + + + + + + + + {% for watch in watches %} + {% include "watchlist-item.html" %} + {% endfor %} + +
TitleLinkTypeYearWatching?
{% else %}

diff --git a/templates/search_watches_page.html b/templates/search_watches_page.html index a2e7039..61d39e4 100644 --- a/templates/search_watches_page.html +++ b/templates/search_watches_page.html @@ -43,8 +43,8 @@ - {% for res in results %} - {% include "watch-search-result.html" %} + {% for watch in results %} + {% include "watchlist-item.html" %} {% endfor %} diff --git a/templates/watch-search-result.html b/templates/watch-search-result.html deleted file mode 100644 index e94e884..0000000 --- a/templates/watch-search-result.html +++ /dev/null @@ -1,19 +0,0 @@ - - {{res.title}} - - {% match res.metadata_url %} - {% when Some with (mdurl) %} - {{ mdurl }} - {% when None %} - {% endmatch %} - - - {{res.kind}} - {% call m::get_or_default(res.release_date, "when??") -%} - - - ??? - - - diff --git a/templates/watchlist-item.html b/templates/watchlist-item.html new file mode 100644 index 0000000..0345a5f --- /dev/null +++ b/templates/watchlist-item.html @@ -0,0 +1,19 @@ + + {{watch.title}} + + {% match watch.metadata_url %} + {% when Some with (mdurl) %} + {{ mdurl }} + {% when None %} + {% endmatch %} + + + {{watch.kind}} + {% call m::get_or_default(watch.release_date, "when??") -%} + + + ??? + + +