From 8fe437050c4e4c8b2adc7d933dc216ad010fb251 Mon Sep 17 00:00:00 2001
From: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
Date: Sun, 25 Oct 2015 14:10:56 +0000
Subject: [PATCH] Display tags a bottom of page

---
 build/index.php       | 18 +++++++++++++++++-
 module_index.json     |  2 +-
 modules/page-view.php | 14 +++++++++++++-
 settings.fragment.php |  4 ++++
 4 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/build/index.php b/build/index.php
index 6483eda..de426c8 100644
--- a/build/index.php
+++ b/build/index.php
@@ -261,6 +261,10 @@ textarea { width: calc(100% - 2rem); min-height: 35rem; font-size: 1.25rem; }
 textarea ~ input[type=submit] { width: calc(100% - 0.3rem); margin: 0.5rem 0.8rem; padding: 0.5rem; font-weight: bolder; }
 .editform input[type=text] { width: calc(100% - 0.3rem); box-sizing: border-box; }
 
+.page-tags-display { margin: 0.5rem 0 0 0; padding: 0; list-style-type: none; }
+.page-tags-display li { display: inline-block; margin: 0.5rem; padding: 0.5rem; background: #D2C3DD; color: #FB701A; white-space: nowrap; }
+.page-tags-display li:before { content: \"\\A\"; position: relative; top: 0.03rem; left: -0.9rem; width: 0; height: 0; border-top: 0.6rem solid transparent; border-bottom: 0.6rem solid transparent; border-right: 0.5rem solid #D2C3DD; }
+
 footer { padding: 2rem; }
 /* #ffdb6d #36962c */";
 
@@ -2366,7 +2370,7 @@ register_module([
 				$title = $settings->protectedpagechar . $title;
 			$content = "<h1>$env->page</h1>\n";
 			
-			// Add an extra message if the requested was redirected from another page
+			// Add an extra message if the requester was redirected from another page
 			if(isset($_GET["redirected_from"]))
 				$content .= "<p><em>Redirected from <a href='?page=" . rawurlencode($_GET["redirected_from"]) . "&redirect=no'>" . $_GET["redirected_from"] . "</a>.</em></p>";
 			
@@ -2374,6 +2378,18 @@ register_module([
 			
 			$content .= parse_page_source(file_get_contents("$env->page.md"));
 			
+			// todo display tags here
+			if(!empty($pageindex->$page->tags))
+			{
+				$content .= "<ul class='page-tags-display'><li>";
+				$content .= implode("</li><li>", $pageindex->$page->tags);
+				$content .= "</li></ul>\n";
+			}
+			else
+			{
+				$content .= "<aside><em>No tags yet! Add some by <a href='?action=edit&page=" . rawurlencode($env->page) .  "'>editing this page</a>!</em></aside>\n";
+			}
+			
 			if($settings->show_subpages)
 			{
 				$subpages = get_object_vars(get_subpages($pageindex, $env->page));
diff --git a/module_index.json b/module_index.json
index 79990cd..bda4063 100644
--- a/module_index.json
+++ b/module_index.json
@@ -149,7 +149,7 @@
         "author": "Starbeamrainbowlabs",
         "description": "Allows you to view pages. You reallyshould include this one.",
         "id": "page-view",
-        "lastupdate": 1445170746,
+        "lastupdate": 1445775829,
         "optional": false
     },
     {
diff --git a/modules/page-view.php b/modules/page-view.php
index c25cd89..a815c92 100644
--- a/modules/page-view.php
+++ b/modules/page-view.php
@@ -51,7 +51,7 @@ register_module([
 				$title = $settings->protectedpagechar . $title;
 			$content = "<h1>$env->page</h1>\n";
 			
-			// Add an extra message if the requested was redirected from another page
+			// Add an extra message if the requester was redirected from another page
 			if(isset($_GET["redirected_from"]))
 				$content .= "<p><em>Redirected from <a href='?page=" . rawurlencode($_GET["redirected_from"]) . "&redirect=no'>" . $_GET["redirected_from"] . "</a>.</em></p>";
 			
@@ -59,6 +59,18 @@ register_module([
 			
 			$content .= parse_page_source(file_get_contents("$env->page.md"));
 			
+			// todo display tags here
+			if(!empty($pageindex->$page->tags))
+			{
+				$content .= "<ul class='page-tags-display'><li>";
+				$content .= implode("</li><li>", $pageindex->$page->tags);
+				$content .= "</li></ul>\n";
+			}
+			else
+			{
+				$content .= "<aside><em>No tags yet! Add some by <a href='?action=edit&page=" . rawurlencode($env->page) .  "'>editing this page</a>!</em></aside>\n";
+			}
+			
 			if($settings->show_subpages)
 			{
 				$subpages = get_object_vars(get_subpages($pageindex, $env->page));
diff --git a/settings.fragment.php b/settings.fragment.php
index f583c6e..f4bb981 100644
--- a/settings.fragment.php
+++ b/settings.fragment.php
@@ -258,6 +258,10 @@ textarea { width: calc(100% - 2rem); min-height: 35rem; font-size: 1.25rem; }
 textarea ~ input[type=submit] { width: calc(100% - 0.3rem); margin: 0.5rem 0.8rem; padding: 0.5rem; font-weight: bolder; }
 .editform input[type=text] { width: calc(100% - 0.3rem); box-sizing: border-box; }
 
+.page-tags-display { margin: 0.5rem 0 0 0; padding: 0; list-style-type: none; }
+.page-tags-display li { display: inline-block; margin: 0.5rem; padding: 0.5rem; background: #D2C3DD; color: #FB701A; white-space: nowrap; }
+.page-tags-display li:before { content: \"\\A\"; position: relative; top: 0.03rem; left: -0.9rem; width: 0; height: 0; border-top: 0.6rem solid transparent; border-bottom: 0.6rem solid transparent; border-right: 0.5rem solid #D2C3DD; }
+
 footer { padding: 2rem; }
 /* #ffdb6d #36962c */";
 
