Merge pull request 'Close #41 - fix empty topic/gallery issues in default template' (#42) from empty-gallery into main

Reviewed-on: #42
This commit is contained in:
Anthony J. Martinez 2021-07-04 10:38:13 +00:00
commit 4a4ce9af1a
5 changed files with 22 additions and 8 deletions

2
Cargo.lock generated
View File

@ -28,7 +28,7 @@ checksum = "15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61"
[[package]]
name = "arse"
version = "0.10.0"
version = "0.10.1"
dependencies = [
"anyhow",
"clap",

View File

@ -1,6 +1,6 @@
[package]
name = "arse"
version = "0.10.0"
version = "0.10.1"
authors = ["Anthony Martinez"]
edition = "2018"
license = "MIT OR Apache-2.0"

View File

@ -124,6 +124,7 @@ impl Engine {
*path = path.strip_prefix(&self.app.docpaths.webroot)?.to_path_buf();
}
trace!("Gallery items: {:?}", paths);
Ok(paths)
}
@ -274,4 +275,17 @@ Super Wow!
assert!(page.contains("<script>"));
}
#[test]
fn check_render_empty_gallery() {
let dir = tempfile::tempdir().unwrap();
let mut src: &[u8] = b"Site Name\nAuthor Name\nOne, Gallery\nadmin\n";
let config = AppConfig::generate(&dir, &mut src).unwrap();
let config = Arc::new(config);
let engine = Engine::new(config);
let page = engine.render_topic("gallery").unwrap();
assert!(page.contains("Coming Soon"));
}
}

View File

@ -63,12 +63,12 @@ function change_img(dir) {
</center>
{% elif post %}
{{ post }}
{% elif posts | length < 1 %}
<h3>Coming Soon!</h3>
{% else %}
{% elif posts %}
{%- for post in posts %}
{{ post }}
{%- endfor -%}
{% else %}
<h3>Coming Soon!</h3>
{% endif %}
</main>
<footer>

View File

@ -51,12 +51,12 @@ function change_img(dir) {
</center>
{% elif post %}
{{ post }}
{% elif posts | length < 1 %}
<h3>Coming Soon!</h3>
{% else %}
{% elif posts %}
{%- for post in posts %}
{{ post }}
{%- endfor -%}
{% else %}
<h3>Coming Soon!</h3>
{% endif %}
</main>
<footer>