bounties begin

This commit is contained in:
Jeremy Kauffman 2016-07-25 17:28:06 -04:00
parent 76a7a1cd50
commit 273816ce78
19 changed files with 254 additions and 18 deletions

View file

@ -98,7 +98,13 @@ class Controller
$slug = preg_replace($faqPattern, '', $uri);
return $slug ? ContentActions::executeFaqPost($uri) : ContentActions::executeFaq();
}
$noSlashUri = ltrim($uri, '/');
$bountyPattern = '#^' . BountyActions::URL_BOUNTY_LIST . '(/|$)#';
if (preg_match($bountyPattern, $uri))
{
$slug = preg_replace($bountyPattern, '', $uri);
return $slug ? BountyActions::executeShow($uri) : BountyActions::executeList($uri);
}
$accessPattern = '#^/signup#';
if (preg_match($accessPattern, $uri))
@ -106,6 +112,8 @@ class Controller
return DownloadActions::executeSignup();
}
$noSlashUri = ltrim($uri, '/');
if (View::exists('page/' . $noSlashUri))
{
return ['page/' . $noSlashUri, []];

View file

@ -0,0 +1,47 @@
<?php
class BountyActions extends Actions
{
const URL_BOUNTY_LIST = '/bounty';
public static function executeList()
{
$posts = Post::find(ROOT_DIR . '/posts/bounty');
$allCategories = array_unique(array_map(function($post) {
$metadata = $post->getMetadata();
return isset($metadata['category']) ? $metadata['category'] : null;
}, $posts));
uasort($posts, function($postA, $postB) {
$metadataA = $postA->getMetadata();
$metadataB = $postB->getMetadata();
if ($metadataA['award'] != $metadataB['award'])
{
return $metadataA['award'] > $metadataB['award'] ? -1 : 1;
}
return $metadataA['title'] < $metadataB['title'] ? -1 : 1;
});
$completeStatuses = ['any', 'incomplete', 'complete'];
return ['bounty/list', [
'posts' => $posts,
'categories' => $allCategories,
'completeStatuses' => $completeStatuses
]];
}
public static function executeShow($relativeUri)
{
list($metadata, $postHtml) = View::parseMarkdown(ROOT_DIR . '/posts/' . $relativeUri . '.md');
if (!$postHtml)
{
return ['page/404', []];
}
return ['bounty/show', [
'postHtml' => $postHtml,
'metadata' => $metadata
]];
}
}

View file

@ -19,6 +19,14 @@ class NavActions extends Actions
return static::$navUri ?: $_SERVER['REQUEST_URI'];
}
public static function prepareFooterPartial(array $vars)
{
return $vars + [
'isDark' => false,
'showLearnFooter' => false
];
}
public static function prepareGlobalItemsPartial(array $vars)
{
$vars += ['selectedItem' => static::getNavUri()];

View file

@ -5,7 +5,7 @@ class Post
const SORT_DATE_DESC = 'sort_date_desc';
protected static $slugMap = [];
protected $slug, $title, $author, $date, $markdown, $contentText, $contentHtml, $cover, $postType, $category;
protected $slug, $title, $metadata, $author, $date, $markdown, $contentText, $contentHtml, $cover, $postType, $category;
protected $isCoverLight = false;
public static function load($relativeOrAbsolutePath)
@ -45,6 +45,7 @@ class Post
$this->postType = $postType;
$this->slug = $slug;
$this->markdown = $markdown;
$this->metadata = $frontMatter;
$this->title = isset($frontMatter['title']) ? $frontMatter['title'] : null;
$this->author = isset($frontMatter['author']) ? $frontMatter['author'] : null;
$this->date = isset($frontMatter['date']) ? new DateTime($frontMatter['date']) : null;
@ -74,6 +75,11 @@ class Post
return $posts;
}
public function getMetadata()
{
return $this->metadata;
}
public function getRelativeUrl()
{
return $this->postType . '/' . $this->slug;

View file

@ -0,0 +1,8 @@
---
category: android
title: Mirror existing LBRY behavior in Android
award: 10000
date: '2016-07-01'
---
Domo arigato, Rami Malek.

8
posts/bounty/ios-app.md Normal file
View file

@ -0,0 +1,8 @@
---
category: ios
title: Mirror existing LBRY behavior in iOS
award: 10000
date: '2016-07-01'
---
An Apple a day keeps the FBI away.

View file

@ -0,0 +1,8 @@
---
category: human
title: Refer a Publisher to LBRY
award: 100
date: '2016-07-01'
---
Create a build for Windows that is reproducible in Travis CI. This involves blah, blah, and blah.

View file

@ -0,0 +1,9 @@
---
category: browser
title: Add Wallet Interface to LBRY Browser
award: 1000
complete: true
date: '2016-07-01'
---
Wallet wallet wallet, wallet wallet.

View file

@ -0,0 +1,10 @@
---
category: ci
title: Build LBRY for Windows
award: 1000
date: '2016-07-01'
---
Contact your favorite YouTuber or other online publisher and let them know about [LBRY's publishing partnerships](http://lbry.io/publish).
If you notify someone that is accepted, you'll earn a referral bonus.

View file

@ -0,0 +1,67 @@
<?php Response::setMetaDescription('See upcoming LBRY projects and earn bounties for completing or assisting.') ?>
<?php NavActions::setNavUri('/learn') ?>
<?php echo View::render('nav/_header', ['isDark' => false]) ?>
<main>
<div class="hero hero-quote hero-img spacer2" style="background-image: url(/img/fireworks.png)">
<div class="hero-content-wrapper">
<div class="hero-content text-center">
<h1 class="cover-title">LBRY Bounties</h1>
<h2 class="cover-subtitle">Earn money for building a better internet.</h2>
</div>
</div>
</div>
<section class="content content-light">
<h3>Bounties</h3>
<form method="get" action="/bounty" id="bounty-filter-form">
<div class="clearfix">
<div class="form-row align-left" style="margin-right: 10px">
<label>Category</label>
<select name="category">
<?php foreach($categories as $category): ?>
<option value="<?php echo $category ?>"><?php echo $category ?></option>
<?php endforeach ?>
</select>
</div>
<div class="form-row align-left">
<label>Completed</label>
<select name="category">
<?php foreach($completeStatuses as $status): ?>
<option value="<?php echo $status ?>"><?php echo $status ?></option>
<?php endforeach ?>
</select>
</div>
</div>
</form>
<?php js_start() ?>
$('#bounty-filter-form').change(function() $(this).submit(); });
<?php js_end() ?>
</section>
<section class="content content-light">
<div class="tile-fluid clearfix spacer2">
<?php foreach($posts as $post): ?>
<div class="span4">
<a class="bounty-tile" href="<?php echo $post->getRelativeUrl() ?>">
<div class="text-center spacer-half"><span class="icon-mega
<?php $metadata = $post->getMetadata() ?>
<?php switch($metadata['category']) {
case 'ci': echo 'icon-wrench'; break;
case 'android': echo 'icon-android'; break;
case 'ios': echo 'icon-apple'; break;
case 'browser': echo 'icon-globe'; break;
case 'cif': echo 'icon-wrench'; break;
case 'cig': echo 'icon-wrench'; break;
default: echo 'icon-dollar'; break;
} ?>
"></span></div>
<h3 class="link-primary"><?php echo $post->getTitle() ?></h3>
<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 i18n::formatCredits($metadata['award']) ?></span></span>
</div>
</a>
</div>
<?php endforeach ?>
</div>
</section>
</main>
<?php echo View::render('nav/_footer') ?>

View file

@ -0,0 +1,16 @@
<?php Response::setMetaDescription($metadata['title']) ?>
<?php NavActions::setNavUri('/learn') ?>
<?php echo View::render('nav/_header') ?>
<main>
<section class="post-content">
<div class="content">
<div class="meta">
<br/>
<a href="/bounty">« Back to All Bounties</a>
</div>
<h1><?php echo htmlentities($metadata['title']) ?></h1>
<?php echo $postHtml ?>
</div>
</section>
</main>
<?php echo View::render('nav/_footer', ['showLearnFooter' => true]) ?>

View file

@ -7,7 +7,7 @@
<div class="content">
<br />
<div class="meta">
<a href="/faq"><< Back to FAQ</a>
<a href="/faq">« Back to FAQ</a>
</div>
<h1><?php echo htmlentities($post->getTitle()) ?></h1>
<?php echo $post->getContentHtml() ?>

View file

@ -1,7 +1,10 @@
<?php if (!defined('FOOTER_RENDERED')): ?>
<?php define('FOOTER_RENDERED', true) ?>
<div class="footer">
<div class="content">
<?php if ($showLearnFooter): ?>
<?php echo View::render('nav/_learnFooter', ['isDark' => $isDark]) ?>
<?php endif ?>
<div class="content footer-standard">
<nav class="control-group">
<div class="control-item">
<a href="/"><?php echo __('Home') ?></a>

21
web/scss/_badge.scss Normal file
View file

@ -0,0 +1,21 @@
@import "global";
$badge-height: $spacing-vertical * 3/4;
.badge
{
display: inline-block;
padding: 0 4px;
font-size: $badge-height * 0.7;
line-height: $badge-height;
font-weight: bold;
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
white-space: nowrap;
@include border-radius(3px);
background-color: #999999;
&.badge-primary
{
background-color: $color-primary;
}
}

15
web/scss/_bounty.scss Normal file
View file

@ -0,0 +1,15 @@
.bounty-tile
{
display: block;
margin: 0 10px $spacing-vertical;
padding: 10px;
background: #eee;
&:hover
{
cursor: pointer;
}
.icon-mega
{
}
}

View file

@ -145,9 +145,9 @@ $font-body: 'Raleway', sans-serif;
@mixin jumpingScrollbarFix() {
/*
// Fix for jumping scrollbar: https://aykevl.nl/2014/09/fix-jumping-scrollbar
@media screen and (min-width: 35em) {
margin-left: calc(100vw - 100%);
margin-right: 0;
//@media screen and (min-width: 35em) {
// margin-left: calc(100vw - 100%);
// margin-right: 0;
}
*/
}

View file

@ -51,7 +51,7 @@ $color-nav-border: #ddd;
float: left;
img { height: $spacing-vertical * 2; }
}
.header-navigation-mobile, .header-navigation-fullscreen, .footer
.header-navigation-mobile, .header-navigation-fullscreen, .footer-standard
{
a
{
@ -76,15 +76,15 @@ $color-nav-border: #ddd;
.header-dark.header-open
{
background: rgba(0,0,0,0.7);
border-bottom: 1px solid rgba(128,128,128,0.7);
border-bottom: 1px solid rgba(128,128,128,0.7);
}
.header-light.header-open
{
background: rgba(255,255,255,0.7);
}
}
.header-navigation-fullscreen
{
clear: both;
clear: both;
padding-left: 5px;
padding-right: 5px;
padding-top: $spacing-vertical / 2; /*margin would be better here but floats*/
@ -114,7 +114,7 @@ $color-nav-border: #ddd;
}
}
.footer
.footer-standard
{
text-align: center;
font-size: 0.8em;

View file

@ -7,16 +7,16 @@ input:focus, textarea:focus
{
outline: 0;
}
table
table
{
border-collapse: collapse;
border-spacing:0;
}
fieldset, img, iframe
fieldset, img, iframe
{
border: 0;
}
h1, h2, h3, h4, h5, h6
h1, h2, h3, h4, h5, h6
{
font-weight: inherit;
}
@ -25,7 +25,7 @@ ol, ul
list-style-position: inside;
> li { list-style-position: inside; }
}
input, textarea, select
input, textarea, select
{
font-family:inherit;
font-size:inherit;
@ -42,7 +42,7 @@ a
color: inherit;
text-decoration: none;
}
input, a, button, select
input, a, button
{
-webkit-appearance: none;
border-radius: 0;

View file

@ -3,6 +3,7 @@
@import "grid";
@import "icons";
@import "notice";
@import "badge";
@import "basic";
@import "form";
@import "content";
@ -11,4 +12,5 @@
@import "header";
@import "sale";
@import "code";
@import "blog";
@import "blog";
@import "bounty";