Display author name in articles and _changes. This fixes #6
This commit is contained in:
parent
d22ac6ef84
commit
f923b5b6c0
5 changed files with 9 additions and 1 deletions
|
@ -47,6 +47,7 @@ impl Resource for ArticleResource {
|
||||||
article_id: i32,
|
article_id: i32,
|
||||||
revision: i32,
|
revision: i32,
|
||||||
created: &'a str,
|
created: &'a str,
|
||||||
|
author: Option<&'a str>,
|
||||||
|
|
||||||
edit: bool,
|
edit: bool,
|
||||||
cancel_url: Option<&'a str>,
|
cancel_url: Option<&'a str>,
|
||||||
|
@ -71,6 +72,7 @@ impl Resource for ArticleResource {
|
||||||
article_id: data.article_id,
|
article_id: data.article_id,
|
||||||
revision: data.revision,
|
revision: data.revision,
|
||||||
created: &Local.from_utc_datetime(&data.created).to_rfc2822(),
|
created: &Local.from_utc_datetime(&data.created).to_rfc2822(),
|
||||||
|
author: data.author.as_ref().map(|x| &**x),
|
||||||
edit: self.edit,
|
edit: self.edit,
|
||||||
cancel_url: Some(&data.slug),
|
cancel_url: Some(&data.slug),
|
||||||
title: &data.title,
|
title: &data.title,
|
||||||
|
|
|
@ -40,6 +40,7 @@ impl Resource for ChangesResource {
|
||||||
_article_id: i32,
|
_article_id: i32,
|
||||||
_revision: i32,
|
_revision: i32,
|
||||||
created: String,
|
created: String,
|
||||||
|
author: Option<String>,
|
||||||
|
|
||||||
slug: String,
|
slug: String,
|
||||||
title: String,
|
title: String,
|
||||||
|
@ -84,6 +85,7 @@ impl Resource for ChangesResource {
|
||||||
_article_id: x.article_id,
|
_article_id: x.article_id,
|
||||||
_revision: x.revision,
|
_revision: x.revision,
|
||||||
created: Local.from_utc_datetime(&x.created).to_rfc2822(),
|
created: Local.from_utc_datetime(&x.created).to_rfc2822(),
|
||||||
|
author: x.author,
|
||||||
slug: x.slug,
|
slug: x.slug,
|
||||||
title: x.title,
|
title: x.title,
|
||||||
_latest: x.latest,
|
_latest: x.latest,
|
||||||
|
|
|
@ -55,6 +55,7 @@ impl Resource for NewArticleResource {
|
||||||
article_id: &'a str,
|
article_id: &'a str,
|
||||||
revision: &'a str,
|
revision: &'a str,
|
||||||
created: &'a str,
|
created: &'a str,
|
||||||
|
author: Option<&'a str>,
|
||||||
|
|
||||||
edit: bool,
|
edit: bool,
|
||||||
cancel_url: Option<&'a str>,
|
cancel_url: Option<&'a str>,
|
||||||
|
@ -78,6 +79,7 @@ impl Resource for NewArticleResource {
|
||||||
article_id: NDASH,
|
article_id: NDASH,
|
||||||
revision: NDASH,
|
revision: NDASH,
|
||||||
created: NDASH,
|
created: NDASH,
|
||||||
|
author: None,
|
||||||
|
|
||||||
// Implicitly start in edit-mode when no slug is given. This
|
// Implicitly start in edit-mode when no slug is given. This
|
||||||
// currently directly corresponds to the /_new endpoint
|
// currently directly corresponds to the /_new endpoint
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<dd class="revision">{{revision}}</dd>
|
<dd class="revision">{{revision}}</dd>
|
||||||
|
|
||||||
<dt>Last updated</dt>
|
<dt>Last updated</dt>
|
||||||
<dd class="last-updated">{{created}}</dd>
|
<dd class="last-updated">{{created}}{{#author}} by {{.}}{{/author}}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
{{>footer/items.html}}
|
{{>footer/items.html}}
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -9,11 +9,13 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>Article</th>
|
<th>Article</th>
|
||||||
<th>Updated</th>
|
<th>Updated</th>
|
||||||
|
<th>Author</th>
|
||||||
</tr>
|
</tr>
|
||||||
{{#changes}}
|
{{#changes}}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{#.slug.is_empty()?}}.{{/.slug.is_empty()}}{{.slug}}">{{.title}}</a></td>
|
<td><a href="{{#.slug.is_empty()?}}.{{/.slug.is_empty()}}{{.slug}}">{{.title}}</a></td>
|
||||||
<td>{{.created}}</td>
|
<td>{{.created}}</td>
|
||||||
|
<td>{{#.author}}{{.}}{{/.author}}{{^.author}}<i>Anonymous</i>{{/.author}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/changes}}
|
{{/changes}}
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in a new issue