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