From 84a5a14ad4a2fe8e7035d59d9836a2e70cbef307 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Fri, 24 Mar 2017 18:07:33 -0400 Subject: [PATCH] link to edit help articles on github --- controller/action/NavActions.class.php | 3 ++- model/Post.class.php | 12 +++++++++--- view/template/content/faq-post.php | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/controller/action/NavActions.class.php b/controller/action/NavActions.class.php index 8f91f5d1..5ddc575a 100644 --- a/controller/action/NavActions.class.php +++ b/controller/action/NavActions.class.php @@ -17,7 +17,8 @@ class NavActions extends Actions public static function prepareFooterPartial(array $vars) { return $vars + [ - 'showLearnFooter' => false + 'isDark' => false, + 'showLearnFooter' => false, ]; } diff --git a/model/Post.class.php b/model/Post.class.php index 2f71744a..77e7e4f9 100644 --- a/model/Post.class.php +++ b/model/Post.class.php @@ -10,7 +10,7 @@ class Post SORT_ORD_ASC = 'sort_ord_asc'; protected static $slugMap = []; - protected $slug, $title, $metadata, $author, $date, $markdown, $contentText, $contentHtml, $cover, $postType, $category; + protected $path, $slug, $title, $metadata, $author, $date, $markdown, $contentText, $contentHtml, $cover, $postType, $category; protected $isCoverLight = false; public static function load($relativeOrAbsolutePath) @@ -47,11 +47,12 @@ class Post { throw new PostMalformedException('Post "' . basename($path) . '" is missing front matter or content'); } - return new static($postType, $slug, Spyc::YAMLLoadString(trim($frontMatter)), trim($content)); + return new static($path, $postType, $slug, Spyc::YAMLLoadString(trim($frontMatter)), trim($content)); } - public function __construct($postType, $slug, $frontMatter, $markdown) + public function __construct($path, $postType, $slug, $frontMatter, $markdown) { + $this->path = $path; $this->postType = $postType; $this->slug = $slug; $this->markdown = $markdown; @@ -394,4 +395,9 @@ class Post } return static::$slugMap[$postType]; } + + public function getGithubEditUrl() + { + return 'https://github.com/lbryio/lbry.io/tree/master' . str_replace(ROOT_DIR, '', $this->path); + } } \ No newline at end of file diff --git a/view/template/content/faq-post.php b/view/template/content/faq-post.php index 00cd860d..2fda8fb5 100644 --- a/view/template/content/faq-post.php +++ b/view/template/content/faq-post.php @@ -11,6 +11,9 @@

getTitle()) ?>

getContentHtml() ?> +

+ See a mistake? Edit this page on GitHub. +