Skip to content
Snippets Groups Projects
Verified Commit 8c39776a authored by Jake's avatar Jake
Browse files

added edit_url and view_url to page

parent 358a1645
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,14 @@ ...@@ -12,6 +12,14 @@
"external": "_blank" "external": "_blank"
}, },
"default_status": "published", "default_status": "published",
"gitlab": {
"edit_url": {
"suffix": ""
},
"view_url": {
"suffix": "?plain=1"
}
},
"pandoc": { "pandoc": {
"mimetypes": { "mimetypes": {
"text/markdown": { "text/markdown": {
......
...@@ -4,6 +4,14 @@ ...@@ -4,6 +4,14 @@
{ "link": "tag:admin" }, { "link": "tag:admin" },
{ "link": "tag:internal" } { "link": "tag:internal" }
], ],
"gitlab": {
"edit_url": {
"prefix": "https://gitlab.gwdg.de/-/ide/project/GAUMI-fginfo/fg-website/edit/master/-/docs/"
},
"view_url": {
"prefix": "https://gitlab.gwdg.de/GAUMI-fginfo/fg-website/-/blob/master/docs/"
}
},
"lang": { "lang": {
"de": { "de": {
"sitename": "Dokumentation Fachgruppenwebseite", "sitename": "Dokumentation Fachgruppenwebseite",
......
...@@ -127,6 +127,25 @@ class Page: ...@@ -127,6 +127,25 @@ class Page:
#self.url = self.lang + '/' + self.category.name + '/' + self.slug + ".html" #self.url = self.lang + '/' + self.category.name + '/' + self.slug + ".html"
self.link = self._factories['link'].get_by_type("slug", self.slug, self.lang) self.link = self._factories['link'].get_by_type("slug", self.slug, self.lang)
gitlabsettings = self._config["gitlab"]
raw_edit_url = gitlabsettings["edit_url"]["prefix"]
raw_edit_url += '/'.join(self.subpath)
if len(self.subpath):
raw_edit_url += '/'
raw_edit_url += self.filename
raw_edit_url += gitlabsettings["edit_url"]["suffix"]
self.edit_url = self._factories['link'].get_by_raw(raw_edit_url, self.lang)
raw_view_url = gitlabsettings["view_url"]["prefix"]
raw_view_url += '/'.join(self.subpath)
if len(self.subpath):
raw_view_url += '/'
raw_view_url += self.filename
raw_view_url += gitlabsettings["view_url"]["suffix"]
self.view_url = self._factories['link'].get_by_raw(raw_view_url, self.lang)
def get_config(self): def get_config(self):
if not self._config: if not self._config:
self._config = self._factories['config'].get(self.lang) self._config = self._factories['config'].get(self.lang)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment