usd bounties

This commit is contained in:
Jeremy Kauffman 2017-05-23 21:41:40 -04:00
parent 8fcf46d473
commit a010f32b8b
11 changed files with 30 additions and 10 deletions

View file

@ -1,7 +1,7 @@
--- ---
category: browser category: browser
title: Internationalization of LBRY Browser title: Internationalization of LBRY Browser
award: 40000 award: 2000
status: available status: available
date: '2016-07-01' date: '2016-07-01'
--- ---

View file

@ -1,7 +1,7 @@
--- ---
category: daemon category: daemon
title: Add Support for BitTorrent title: Add Support for BitTorrent
award: 100000 award: 10000
status: available status: available
date: '2016-07-01' date: '2016-07-01'
--- ---

View file

@ -1,7 +1,7 @@
--- ---
category: daemon category: daemon
title: Add Support for HTTP title: Add Support for HTTP
award: 40000 award: 3000
status: available status: available
date: '2016-11-01' date: '2016-11-01'
--- ---

View file

@ -1,7 +1,7 @@
--- ---
category: human category: human
title: LBRY Community Rep title: LBRY Community Rep
award: 5000 award: 300
status: available status: available
date: '2016-07-01' date: '2016-07-01'
--- ---

View file

@ -1,7 +1,7 @@
--- ---
category: osx category: osx
title: PKG Installer for OS X title: PKG Installer for OS X
award: 20000 award: 1500
status: available status: available
date: '2016-07-01' date: '2016-07-01'
--- ---

View file

@ -1,7 +1,7 @@
--- ---
category: human category: human
title: Write, Broadcast or Share LBRY title: Write, Broadcast or Share LBRY
award: 2000 award: 250
status: available status: available
date: '2016-07-01' date: '2016-07-01'
--- ---

View file

@ -2,7 +2,7 @@
category: design category: design
title: Create Social Media Cover Images title: Create Social Media Cover Images
award: 500 award: 500
status: available status: complete
date: '2016-07-01' date: '2016-07-01'
--- ---

View file

@ -1,8 +1,8 @@
--- ---
category: web category: web
title: Typos and Edits title: Typos and Edits
award: 50 award: 10
status: complete status: available
date: '2016-11-01' date: '2016-11-01'
--- ---

View file

@ -139,13 +139,23 @@ class ContentActions extends Actions
return ['content/press-post', ['post' => $post]]; return ['content/press-post', ['post' => $post]];
} }
protected static function convertBountyAmount($amount)
{
return is_numeric($amount) ? round($amount / LBRY::getLBCtoUSDRate(), -1) : $amount;
}
public static function executeBounty(string $slug = null): array public static function executeBounty(string $slug = null): array
{ {
Response::enableHttpCache(); Response::enableHttpCache();
if ($slug) if ($slug)
{ {
list($metadata, $postHtml) = View::parseMarkdown(ContentActions::VIEW_FOLDER_BOUNTY . '/' . $slug . '.md'); list($metadata, $postHtml) = View::parseMarkdown(ContentActions::VIEW_FOLDER_BOUNTY . '/' . $slug . '.md');
$metadata['lbc_award'] = static::convertBountyAmount($metadata['award']);
if (!$postHtml) if (!$postHtml)
{ {
return NavActions::execute404(); return NavActions::execute404();
@ -184,6 +194,11 @@ class ContentActions extends Actions
return $metadataA['title'] < $metadataB['title'] ? -1 : 1; return $metadataA['title'] < $metadataB['title'] ? -1 : 1;
}); });
foreach($bounties as $bounty) {
$metadata = $bounty->getMetadata();
$bounty->setMetadataItem('lbc_award', static::convertBountyAmount($metadata['award']));
}
return ['bounty/list', [ return ['bounty/list', [
'bounties' => $bounties, 'bounties' => $bounties,
'categories' => $allCategories, 'categories' => $allCategories,

View file

@ -126,6 +126,11 @@ class Post
return $this->metadata; return $this->metadata;
} }
public function setMetadataItem($key, $value)
{
$this->metadata[$key] = $value;
}
public function getRelativeUrl() public function getRelativeUrl()
{ {
return '/' . $this->postType . '/' . $this->slug; return '/' . $this->postType . '/' . $this->slug;

View file

@ -1,5 +1,5 @@
<div class="clearfix"> <div class="clearfix">
<span class="align-left"><span class="meta"><?php echo $metadata['category'] ?></span></span> <span class="align-left"><span class="meta"><?php echo $metadata['category'] ?></span></span>
<span class="align-right"><span class="badge badge-primary <?php echo isset($metadata['status']) ? 'bounty-award-' . $metadata['status'] : '' ?>" <span class="align-right"><span class="badge badge-primary <?php echo isset($metadata['status']) ? 'bounty-award-' . $metadata['status'] : '' ?>"
><?php echo i18n::formatCredits($metadata['award']) ?></span></span> ><?php echo i18n::formatCredits($metadata['lbc_award']) ?></span></span>
</div> </div>