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
This commit is contained in:
parent
ffccc5722c
commit
d67cc668a2
2 changed files with 11 additions and 8 deletions
|
@ -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<String>,
|
||||
|
||||
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,
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
{{/changes}}
|
||||
{{#changes}}
|
||||
<tr>
|
||||
<td><a href="{{#.slug.is_empty()?}}.{{/.slug.is_empty()}}{{.slug}}">{{.title}}</a></td>
|
||||
<td><a href="_revisions/{{.article_id}}/{{.revision}}">{{.title}}</a></td>
|
||||
<td>{{.created}}</td>
|
||||
<td>{{#.author}}{{.}}{{/.author}}{{^.author}}<i>Anonymous</i>{{/.author}}</td>
|
||||
<td>{{#.author}}<a href="_changes?before={{..sequence_number_plus_one}}&author={{.}}">{{.}}</a>{{/.author}}{{^.author}}<i>Anonymous</i>{{/.author}}</td>
|
||||
</tr>
|
||||
{{/changes}}
|
||||
</table>
|
||||
|
|
Loading…
Reference in a new issue