From ac5ff0dbcc895b6cb4beb977307d87496f4efaf2 Mon Sep 17 00:00:00 2001
From: Magnus Hoff
Date: Mon, 6 Nov 2017 15:52:51 +0100
Subject: [PATCH] Add link to article history from diff page
---
src/resources/diff_resource.rs | 10 ++++++++++
templates/diff.html | 4 ++++
2 files changed, 14 insertions(+)
diff --git a/src/resources/diff_resource.rs b/src/resources/diff_resource.rs
index 22bc080..36b24d8 100644
--- a/src/resources/diff_resource.rs
+++ b/src/resources/diff_resource.rs
@@ -14,6 +14,9 @@ use site::Layout;
use state::State;
use web::{Resource, ResponseFuture};
+use super::changes_resource;
+use super::pagination::Pagination;
+
type BoxResource = Box;
#[derive(Clone)]
@@ -98,6 +101,7 @@ impl Resource for DiffResource {
struct Template<'a> {
consecutive: bool,
article_id: u32,
+ article_history_link: &'a str,
title: &'a [Diff],
lines: &'a [Diff<&'a str>],
}
@@ -120,6 +124,12 @@ impl Resource for DiffResource {
body: &Template {
consecutive: self.to.revision - self.from.revision == 1,
article_id: self.from.article_id as u32,
+ article_history_link: &format!("_changes{}",
+ changes_resource::QueryParameters::default()
+ .article_id(Some(self.from.article_id))
+ .pagination(Pagination::After(self.from.revision))
+ .into_link()
+ ),
title: &diff::chars(&self.from.title, &self.to.title)
.into_iter()
.map(|x| match x {
diff --git a/templates/diff.html b/templates/diff.html
index a38b540..aec2e35 100644
--- a/templates/diff.html
+++ b/templates/diff.html
@@ -5,6 +5,10 @@
You are viewing the difference between two {{#consecutive?}}consecutive{{/consecutive}}
revisions of this article.
+
+
+ See the list of all changes to this article.
+