Skip to content

Commit 4444739

Browse files
committed
Prepare v0.1.0
1 parent f556fe8 commit 4444739

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

src/FaqOff/Endpoints/StaticPage.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ResponseInterface
99
};
1010
use Soatok\AnthroKit\Endpoint;
11+
use Soatok\FaqOff\Splices\Authors;
1112
use Twig\Error\{
1213
LoaderError,
1314
RuntimeError,
@@ -31,7 +32,11 @@ class StaticPage extends Endpoint
3132
*/
3233
protected function index(RequestInterface $request): ResponseInterface
3334
{
34-
return $this->view('index.twig');
35+
/** @var Authors $authors */
36+
$authors = $this->splice('Authors');
37+
return $this->view('index.twig', [
38+
'authors' => $authors->listAllScreenNames()
39+
]);
3540
}
3641

3742
/**

src/FaqOff/Splices/Authors.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@ public function revokeAccess(int $authorId, int $accountId): bool
193193
return $this->db->commit();
194194
}
195195

196+
/**
197+
* @return array
198+
*/
199+
public function listAllScreenNames(): array
200+
{
201+
return $this->db->col(
202+
"SELECT screenname FROM faqoff_author ORDER BY screenname ASC"
203+
);
204+
}
205+
196206
/**
197207
* @param string $screenName
198208
* @return bool

src/FaqOff/Splices/Entry.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ public function getByCollectionAndUrl(int $collectionId, string $url): array
228228
}
229229
return $entry;
230230
}
231+
231232
/**
232233
* @param int $collectionId
233234
* @return array

templates/index.twig

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{% extends "base.twig" %}
22

33
{% block main %}
4-
<h1>Hello, world!</h1>
4+
<h1>FAQ Off</h1>
5+
<p>
6+
Telling sealions and mob harassers to "Go FAQ yourselves" since 2019!
7+
</p>
8+
9+
<h2>Authors on this FAQ Off Instance</h2>
10+
<ul>
11+
{% for author in authors %}
12+
<li>
13+
<a href="/@{{ author|e('url') }}">{{ author|e('html') }}</a>
14+
</li>
15+
{% endfor %}
16+
</ul>
517
{% endblock %}

0 commit comments

Comments
 (0)