diff --git a/src/resources/changes_resource.rs b/src/resources/changes_resource.rs index 0f3ef6c..5926e5f 100644 --- a/src/resources/changes_resource.rs +++ b/src/resources/changes_resource.rs @@ -12,6 +12,7 @@ use site::Layout; use state::State; use web::{Resource, ResponseFuture}; +use super::diff_resource::{self, ArticleRevisionReference}; use super::pagination::Pagination; use super::TemporaryRedirectResource; @@ -217,6 +218,8 @@ impl Resource for ChangesResource { title: String, _latest: bool, + + diff_link: String, } impl<'a> Row<'a> { @@ -334,6 +337,10 @@ impl Resource for ChangesResource { _slug: x.slug, title: x.title, _latest: x.latest, + diff_link: diff_resource::QueryParameters::new( + ArticleRevisionReference::Some { article_id: x.article_id as u32, revision: x.revision as u32 - 1 }, + ArticleRevisionReference::Some { article_id: x.article_id as u32, revision: x.revision as u32 }, + ).into_link() } }).collect::>(); diff --git a/src/resources/diff_resource.rs b/src/resources/diff_resource.rs index 6054e89..1385f09 100644 --- a/src/resources/diff_resource.rs +++ b/src/resources/diff_resource.rs @@ -120,7 +120,7 @@ impl QueryParameters { } pub fn into_link(self) -> String { - serde_urlencoded::to_string(self).expect("Serializing to String cannot fail") + format!("_diff?{}", serde_urlencoded::to_string(self).expect("Serializing to String cannot fail")) } } diff --git a/templates/changes.html b/templates/changes.html index 733c50b..1dc4969 100644 --- a/templates/changes.html +++ b/templates/changes.html @@ -24,6 +24,7 @@ Article Updated {{#show_authors?}}Author{{/show_authors}} + {{/changes}} {{#changes}} @@ -31,6 +32,7 @@ {{.title}} {{.created}} {{#show_authors?}}{{#..author}}{{.}}{{/..author}}{{^..author}}Anonymous{{/..author}}{{/show_authors}} + change {{/changes}} diff --git a/templates/diff.html b/templates/diff.html index b6da051..7c7eb11 100644 --- a/templates/diff.html +++ b/templates/diff.html @@ -1,6 +1,9 @@
-

Diff

+

Difference

+
+ +

{{#title}}{{#.removed}}{{.}}{{/.removed}}{{#.same}}{{.}}{{/.same}}{{#.added}}{{.}}{{/.added}}{{/title}}