Skip to content

Commit

Permalink
Prepare v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
soatok committed Jul 4, 2019
1 parent f556fe8 commit 4444739
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/FaqOff/Endpoints/StaticPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ResponseInterface
};
use Soatok\AnthroKit\Endpoint;
use Soatok\FaqOff\Splices\Authors;
use Twig\Error\{
LoaderError,
RuntimeError,
Expand All @@ -31,7 +32,11 @@ class StaticPage extends Endpoint
*/
protected function index(RequestInterface $request): ResponseInterface
{
return $this->view('index.twig');
/** @var Authors $authors */
$authors = $this->splice('Authors');
return $this->view('index.twig', [
'authors' => $authors->listAllScreenNames()
]);
}

/**
Expand Down
10 changes: 10 additions & 0 deletions src/FaqOff/Splices/Authors.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ public function revokeAccess(int $authorId, int $accountId): bool
return $this->db->commit();
}

/**
* @return array
*/
public function listAllScreenNames(): array
{
return $this->db->col(
"SELECT screenname FROM faqoff_author ORDER BY screenname ASC"
);
}

/**
* @param string $screenName
* @return bool
Expand Down
1 change: 1 addition & 0 deletions src/FaqOff/Splices/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ public function getByCollectionAndUrl(int $collectionId, string $url): array
}
return $entry;
}

/**
* @param int $collectionId
* @return array
Expand Down
14 changes: 13 additions & 1 deletion templates/index.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{% extends "base.twig" %}

{% block main %}
<h1>Hello, world!</h1>
<h1>FAQ Off</h1>
<p>
Telling sealions and mob harassers to "Go FAQ yourselves" since 2019!
</p>

<h2>Authors on this FAQ Off Instance</h2>
<ul>
{% for author in authors %}
<li>
<a href="/@{{ author|e('url') }}">{{ author|e('html') }}</a>
</li>
{% endfor %}
</ul>
{% endblock %}

0 comments on commit 4444739

Please sign in to comment.