link to edit help articles on github

This commit is contained in:
Alex Grintsvayg 2017-03-24 18:07:33 -04:00
parent d6543a05fa
commit 84a5a14ad4
3 changed files with 14 additions and 4 deletions

View file

@ -17,7 +17,8 @@ class NavActions extends Actions
public static function prepareFooterPartial(array $vars) public static function prepareFooterPartial(array $vars)
{ {
return $vars + [ return $vars + [
'showLearnFooter' => false 'isDark' => false,
'showLearnFooter' => false,
]; ];
} }

View file

@ -10,7 +10,7 @@ class Post
SORT_ORD_ASC = 'sort_ord_asc'; SORT_ORD_ASC = 'sort_ord_asc';
protected static $slugMap = []; 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; protected $isCoverLight = false;
public static function load($relativeOrAbsolutePath) public static function load($relativeOrAbsolutePath)
@ -47,11 +47,12 @@ class Post
{ {
throw new PostMalformedException('Post "' . basename($path) . '" is missing front matter or content'); 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->postType = $postType;
$this->slug = $slug; $this->slug = $slug;
$this->markdown = $markdown; $this->markdown = $markdown;
@ -394,4 +395,9 @@ class Post
} }
return static::$slugMap[$postType]; return static::$slugMap[$postType];
} }
public function getGithubEditUrl()
{
return 'https://github.com/lbryio/lbry.io/tree/master' . str_replace(ROOT_DIR, '', $this->path);
}
} }

View file

@ -11,6 +11,9 @@
</div> </div>
<h1><?php echo htmlentities($post->getTitle()) ?></h1> <h1><?php echo htmlentities($post->getTitle()) ?></h1>
<?php echo $post->getContentHtml() ?> <?php echo $post->getContentHtml() ?>
<p class="meta">
See a mistake? <a href="<?php echo $post->getGithubEditUrl() ?>">Edit this page on GitHub</a>.
</p>
</div> </div>
</section> </section>
</main> </main>