From 83d06439281015a5dd54f0325d28b8e9fb769c76 Mon Sep 17 00:00:00 2001 From: aymm Date: Sun, 18 Apr 2021 18:41:09 +0200 Subject: [PATCH] Fixed #3 --- composer.json | 2 +- index.php | 60 ++++++++++++++++++++++++++++++++++++++++++++---- styles/style.css | 20 ++++++++++++++++ 3 files changed, 77 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 600284a..90f4e6e 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "hutattedonmyarm/dragonpolls", - "version": "0.9.3", + "version": "1.1.0-beta", "description": "A polling client for pnut.io", "require": { "hutattedonmyarm/apnuti": "@dev" diff --git a/index.php b/index.php index 03130b3..1a62c75 100644 --- a/index.php +++ b/index.php @@ -2,6 +2,14 @@ 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 if (isset($_GET['poll'])) { redirect('view_poll.php?id='.$_GET['poll']); @@ -9,8 +17,7 @@ if (isset($_GET['poll'])) { echo get_page_header(); ?>

- Welcome to the new Dragonpolls! In the future - you will find a stream of polls here, right now it's fairly empty! + Welcome to the new Dragonpolls!
You can create a new poll, look at my roadmap @@ -18,9 +25,13 @@ echo get_page_header(); or make a feature request.

- Once all planned features for version 1.0.0 are done, and the 0.9.0 bugs are squashed, + 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 - https://wedro.online/dragonpolls.
+ https://wedro.online/dragonpolls
.
+ Version 1.0.0 is done, and if the next Thememonday goes well, + it will be installed over at https://wedro.online/dragonpolls. + Considering, that 1.1.0 is done as well. I will just go ahead and release 1.1.0! +
You may see that this uses a slightly different url format, polls are at view_poll.php?id=XXX instead of index.php?poll=YYY. 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. @@ -30,5 +41,46 @@ echo get_page_header(); https://wedro.online/dragonpolls, and update the productive installation with each milestone!

+
+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; + ?> +
+
+
+ +
+ ' ?> + +
+
+
+ Created + isClosed() ? 'Closed' : 'Closing' ?> + + +
+
+ + prompt ?>
+
+
+ View poll +
+ +
diff --git a/styles/style.css b/styles/style.css index c832191..71efa27 100644 --- a/styles/style.css +++ b/styles/style.css @@ -276,6 +276,26 @@ footer .sourcecode svg { 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 */ form.polltoken-input {