From ed5aacc277bd81abe427a10080de96d8d6e987c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 28 Jul 2021 22:31:48 +0200 Subject: [PATCH] UI improvements --- newdate.sh | 18 +++++++++++++----- poll.sh | 8 ++++++-- webpoll.css | 28 +++++++++++++++++++++++++++- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/newdate.sh b/newdate.sh index e2902e4..9c5a1e7 100755 --- a/newdate.sh +++ b/newdate.sh @@ -127,9 +127,13 @@ if [ "$REQUEST_METHOD" = POST ]; then | sort -u )" - if [ "$(POST cancel)" = cancel ]; then - rm -- "$file" - REDIRECT "$_BASE/" + if [ "$(POST delete)" = delete ]; then + if [ "$(POST delconfirm)" -o ! "$(DBM "$file" get participants)" ]; then + rm -- "$file" + REDIRECT "$_BASE/" + else + REDIRECT "$_BASE$PATH_INFO${month:+?month=}${month}#ERROR_NEEDCONFIRM" + fi elif [ "$(POST post)" = post ]; then REDIRECT "$_BASE${PATH_INFO%/*}" elif [ "$(POST bookmark)" -a ! "$bookmarks" ]; then @@ -161,8 +165,12 @@ else [hidden "month" "$month"] ] $([ "$splittimes" = "yes" ] && fs_splittimes || fs_timeofday ) - [submit "cancel" "cancel" Cancel] - [submit "post" "post" Post Event] + $(if [ "$(DBM "$file" get participants)" ]; then + printf '[checkbox "delconfirm" "confirm" id="delconfirm"][label for=delconfirm Delete Poll] + [submit "delete" "delete" Delete Poll] [submit "post" "post" Poll page]' + else + printf '[submit "delete" "delete" Cancel] [submit "post" "post" Post Event]' + fi) $(if [ "$bookmarks" ]; then printf '[section .bookmark This admin page is accessible via the link [a href="%s" %s]. You must copy this link and keep it safe, so you can modify this poll later! The poll has also been bookmarked and will be listed on the front page.' \ "$(URL "//$(HEADER Host)/${_BASE}/${id}/${admin}")" \ diff --git a/poll.sh b/poll.sh index 5624284..de5b614 100644 --- a/poll.sh +++ b/poll.sh @@ -88,8 +88,12 @@ table_poll() { if [ "$splittimes" = yes -o "$todall" ]; then printf '[tr .tod [th]' for time in $timelist; do - [ "${time#*_}" = "${time}" ] && time="_${time}" - printf '[th . %s]' "${time#*_}" + case $time in + *-*-*_*:*) time="${time#*_}";; + *-*-*) time="";; + *:*);; # time="${time}" + esac + printf '[th . %s]' "${time}" done printf '[th]]\n' fi diff --git a/webpoll.css b/webpoll.css index 193b2ed..7b1579f 100644 --- a/webpoll.css +++ b/webpoll.css @@ -29,20 +29,26 @@ body section { background-color: rgba(255,255,255,.5); word-wrap: break-word; } -body.poll .description .title { +body.poll .description { margin-top: 0; text-align: left; } body.poll .description .title { + margin-top: 0; text-align: center; } body.poll table { + display: block; + max-width 100%; + overflow-x: auto; + background-color: rgba(255,255,255,.5); border-collapse: collapse; margin: auto; box-shadow: #000 .25em .25em .5em; border-radius: 2pt; } + body.poll table thead tr.dates th { padding: .25em; } @@ -135,6 +141,7 @@ body.newdate form fieldset.splittimes { body.newdate form fieldset.date { padding-right: .75em; } body.newdate form fieldset.timeofday, body.newdate form fieldset.splittimes { padding-left: .75em; } + body.poll table { display: table;} } body.newdate form input[name=title], @@ -220,3 +227,22 @@ body.newdate form fieldset input.splittimes:checked + *:before { content: '\2713 body.newdate form .timeofday button[name=splittimes] { margin-top: 1.5em;} body.newdate form .splittimes p { margin-top: 2em; padding: .5em; background: rgba(255,255,255,.5); } + +body.newdate form #delconfirm { + margin-left: -6em; +} +body.newdate form #delconfirm + label:after { + content: '\0A'; + white-space: pre; +} +body.newdate form #delconfirm + label + button { + pointer-events: none; + color: #AAA; + border-color: #AAA; +} +body.newdate form #delconfirm:checked + label + button { + pointer-events: auto; + color: inherit; + border-color: inherit; + background-color: #FDD; +} -- 2.39.2