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
title: Internationalization of LBRY Browser
award: 40000
award: 2000
status: available
date: '2016-07-01'
---

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -139,13 +139,23 @@ class ContentActions extends Actions
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
{
Response::enableHttpCache();
if ($slug)
{
list($metadata, $postHtml) = View::parseMarkdown(ContentActions::VIEW_FOLDER_BOUNTY . '/' . $slug . '.md');
$metadata['lbc_award'] = static::convertBountyAmount($metadata['award']);
if (!$postHtml)
{
return NavActions::execute404();
@ -184,6 +194,11 @@ class ContentActions extends Actions
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', [
'bounties' => $bounties,
'categories' => $allCategories,

View file

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

View file

@ -1,5 +1,5 @@
<div class="clearfix">
<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'] : '' ?>"
><?php echo i18n::formatCredits($metadata['award']) ?></span></span>
><?php echo i18n::formatCredits($metadata['lbc_award']) ?></span></span>
</div>