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};
|
use chrono::{TimeZone, Local};
|
||||||
|
|
||||||
struct Row {
|
struct Row {
|
||||||
_article_id: i32,
|
sequence_number_plus_one: i32,
|
||||||
_revision: i32,
|
|
||||||
|
article_id: i32,
|
||||||
|
revision: i32,
|
||||||
created: String,
|
created: String,
|
||||||
author: Option<String>,
|
author: Option<String>,
|
||||||
|
|
||||||
slug: String,
|
_slug: String,
|
||||||
title: String,
|
title: String,
|
||||||
|
|
||||||
_latest: bool,
|
_latest: bool,
|
||||||
|
@ -279,11 +281,12 @@ impl Resource for ChangesResource {
|
||||||
|
|
||||||
let changes = &data.into_iter().map(|x| {
|
let changes = &data.into_iter().map(|x| {
|
||||||
Row {
|
Row {
|
||||||
_article_id: x.article_id,
|
sequence_number_plus_one: x.sequence_number + 1,
|
||||||
_revision: x.revision,
|
article_id: x.article_id,
|
||||||
|
revision: x.revision,
|
||||||
created: Local.from_utc_datetime(&x.created).to_rfc2822(),
|
created: Local.from_utc_datetime(&x.created).to_rfc2822(),
|
||||||
author: x.author,
|
author: x.author,
|
||||||
slug: x.slug,
|
_slug: x.slug,
|
||||||
title: x.title,
|
title: x.title,
|
||||||
_latest: x.latest,
|
_latest: x.latest,
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
{{/changes}}
|
{{/changes}}
|
||||||
{{#changes}}
|
{{#changes}}
|
||||||
<tr>
|
<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>{{.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>
|
</tr>
|
||||||
{{/changes}}
|
{{/changes}}
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in a new issue