diff options
| author | WriterV2 <primary-v2@protonmail.com> | 2023-01-28 12:51:05 +0100 |
|---|---|---|
| committer | WriterV2 <primary-v2@protonmail.com> | 2023-01-28 12:51:05 +0100 |
| commit | d3e2c3f4446e35f6a6d930e996488e94760f469c (patch) | |
| tree | 620ed4995bbaab74a18a01aafa74ad1b3b73a113 | |
| parent | 46dbedbd451217cd22d10e9d8cd208d4706771b8 (diff) | |
Replace id attribute with last_update to sort stories
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | docs/stories.html | 18 | ||||
| -rw-r--r-- | docs/style.css | 1 | ||||
| -rw-r--r-- | docs/style.css.map | 2 | ||||
| -rw-r--r-- | sass/style.scss | 1 | ||||
| -rw-r--r-- | src/works/stories.rs | 3 | ||||
| -rw-r--r-- | stories.json | 8 | ||||
| -rw-r--r-- | templates/stories.html | 3 |
8 files changed, 22 insertions, 16 deletions
@@ -10,4 +10,4 @@ tera = "1.17" serde = {version = "1.0", features = ["derive"]} serde_json = "1.0" anyhow = "1.0" -image = "0.24.4" +chrono = {version = "0.4", features = ["serde"]} diff --git a/docs/stories.html b/docs/stories.html index 0f1c88a..1600ddd 100644 --- a/docs/stories.html +++ b/docs/stories.html @@ -32,25 +32,27 @@ </div> <div class="works"> - <a href="./stories/mit_gutem_gewissen.pdf" class="work-card" download> + <a href="./stories/das_schweigende_spiegelbild.pdf" class="work-card" download> <div class="title-and-description"> - <h3>Mit gutem Gewissen</h3> - <p>Lorem ipsum dolor sit amet, officia excepteur.</p> + <h3>Das schweigende Spiegelbild</h3> + <p>Em pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia.</p> </div> <div class="info"> - <span>7 Pages</span> + <span>2 Pages</span> <span class="story-language">German</span> + <span>Last Update: 2023-01-28</span> </div> </a> - <a href="./stories/das_schweigende_spiegelbild.pdf" class="work-card" download> + <a href="./stories/mit_gutem_gewissen.pdf" class="work-card" download> <div class="title-and-description"> - <h3>Das schweigende Spiegelbild</h3> - <p>Em pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia.</p> + <h3>Mit gutem Gewissen</h3> + <p>Lorem ipsum dolor sit amet, officia excepteur.</p> </div> <div class="info"> - <span>2 Pages</span> + <span>7 Pages</span> <span class="story-language">German</span> + <span>Last Update: 2023-01-28</span> </div> </a> diff --git a/docs/style.css b/docs/style.css index e6ed4be..2aef6ec 100644 --- a/docs/style.css +++ b/docs/style.css @@ -87,6 +87,7 @@ a:hover { background-color: #131313; padding: 0.5em; margin: 0 0.5em; + font-size: 0.8em; } .work-card:hover { border: 1px solid #a29d7f; diff --git a/docs/style.css.map b/docs/style.css.map index 1414e24..ab826a0 100644 --- a/docs/style.css.map +++ b/docs/style.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["../sass/style.scss"],"names":[],"mappings":"AAKA;EACI;EACA;EACA;EAMA;;AALA;EACI;EACA;EACA;;;AAKR;EACI,kBAlBe;EAmBf,OAjBS;EAkBT;EACA;;;AAGJ;EACI;EACA;;AACA;EACI;EACA;;;AAIR;EACI;EACA;EACA;EACA;EACA,kBAtCe;;;AAyCnB;EACI;EACA;;AACA;EACI;EACA;EACA;;AACA;EAJJ;IAKQ;;;AAEJ;EAPJ;IAQQ;;;;AAKZ;EACI;EACA;EACA,kBA3DQ;;;AA8DZ;EACI;EACA;;AACA;EACI,cAhEO;EAiEP;;;AAIR;EACI;EACA,kBAzEQ;EA0ER;EACA;EACA;EACA;EACA;EACA;;AAEI;EACI;EACA,OAjFG;;AAqFP;EACI,kBAzFO;EA0FP;EACA;;AAGR;EACI;;;AAIR;EACI;EACA;;AACA;EAHJ;IAIQ;;;AAEJ;EACI;EACA,OAzGK;;AA2GT;EACI,kBA7GI;EA8GJ,OA5GO;EA6GP","file":"style.css"}
\ No newline at end of file +{"version":3,"sourceRoot":"","sources":["../sass/style.scss"],"names":[],"mappings":"AAKA;EACI;EACA;EACA;EAMA;;AALA;EACI;EACA;EACA;;;AAKR;EACI,kBAlBe;EAmBf,OAjBS;EAkBT;EACA;;;AAGJ;EACI;EACA;;AACA;EACI;EACA;;;AAIR;EACI;EACA;EACA;EACA;EACA,kBAtCe;;;AAyCnB;EACI;EACA;;AACA;EACI;EACA;EACA;;AACA;EAJJ;IAKQ;;;AAEJ;EAPJ;IAQQ;;;;AAKZ;EACI;EACA;EACA,kBA3DQ;;;AA8DZ;EACI;EACA;;AACA;EACI,cAhEO;EAiEP;;;AAIR;EACI;EACA,kBAzEQ;EA0ER;EACA;EACA;EACA;EACA;EACA;;AAEI;EACI;EACA,OAjFG;;AAqFP;EACI,kBAzFO;EA0FP;EACA;EACA;;AAGR;EACI;;;AAIR;EACI;EACA;;AACA;EAHJ;IAIQ;;;AAEJ;EACI;EACA,OA1GK;;AA4GT;EACI,kBA9GI;EA+GJ,OA7GO;EA8GP","file":"style.css"}
\ No newline at end of file diff --git a/sass/style.scss b/sass/style.scss index 73aeb80..3896907 100644 --- a/sass/style.scss +++ b/sass/style.scss @@ -90,6 +90,7 @@ a { background-color: $background-color; padding: 0.5em; margin: 0 0.5em; + font-size: 0.8em; } } &:hover { diff --git a/src/works/stories.rs b/src/works/stories.rs index bca5909..4620553 100644 --- a/src/works/stories.rs +++ b/src/works/stories.rs @@ -1,3 +1,4 @@ +use chrono::NaiveDate; use serde::{Deserialize, Serialize}; // stories and their information @@ -8,12 +9,12 @@ pub struct Stories(pub Vec<Story>); #[derive(Debug, Deserialize, Serialize)] pub struct Story { - pub id: u8, pub title: String, pub description: String, pub path_to_document: String, pub number_of_pages: u16, pub language: Language, + pub last_update: NaiveDate, } // see src/works/mod.rs for information of Works trait diff --git a/stories.json b/stories.json index e4e9192..743133d 100644 --- a/stories.json +++ b/stories.json @@ -1,18 +1,18 @@ [ { - "id": 1, "title": "Mit gutem Gewissen", "description": "Lorem ipsum dolor sit amet, officia excepteur.", "path_to_document": "./stories/mit_gutem_gewissen.pdf", "number_of_pages": 7, - "language": "German" + "language": "German", + "last_update": "2023-01-28" }, { - "id": 2, "title": "Das schweigende Spiegelbild", "description": "Em pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia.", "path_to_document": "./stories/das_schweigende_spiegelbild.pdf", "number_of_pages": 2, - "language": "German" + "language": "German", + "last_update": "2023-01-28" } ] diff --git a/templates/stories.html b/templates/stories.html index 9097ba0..11a2fa2 100644 --- a/templates/stories.html +++ b/templates/stories.html @@ -13,7 +13,7 @@ </form> </div> <div class="works"> - {% for work in works %} + {% for work in works | sort(attribute="last_update") | reverse %} <a href="{{work.path_to_document}}" class="work-card" download> <div class="title-and-description"> <h3>{{work.title}}</h3> @@ -22,6 +22,7 @@ <div class="info"> <span>{{work.number_of_pages}} Pages</span> <span class="story-language">{{work.language}}</span> + <span>Last Update: {{work.last_update}}</span> </div> </a> {% endfor %} |
