From 2e7ea3052c5ee3b8f5e7020b543790299523b99a Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 29 Jan 2023 13:51:04 -0600 Subject: [PATCH] Bump ructe --- Cargo.lock | 23 ++++---------- Cargo.toml | 4 +-- src/lib.rs | 20 ++++++++---- templates/button.rs.html | 36 ++++++++++----------- templates/button_link.rs.html | 37 +++++++++++----------- templates/confirm_delete.rs.html | 37 +++++++++++----------- templates/confirm_entry_delete.rs.html | 44 +++++++++++++------------- templates/edit_collection.rs.html | 37 +++++++++++----------- templates/error.rs.html | 22 ++++++------- templates/image.rs.html | 4 +-- templates/index.rs.html | 10 +++--- templates/not_found.rs.html | 16 +++++----- templates/view_collection.rs.html | 8 ++--- 13 files changed, 147 insertions(+), 151 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10bbcf0..6ad952d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1239,17 +1239,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nom_locate" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e299bf5ea7b212e811e71174c5d1a5d065c4c0ad0c8691ecb1f97e3e66025e" -dependencies = [ - "bytecount", - "memchr", - "nom", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1288,6 +1277,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint", "num-integer", "num-traits", ] @@ -1751,15 +1741,14 @@ dependencies = [ [[package]] name = "rsass" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "665387d3be91521de331a04cc7118c8c129ffe43c5f4e8a61e78990850046b5a" +checksum = "a43695dd28122f6c684273de89796a56a98e02e9694b8ab57b160fdc6e6d69af" dependencies = [ "arc-swap", "fastrand", "lazy_static", "nom", - "nom_locate", "num-bigint", "num-integer", "num-rational", @@ -1769,11 +1758,11 @@ dependencies = [ [[package]] name = "ructe" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85517cd381cf0c34694881d8aaf173107c6af7670e66cec18d7a1a8bfce3b758" +checksum = "79c86c1631418815c5947a34be5872806586c65398754ec91cc2df35a8e26ba8" dependencies = [ - "base64 0.13.1", + "base64 0.21.0", "bytecount", "itertools", "md5", diff --git a/Cargo.toml b/Cargo.toml index afc80e7..acde7fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,8 +56,8 @@ default-features = false features = ["emit_event_on_error", "opentelemetry_0_18"] [dev-dependencies] -ructe = "0.15.0" +ructe = "0.16.0" [build-dependencies] dotenv = "0.15.0" -ructe = { version = "0.15.0", features = ["sass", "mime03"] } +ructe = { version = "0.16.0", features = ["sass", "mime03"] } diff --git a/src/lib.rs b/src/lib.rs index 2b757a9..ef573b1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -375,7 +375,7 @@ async fn static_files(filename: web::Path, state: web::Data) -> H #[tracing::instrument(name = "Not found")] async fn not_found(state: web::Data) -> Result { rendered( - |cursor| self::templates::not_found(cursor, &state), + |cursor| self::templates::not_found_html(cursor, &state), HttpResponse::NotFound(), ) .stateful(&state) @@ -407,7 +407,7 @@ impl ResponseError for StateError { fn error_response(&self) -> HttpResponse { match rendered( - |cursor| self::templates::error(cursor, &self.error.kind.to_string(), &self.state), + |cursor| self::templates::error_html(cursor, &self.error.kind.to_string(), &self.state), HttpResponse::build(self.status_code()), ) { Ok(res) => res, @@ -738,7 +738,7 @@ async fn thumbnail( #[tracing::instrument(name = "Index")] async fn index(state: web::Data) -> Result { rendered( - |cursor| self::templates::index(cursor, &state), + |cursor| self::templates::index_html(cursor, &state), HttpResponse::Ok(), ) .stateful(&state) @@ -775,7 +775,13 @@ async fn view_collection( rendered( |cursor| { - self::templates::view_collection(cursor, path.collection, &collection, &entries, &state) + self::templates::view_collection_html( + cursor, + path.collection, + &collection, + &entries, + &state, + ) }, HttpResponse::Ok(), ) @@ -801,7 +807,7 @@ async fn edit_collection( rendered( |cursor| { - self::templates::edit_collection( + self::templates::edit_collection_html( cursor, &collection, path.collection, @@ -918,7 +924,7 @@ async fn delete_entry( if !query.confirmed.unwrap_or(false) { return rendered( |cursor| { - self::templates::confirm_entry_delete( + self::templates::confirm_entry_delete_html( cursor, entry_path.collection, entry_path.entry, @@ -1010,7 +1016,7 @@ async fn delete_collection( return rendered( |cursor| { - self::templates::confirm_delete( + self::templates::confirm_delete_html( cursor, path.collection, &collection, diff --git a/templates/button.rs.html b/templates/button.rs.html index 1998cff..3a31904 100644 --- a/templates/button.rs.html +++ b/templates/button.rs.html @@ -3,22 +3,22 @@ @(text: &str, kind: ButtonKind) @match kind { - ButtonKind::Submit => { -
- @text - -
- } - ButtonKind::Plain => { -
- @text - -
- } - ButtonKind::Outline => { -
- @text - -
- } +ButtonKind::Submit => { +
+ @text + +
+} +ButtonKind::Plain => { +
+ @text + +
+} +ButtonKind::Outline => { +
+ @text + +
+} } diff --git a/templates/button_link.rs.html b/templates/button_link.rs.html index 61e7cdd..2fe5d20 100644 --- a/templates/button_link.rs.html +++ b/templates/button_link.rs.html @@ -3,23 +3,22 @@ @(text: &str, href: &str, kind: ButtonKind) @match kind { - ButtonKind::Submit => { -
- @text - @text -
- } - ButtonKind::Plain => { -
- @text - @text -
- } - ButtonKind::Outline => { -
- @text - @text -
- } +ButtonKind::Submit => { +
+ @text + @text +
+} +ButtonKind::Plain => { +
+ @text + @text +
+} +ButtonKind::Outline => { +
+ @text + @text +
+} } - diff --git a/templates/confirm_delete.rs.html b/templates/confirm_delete.rs.html index 5b70282..de8d396 100644 --- a/templates/confirm_delete.rs.html +++ b/templates/confirm_delete.rs.html @@ -1,27 +1,28 @@ @use crate::{ui::ButtonKind, Collection, State, ValidToken}; -@use super::{layout, button_link, return_home}; +@use super::{layout_html, button_link_html, return_home_html}; @use uuid::Uuid; @(id: Uuid, collection: &Collection, token: &ValidToken, state: &State) -@:layout(state, &format!("Delete: {}", collection.title), Some(&format!("Are you sure you want to delete {}", collection.title)), { - +@:layout_html(state, &format!("Delete: {}", collection.title), Some(&format!("Are you sure you want to delete {}", +collection.title)), { + }, {
-
-
-

Delete @collection.title

-
-
-

Are you sure you want to delete @collection.title

-
-
-
- @:button_link("Delete Collection", &state.delete_collection_path(id, token, true), ButtonKind::Submit) - @:button_link("Cancel", &state.edit_collection_path(id, token), ButtonKind::Outline) -
-
-
+
+
+

Delete @collection.title

+
+
+

Are you sure you want to delete @collection.title

+
+
+
+ @:button_link_html("Delete Collection", &state.delete_collection_path(id, token, true), ButtonKind::Submit) + @:button_link_html("Cancel", &state.edit_collection_path(id, token), ButtonKind::Outline) +
+
+
-@:return_home(state) +@:return_home_html(state) }) diff --git a/templates/confirm_entry_delete.rs.html b/templates/confirm_entry_delete.rs.html index 19000a6..21f4170 100644 --- a/templates/confirm_entry_delete.rs.html +++ b/templates/confirm_entry_delete.rs.html @@ -1,33 +1,33 @@ @use crate::{ui::ButtonKind, Entry, State, ValidToken}; -@use super::{layout, button_link, image, return_home}; +@use super::{layout_html, button_link_html, image_html, return_home_html}; @use uuid::Uuid; @(collection_id: Uuid, id: Uuid, entry: &Entry, token: &ValidToken, state: &State) -@:layout(state, "Delete Image", Some("Are you sure you want to delete this image?"), { - +@:layout_html(state, "Delete Image", Some("Are you sure you want to delete this image?"), { + }, {
-
-
-

Delete Image

+
+
+

Delete Image

+
+
+
+
+ @:image_html(entry, state)
-
-
-
- @:image(entry, state) -
-
-

Are you sure you want to delete this image?

-
- @:button_link("Delete Image", &state.delete_entry_path(collection_id, id, token, true), ButtonKind::Submit) - @:button_link("Cancel", &state.edit_collection_path(collection_id, token), ButtonKind::Outline) -
-
-
+
+

Are you sure you want to delete this image?

+
+ @:button_link_html("Delete Image", &state.delete_entry_path(collection_id, id, token, true), + ButtonKind::Submit) + @:button_link_html("Cancel", &state.edit_collection_path(collection_id, token), ButtonKind::Outline) +
-
+
+ +
-@:return_home(state) +@:return_home_html(state) }) - diff --git a/templates/edit_collection.rs.html b/templates/edit_collection.rs.html index d67afc0..cb3530b 100644 --- a/templates/edit_collection.rs.html +++ b/templates/edit_collection.rs.html @@ -1,11 +1,12 @@ @use crate::{ui::ButtonKind, Collection, Direction, Entry, State, ValidToken}; -@use super::{button, button_link, image, file_input, layout, return_home, text_area, text_input, +@use super::{button_html, button_link_html, image_html, file_input_html, layout_html, return_home_html, text_area_html, +text_input_html, statics::file_upload_js}; @use uuid::Uuid; @(collection: &Collection, collection_id: Uuid, entries: &[(Uuid, Entry)], token: &ValidToken, state: &State, qr: &str) -@:layout(state, "Edit Collection", None, { +@:layout_html(state, "Edit Collection", None, { }, { @@ -33,11 +34,11 @@ statics::file_upload_js};
- @:text_input("title", Some("Collection Title"), Some(&collection.title), false) - @:text_area("description", Some("Collection Description"), Some(&collection.description), false) + @:text_input_html("title", Some("Collection Title"), Some(&collection.title), false) + @:text_area_html("description", Some("Collection Description"), Some(&collection.description), false)
- @:button("Update Collection", ButtonKind::Submit) - @:button_link("Delete Collection", &state.delete_collection_path(collection_id, token, false), + @:button_html("Update Collection", ButtonKind::Submit) + @:button_link_html("Delete Collection", &state.delete_collection_path(collection_id, token, false), ButtonKind::Outline)
@@ -48,37 +49,37 @@ statics::file_upload_js};
- @:image(entry, state) + @:image_html(entry, state)
- @:text_input("title", Some("Image Title"), entry.title.as_deref(), entry.file_parts().is_none()) - @:text_area("description", Some("Image Description"), entry.description.as_deref(), + @:text_input_html("title", Some("Image Title"), entry.title.as_deref(), entry.file_parts().is_none()) + @:text_area_html("description", Some("Image Description"), entry.description.as_deref(), entry.file_parts().is_none()) - @:text_input("link", Some("Image Link"), entry.link.as_ref().map(|l| l.as_str()), + @:text_input_html("link", Some("Image Link"), entry.link.as_ref().map(|l| l.as_str()), entry.file_parts().is_none())
@if let Some(upload_id) = entry.upload_id() { - @:button_link("Refresh", &state.edit_collection_path(collection_id, token), ButtonKind::Submit) + @:button_link_html("Refresh", &state.edit_collection_path(collection_id, token), ButtonKind::Submit) } @if let Some((filename, delete_token)) = entry.file_parts() { - @:button("Update Image", ButtonKind::Submit) - @:button_link("Delete Image", &state.delete_entry_path(collection_id, *id, token, false), + @:button_html("Update Image", ButtonKind::Submit) + @:button_link_html("Delete Image", &state.delete_entry_path(collection_id, *id, token, false), ButtonKind::Outline) }
@if i != 0 { - @:button_link("Move Up", &state.move_entry_path(collection_id, *id, token, Direction::Up), + @:button_link_html("Move Up", &state.move_entry_path(collection_id, *id, token, Direction::Up), ButtonKind::Outline) } @if (i + 1) != entries.len() { - @:button_link("Move Down", &state.move_entry_path(collection_id, *id, token, Direction::Down), + @:button_link_html("Move Down", &state.move_entry_path(collection_id, *id, token, Direction::Down), ButtonKind::Outline) }
@@ -100,14 +101,14 @@ statics::file_upload_js};
- @:file_input("images[]", Some("Select Image"), Some(crate::accept()), false) + @:file_input_html("images[]", Some("Select Image"), Some(crate::accept()), false)
- @:button("Upload", ButtonKind::Submit) + @:button_html("Upload", ButtonKind::Submit)
-@:return_home(state) +@:return_home_html(state) }) diff --git a/templates/error.rs.html b/templates/error.rs.html index 3ddb710..29d1290 100644 --- a/templates/error.rs.html +++ b/templates/error.rs.html @@ -1,18 +1,18 @@ @use crate::State; -@use super::{layout, return_home}; +@use super::{layout_html, return_home_html}; @(error: &str, state: &State) -@:layout(state, "Error", Some(error), {}, { +@:layout_html(state, "Error", Some(error), {}, {
-
-
-

Error

-
-
-

@error

-
-
+
+
+

Error

+
+
+

@error

+
+
-@:return_home(state) +@:return_home_html(state) }) diff --git a/templates/image.rs.html b/templates/image.rs.html index 36a1a48..6872dc2 100644 --- a/templates/image.rs.html +++ b/templates/image.rs.html @@ -1,9 +1,9 @@ @use crate::{Entry, State}; -@use super::image_preview; +@use super::image_preview_html; @(entry: &Entry, state: &State) -@:image_preview(entry, state) +@:image_preview_html(entry, state)
@if let Some(title) = entry.title.as_ref() {
@title
diff --git a/templates/index.rs.html b/templates/index.rs.html index 84a2ccc..738a424 100644 --- a/templates/index.rs.html +++ b/templates/index.rs.html @@ -1,9 +1,9 @@ @use crate::{ui::ButtonKind, State}; -@use super::{layout, text_area, text_input, button}; +@use super::{layout_html, text_area_html, text_input_html, button_html}; @(state: &State) -@:layout(state, "Collection", None, {}, { +@:layout_html(state, "Collection", None, {}, {
@@ -13,12 +13,12 @@
- @:text_input("title", Some("Title"), None, false) - @:text_area("description", Some("Description"), None, false) + @:text_input_html("title", Some("Title"), None, false) + @:text_area_html("description", Some("Description"), None, false)
- @:button("Create Collection", ButtonKind::Submit) + @:button_html("Create Collection", ButtonKind::Submit)
diff --git a/templates/not_found.rs.html b/templates/not_found.rs.html index 46593c9..f2cbae3 100644 --- a/templates/not_found.rs.html +++ b/templates/not_found.rs.html @@ -1,15 +1,15 @@ @use crate::State; -@use super::layout; +@use super::layout_html; @(state: &State) -@:layout(state, "Not Found", None, {}, { +@:layout_html(state, "Not Found", None, {}, {
-
-

Not Found

-
- +
+

Not Found

+
+
}) diff --git a/templates/view_collection.rs.html b/templates/view_collection.rs.html index dbd2a4b..c338e89 100644 --- a/templates/view_collection.rs.html +++ b/templates/view_collection.rs.html @@ -1,10 +1,10 @@ @use crate::{Collection, Entry, State}; -@use super::{layout, image, return_home}; +@use super::{layout_html, image_html, return_home_html}; @use uuid::Uuid; @(id: Uuid, collection: &Collection, entries: &[(Uuid, Entry)], state: &State) -@:layout(state, &collection.title, Some(&collection.description), { +@:layout_html(state, &collection.title, Some(&collection.description), { @@ -31,11 +31,11 @@ @for (_, entry) in entries {
  • - @:image(entry, state) + @:image_html(entry, state)
  • } -@:return_home(state) +@:return_home_html(state) })