This commit is contained in:
aymm 2021-04-18 18:41:09 +02:00
parent dc0d19a587
commit 83d0643928
Signed by: phlaym
GPG Key ID: A06651BAB6777237
3 changed files with 77 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "hutattedonmyarm/dragonpolls", "name": "hutattedonmyarm/dragonpolls",
"version": "0.9.3", "version": "1.1.0-beta",
"description": "A polling client for pnut.io", "description": "A polling client for pnut.io",
"require": { "require": {
"hutattedonmyarm/apnuti": "@dev" "hutattedonmyarm/apnuti": "@dev"

View File

@ -2,6 +2,14 @@
require_once __DIR__ .'/bootstrap.php'; require_once __DIR__ .'/bootstrap.php';
use APnutI\Exceptions\NotFoundException;
use APnutI\Exceptions\HttpPnutForbiddenException;
use APnutI\Exceptions\NotSupportedPollException;
use APnutI\Exceptions\NotAuthorizedException;
use APnutI\Exceptions\PollAccessRestrictedException;
use APnutI\Entities\Poll;
use APnutI\Entities\User;
// Support the old Dragonpolls links // Support the old Dragonpolls links
if (isset($_GET['poll'])) { if (isset($_GET['poll'])) {
redirect('view_poll.php?id='.$_GET['poll']); redirect('view_poll.php?id='.$_GET['poll']);
@ -9,8 +17,7 @@ if (isset($_GET['poll'])) {
echo get_page_header(); echo get_page_header();
?> ?>
<p> <p>
Welcome to the new Dragonpolls! In <a href="https://github.com/hutattedonmyarm/Dragonpolls/milestone/3">the future</a> Welcome to the new Dragonpolls!<br>
you will find a stream of polls here, right now it's fairly empty!
You can <a href="new_poll.php">create a new poll</a>, look at You can <a href="new_poll.php">create a new poll</a>, look at
<a href="https://github.com/hutattedonmyarm/Dragonpolls/milestones?direction=asc&sort=title&state=open"> <a href="https://github.com/hutattedonmyarm/Dragonpolls/milestones?direction=asc&sort=title&state=open">
my roadmap my roadmap
@ -18,9 +25,13 @@ echo get_page_header();
or <a href="https://github.com/hutattedonmyarm/Dragonpolls/issues/new/choose">make a feature request</a>. or <a href="https://github.com/hutattedonmyarm/Dragonpolls/issues/new/choose">make a feature request</a>.
</p> </p>
<p> <p>
Once all planned features for version 1.0.0 are done, and the 0.9.0 bugs are squashed, <strike>Once all planned features for version 1.0.0 are done, and the 0.9.0 bugs are squashed,
I will replace the current version over at I will replace the current version over at
<a href="https://wedro.online/dragonpolls">https://wedro.online/dragonpolls</a>.<br> <a href="https://wedro.online/dragonpolls">https://wedro.online/dragonpolls</a></strike>.<br>
Version 1.0.0 is done, and if the next Thememonday goes well,
it will be installed over at <a href="https://wedro.online/dragonpolls">https://wedro.online/dragonpolls</a>.
Considering, that 1.1.0 is done as well. I will just go ahead and release 1.1.0!
<br/>
You may see that this uses a slightly different url format, polls are at <em>view_poll.php?id=XXX</em> You may see that this uses a slightly different url format, polls are at <em>view_poll.php?id=XXX</em>
instead of <em>index.php?poll=YYY</em>. The old links will continue to work of course, however I encourage everyone instead of <em>index.php?poll=YYY</em>. The old links will continue to work of course, however I encourage everyone
to share the new style once this is has replaced the previous incarnation. to share the new style once this is has replaced the previous incarnation.
@ -30,5 +41,46 @@ echo get_page_header();
<a href="https://wedro.online/dragonpolls">https://wedro.online/dragonpolls</a>, <a href="https://wedro.online/dragonpolls">https://wedro.online/dragonpolls</a>,
and update the productive installation with each milestone! and update the productive installation with each milestone!
</p> </p>
<div class="poll-grid">
<?php
$polls = $api->getPolls();
foreach ($polls as $poll) {
$user_avatar_url = $poll->user->getAvatarUrl(50);
$user_avatar_url_srcset = get_source_set($poll->user, 50);
$username = '@' . $poll->user->username;
$disabled = $poll->canVote() ? '' : 'disabled';
$user_name = $poll->user->name ?? '';
$created_at = $poll->created_at;
$closed_at = $poll->closed_at;
?>
<div class="poll" onclick="location.href='view_poll.php?id=<?= $poll->id ?>'">
<div class="header">
<div class="user">
<img src="<?= $user_avatar_url ?>" class="avatar" srcset="<?= $user_avatar_url_srcset ?>"/>
<div class="usernames">
<b><?= $user_name.'<br>' ?></b>
<span class="username"><?= $username ?></span>
</div>
<div class="spacer"></div>
<div class="datewrapper">
<span class="created_at">Created</span>
<span class="closed_at"><?= $poll->isClosed() ? 'Closed' : 'Closing' ?></span>
<time class="created_at" datetime="<?= $created_at->format(\DateTime::ISO8601) ?>">
<?= $created_at->format('Y-m-d, H:i:s e') ?>
</time>
<time class="closed_at" datetime="<?= $closed_at->format(\DateTime::ISO8601) ?>">
<?= $closed_at->format('Y-m-d, H:i:s e') ?>
</time>
</div>
</div>
<span class="prompt">
<em><?= $poll->prompt ?></em><br>
</span>
</div>
<a href="view_poll.php?id=<?= $poll->id ?>">View poll</a>
</div>
<?php } ?>
</div>
<?= get_page_footer() ?> <?= get_page_footer() ?>

View File

@ -276,6 +276,26 @@ footer .sourcecode svg {
stroke-width: 1.5em; stroke-width: 1.5em;
} }
/* Poll grid */
.poll-grid {
display: flex;
flex-wrap: wrap;
}
.poll-grid .poll {
display: initial;
padding: 8px;
border: 2px solid var(--main-accent-color);
margin: 8px;
transition: all 0.2s;
cursor: pointer;
}
.poll-grid .poll:hover {
box-shadow: 4px 6px 3px 0 var(--secondary-bg-color);
transform: translate(-2px, -2px);
}
/* Other */ /* Other */
form.polltoken-input { form.polltoken-input {