mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
bounties begin
This commit is contained in:
parent
76a7a1cd50
commit
273816ce78
19 changed files with 254 additions and 18 deletions
|
@ -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, []];
|
||||
|
|
47
controller/action/BountyActions.class.php
Normal file
47
controller/action/BountyActions.class.php
Normal 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
|
||||
]];
|
||||
}
|
||||
}
|
|
@ -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()];
|
||||
|
|
|
@ -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;
|
||||
|
|
8
posts/bounty/android-app.md
Normal file
8
posts/bounty/android-app.md
Normal 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
8
posts/bounty/ios-app.md
Normal 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.
|
8
posts/bounty/refer-publisher.md
Normal file
8
posts/bounty/refer-publisher.md
Normal 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.
|
9
posts/bounty/wallet-ui.md
Normal file
9
posts/bounty/wallet-ui.md
Normal 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.
|
10
posts/bounty/windows-build.md
Normal file
10
posts/bounty/windows-build.md
Normal 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.
|
67
view/template/bounty/list.php
Normal file
67
view/template/bounty/list.php
Normal 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') ?>
|
16
view/template/bounty/show.php
Normal file
16
view/template/bounty/show.php
Normal 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]) ?>
|
|
@ -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() ?>
|
||||
|
|
|
@ -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
21
web/scss/_badge.scss
Normal 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
15
web/scss/_bounty.scss
Normal file
|
@ -0,0 +1,15 @@
|
|||
.bounty-tile
|
||||
{
|
||||
display: block;
|
||||
margin: 0 10px $spacing-vertical;
|
||||
padding: 10px;
|
||||
background: #eee;
|
||||
&:hover
|
||||
{
|
||||
cursor: pointer;
|
||||
}
|
||||
.icon-mega
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
Loading…
Add table
Reference in a new issue