From d67cc668a20343badb8269bcfdbf34a1b237b52d Mon Sep 17 00:00:00 2001 From: Magnus Hoff Date: Tue, 24 Oct 2017 11:04:37 +0200 Subject: [PATCH] Update links from _changes to point to historical revisions of articles. This fixes #14. Also: Add links to _changes filtered by author for authors in the _changes feed --- src/resources/changes_resource.rs | 15 +++++++++------ templates/changes.html | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/resources/changes_resource.rs b/src/resources/changes_resource.rs index 7397ce2..8a6043c 100644 --- a/src/resources/changes_resource.rs +++ b/src/resources/changes_resource.rs @@ -203,12 +203,14 @@ impl Resource for ChangesResource { use chrono::{TimeZone, Local}; struct Row { - _article_id: i32, - _revision: i32, + sequence_number_plus_one: i32, + + article_id: i32, + revision: i32, created: String, author: Option, - slug: String, + _slug: String, title: String, _latest: bool, @@ -279,11 +281,12 @@ impl Resource for ChangesResource { let changes = &data.into_iter().map(|x| { Row { - _article_id: x.article_id, - _revision: x.revision, + sequence_number_plus_one: x.sequence_number + 1, + article_id: x.article_id, + revision: x.revision, created: Local.from_utc_datetime(&x.created).to_rfc2822(), author: x.author, - slug: x.slug, + _slug: x.slug, title: x.title, _latest: x.latest, } diff --git a/templates/changes.html b/templates/changes.html index 3589dcc..317e5f6 100644 --- a/templates/changes.html +++ b/templates/changes.html @@ -18,9 +18,9 @@ {{/changes}} {{#changes}} - {{.title}} + {{.title}} {{.created}} - {{#.author}}{{.}}{{/.author}}{{^.author}}Anonymous{{/.author}} + {{#.author}}{{.}}{{/.author}}{{^.author}}Anonymous{{/.author}} {{/changes}}