From 1aeba7b2e3949d8cd3e0483ca79d18eb50b88cdb Mon Sep 17 00:00:00 2001 From: Magnus Hoff Date: Tue, 3 Oct 2017 22:31:27 +0200 Subject: [PATCH] Simplify _changes list --- src/changes_resource.rs | 14 +++++++------- templates/changes.html | 16 +++------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/changes_resource.rs b/src/changes_resource.rs index 1befd1a..af4936f 100644 --- a/src/changes_resource.rs +++ b/src/changes_resource.rs @@ -37,14 +37,14 @@ impl Resource for ChangesResource { use chrono::{TimeZone, Local}; struct Row { - article_id: i32, - revision: i32, + _article_id: i32, + _revision: i32, created: String, slug: String, title: String, - latest: bool, + _latest: bool, } #[derive(BartDisplay)] @@ -62,12 +62,12 @@ impl Resource for ChangesResource { let changes = &data.into_iter().map(|x| { Row { - article_id: x.article_id, - revision: x.revision, - created: Local.from_utc_datetime(&x.created).to_string(), + _article_id: x.article_id, + _revision: x.revision, + created: Local.from_utc_datetime(&x.created).to_rfc2822(), slug: x.slug, title: x.title, - latest: x.latest, + _latest: x.latest, } }).collect::>(); diff --git a/templates/changes.html b/templates/changes.html index 1ee0698..1742877 100644 --- a/templates/changes.html +++ b/templates/changes.html @@ -6,22 +6,12 @@
- - - - - + + {{#changes}} - - - - + {{/changes}}
TitleSlugArticle IDRevisionCreatedArticleUpdated
- {{#.latest?}}{{/.latest}} - {{.title}} - {{#.latest?}}{{/.latest}} - {{#.slug.is_empty()?}}/{{/.slug.is_empty()}}{{.slug}}{{.article_id}}{{.revision}}{{.title}} {{.created}}