From cb269129a5f58194fdbf6b0fe57351a4e254f4ea Mon Sep 17 00:00:00 2001
From: Jake <j.vondoemming@stud.uni-goettingen.de>
Date: Mon, 3 Oct 2022 06:12:58 +0200
Subject: [PATCH] added history links

---
 config.json                |  3 +++
 docs/config.json           |  3 +++
 fgs/datatypes.py           |  8 ++++++++
 lang.json                  | 12 +++++++-----
 theme/templates/index.html |  3 ++-
 theme/templates/page.html  |  3 ++-
 theme/templates/tag.html   |  3 ++-
 7 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/config.json b/config.json
index cc5bb13..f4b1611 100644
--- a/config.json
+++ b/config.json
@@ -21,6 +21,9 @@
 		},
 		"view_url": {
 			"suffix": "?plain=1"
+		},
+		"history_url": {
+			"suffix": ""
 		}
 	},
 	"pandoc": {
diff --git a/docs/config.json b/docs/config.json
index ba459a8..32a27f2 100644
--- a/docs/config.json
+++ b/docs/config.json
@@ -10,6 +10,9 @@
 		},
 		"view_url": {
 			"prefix": "https://gitlab.gwdg.de/GAUMI-fginfo/fg-website/-/blob/master/docs/"
+		},
+		"history_url": {
+			"prefix": "https://gitlab.gwdg.de/GAUMI-fginfo/fg-website/-/commits/master/docs/"
 		}
 	},
 	"lang": {
diff --git a/fgs/datatypes.py b/fgs/datatypes.py
index a235b1a..dbfd960 100644
--- a/fgs/datatypes.py
+++ b/fgs/datatypes.py
@@ -153,6 +153,14 @@ class Page:
         raw_view_url += gitlabsettings["view_url"]["suffix"]
         self.view_url = self._factories['link'].get_by_raw(raw_view_url, self.lang)
 
+        raw_history_url = gitlabsettings["history_url"]["prefix"]
+        raw_history_url += '/'.join(self.subpath)
+        if len(self.subpath):
+            raw_history_url += '/'
+        raw_history_url += self.filename
+        raw_history_url += gitlabsettings["history_url"]["suffix"]
+        self.history_url = self._factories['link'].get_by_raw(raw_history_url, self.lang)
+
 
     def get_config(self):
         if not self._config:
diff --git a/lang.json b/lang.json
index f3e2dc4..d752806 100644
--- a/lang.json
+++ b/lang.json
@@ -19,7 +19,7 @@
 		"page": {
 			"published_prefix": "Erstellt: ",
 			"published_suffix": " | ",
-			"modified_prefix": "Letzte Änderung: ",
+			"modified_prefix": "Letzte&nbsp;Änderung: ",
 			"modified_suffix": "",
 			"authors_prefix": "Author(en): ",
 			"authors_suffix": "",
@@ -31,12 +31,14 @@
 			"tags_suffix": "",
 			"slug_prefix": "Slug: ",
 			"slug_suffix": "",
-			"edit_url_text": "[Seite bearbeiten]",
-			"view_url_text": "[Quelltext]"
+			"edit_url_text": "[Seite&nbsp;bearbeiten]",
+			"view_url_text": "[Quelltext]",
+			"history_url_text": "[Historie]"
 		},
 		"tag": {
-			"edit_url_text": "[Seite bearbeiten]",
-			"view_url_text": "[Quelltext]"
+			"edit_url_text": "[Text&nbsp;bearbeiten]",
+			"view_url_text": "[Quelltext]",
+			"history_url_text": "[Historie]"
 		},
 		"atom": {
 			"title": "<Dein Seitenname> Atom Feed"
diff --git a/theme/templates/index.html b/theme/templates/index.html
index 480e7d5..e4e533e 100644
--- a/theme/templates/index.html
+++ b/theme/templates/index.html
@@ -14,7 +14,8 @@
 	<footer class="page-footer content">
 		<div>
 			{{ common.render_link(page.edit_url, t[l].page.edit_url_text, l) }} | 
-			{{ common.render_link(page.view_url, t[l].page.view_url_text, l) }}
+			{{ common.render_link(page.view_url, t[l].page.view_url_text, l) }} | 
+			{{ common.render_link(page.history_url, t[l].page.history_url_text, l) }}
 		</div>
 
 	</footer>
diff --git a/theme/templates/page.html b/theme/templates/page.html
index c29e618..e5579bd 100644
--- a/theme/templates/page.html
+++ b/theme/templates/page.html
@@ -95,7 +95,8 @@
 
 		<div>
 			{{ common.render_link(page.edit_url, t[l].page.edit_url_text, l) }} | 
-			{{ common.render_link(page.view_url, t[l].page.view_url_text, l) }}
+			{{ common.render_link(page.view_url, t[l].page.view_url_text, l) }} | 
+			{{ common.render_link(page.history_url, t[l].page.history_url_text, l) }}
 		</div>
 
 	</footer>
diff --git a/theme/templates/tag.html b/theme/templates/tag.html
index de38594..e13c331 100644
--- a/theme/templates/tag.html
+++ b/theme/templates/tag.html
@@ -17,7 +17,8 @@
 	<footer class="page-footer content">
 		<div>
 			{{ common.render_link(tag.page.edit_url, t[l].tag.edit_url_text, l) }} | 
-			{{ common.render_link(tag.page.view_url, t[l].tag.view_url_text, l) }}
+			{{ common.render_link(tag.page.view_url, t[l].tag.view_url_text, l) }} | 
+			{{ common.render_link(tag.page.history_url, t[l].tag.history_url_text, l) }}
 		</div>
 	</footer>
 	{%- endif -%}
-- 
GitLab