mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 09:37:26 +00:00
news posts and faq posts have separate layouts
This commit is contained in:
parent
f5a9d87452
commit
9fd609561e
7 changed files with 39 additions and 20 deletions
|
@ -89,14 +89,14 @@ class Controller
|
|||
{
|
||||
return ContentActions::executeRss();
|
||||
}
|
||||
return $slug ? ContentActions::executePost($uri) : ContentActions::executeNews();
|
||||
return $slug ? ContentActions::executeNewsPost($uri) : ContentActions::executeNews();
|
||||
}
|
||||
|
||||
$faqPattern = '#^' . ContentActions::URL_FAQ . '(/|$)#';
|
||||
if (preg_match($faqPattern, $uri))
|
||||
{
|
||||
$slug = preg_replace($faqPattern, '', $uri);
|
||||
return $slug ? ContentActions::executePost($uri) : ContentActions::executeFaq();
|
||||
return $slug ? ContentActions::executeFaqPost($uri) : ContentActions::executeFaq();
|
||||
}
|
||||
$noSlashUri = ltrim($uri, '/');
|
||||
|
||||
|
|
|
@ -72,14 +72,14 @@ class ContentActions extends Actions
|
|||
]];
|
||||
}
|
||||
|
||||
public static function executePost($relativeUri)
|
||||
public static function executeNewsPost($relativeUri)
|
||||
{
|
||||
$post = Post::load(ltrim($relativeUri, '/'));
|
||||
if (!$post)
|
||||
{
|
||||
return ['page/404', []];
|
||||
}
|
||||
return ['content/post', [
|
||||
return ['content/news-post', [
|
||||
'post' => $post,
|
||||
View::LAYOUT_PARAMS => [
|
||||
'showRssLink' => true
|
||||
|
@ -87,6 +87,18 @@ class ContentActions extends Actions
|
|||
]];
|
||||
}
|
||||
|
||||
public static function executeFaqPost($relativeUri)
|
||||
{
|
||||
$post = Post::load(ltrim($relativeUri, '/'));
|
||||
if (!$post)
|
||||
{
|
||||
return ['page/404', []];
|
||||
}
|
||||
return ['content/faq-post', [
|
||||
'post' => $post,
|
||||
]];
|
||||
}
|
||||
|
||||
public static function executePressKit()
|
||||
{
|
||||
$zipFileName = 'lbry-press-kit-' . date('Y-m-d') . '.zip';
|
||||
|
|
|
@ -163,16 +163,6 @@ class Post
|
|||
return $this->date !== null;
|
||||
}
|
||||
|
||||
public function hasPrevNext()
|
||||
{
|
||||
return $this->postType == 'news';
|
||||
}
|
||||
|
||||
public function hasLearnFooter()
|
||||
{
|
||||
return $this->postType == 'news';
|
||||
}
|
||||
|
||||
public function getAuthorName()
|
||||
{
|
||||
switch(strtolower($this->author))
|
||||
|
|
17
view/template/content/faq-post.php
Normal file
17
view/template/content/faq-post.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php Response::setMetaDescription($post->getTitle()) ?>
|
||||
<?php Response::addMetaImages($post->getImageUrls()) ?>
|
||||
<?php NavActions::setNavUri('/learn') ?>
|
||||
<?php echo View::render('nav/_header') ?>
|
||||
<main>
|
||||
<section class="post-content">
|
||||
<div class="content">
|
||||
<br />
|
||||
<div class="meta">
|
||||
<a href="/faq"><< Back to FAQ</a>
|
||||
</div>
|
||||
<h1><?php echo htmlentities($post->getTitle()) ?></h1>
|
||||
<?php echo $post->getContentHtml() ?>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<?php echo View::render('nav/_footer') ?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php Response::setMetaDescription('Frequently asked questions about LBRY.') ?>
|
||||
<?php NavActions::setNavUri('/learn') ?>
|
||||
<?php echo View::render('nav/_header', ['isDark' => false]) ?>
|
||||
<main>
|
||||
<section class="content content-readable spacer2">
|
||||
|
|
|
@ -22,14 +22,10 @@
|
|||
<div class="content">
|
||||
<?php echo $post->getContentHtml() ?>
|
||||
</div>
|
||||
<?php if ($post->hasPrevNext()): ?>
|
||||
<?php echo View::render('content/_postNav', ['post' => $post]) ?>
|
||||
<?php endif ?>
|
||||
<?php echo View::render('content/_postNav', ['post' => $post]) ?>
|
||||
</section>
|
||||
|
||||
<?php if ($post->hasLearnFooter()): ?>
|
||||
<?php echo View::render('nav/_learnFooter', ['isDark' => false]) ?>
|
||||
<?php endif ?>
|
||||
<?php echo View::render('nav/_learnFooter', ['isDark' => false]) ?>
|
||||
|
||||
<?php if ($post->hasAuthor()): ?>
|
||||
<?php echo View::render('content/_postAuthor', ['post' => $post]) ?>
|
|
@ -13,6 +13,9 @@ code
|
|||
}
|
||||
pre
|
||||
{
|
||||
> code {
|
||||
padding: 0;
|
||||
}
|
||||
margin-bottom: $spacing-vertical;
|
||||
border-left: .3rem solid $color-primary;
|
||||
padding: 10px 20px;
|
||||
|
|
Loading…
Add table
Reference in a new issue