add bio html to show social links author (#408)

* add email and social links to author on content pages
This commit is contained in:
YULIUS KURNIAWAN KRISTIANTO 2018-03-12 23:20:42 +01:00 committed by Thomas Zarebczan
parent 5c77bdc936
commit c7531eda8c
4 changed files with 40 additions and 5 deletions

View file

@ -353,7 +353,10 @@ class ContentActions extends Actions
return [
'authorName' => $post->getAuthorName(),
'photoImgSrc' => $post->getAuthorPhoto(),
'authorBioHtml' => $post->getAuthorBioHtml()
'authorBioHtml' => $post->getAuthorBioHtml(),
'authorGithub' => $post->getAuthorGithubID(),
'authorTwitter' => $post->getAuthorTwitterID(),
'authorEmail' => $post->getAuthorPostEmail()
];
}

View file

@ -156,6 +156,30 @@ class Post
return $this->author;
}
public function getAuthorGithubID()
{
$post = ContentActions::prepareBioPartial(['person' =>$this->author]);
if(array_key_exists("github", $post)){
return $post["github"];
}
}
public function getAuthorTwitterID()
{
$post = ContentActions::prepareBioPartial(['person' =>$this->author]);
if(array_key_exists("twitter", $post)){
return $post["twitter"];
}
}
public function getAuthorEmail()
{
$post = ContentActions::prepareBioPartial(['person' =>$this->author]);
if(array_key_exists("email", $post)){
return $post["email"];
}
}
public function getDate()
{
return $this->date;
@ -232,7 +256,7 @@ class Post
return $post["name"];
}
public function getAuthorEmail()
public function getAuthorPostEmail()
{
$post = ContentActions::prepareBioPartial(['person' =>$this->author]);

View file

@ -6,9 +6,17 @@
</div>
<div class="span9">
<div class="meta">{{news.author}}</div>
<h3><?php echo $authorName ?></h3>
<h3><?php echo $authorName ?>
<?php if (isset($authorEmail)): ?>
<a href="mailto:<?php echo $authorEmail ?>" class="link-primary"><span class="icon icon-envelope"></span></a>
<?php endif ?>
<?php if (isset ($authorGithub)): ?>
<a href="https://github.com/<?php echo $authorGithub ?>" class="link-primary"><span class="icon icon-github"></span></a>
<?php endif ?>
<?php if (isset($authorTwitter)): ?>
<a href="https://www.twitter.com/<?php echo $authorTwitter?>" class="link-primary"><span class="icon icon-twitter"></span></a>
<?php endif ?></h3>
<?php echo $authorBioHtml ?>
</div>
</div>
</div>
</div>

View file

@ -203,5 +203,5 @@
.post-author-spotlight
{
h3 { text-transform: uppercase; margin-top: $spacing-vertical / 4 !important; }
h3 { text-transform: uppercase; margin-top: $spacing-vertical / 4 !important; margin-bottom: 0;}
}