From e02d0ff1d16d508b9d8091e313cf8eecf77a8d35 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Mon, 7 Sep 2020 03:35:39 +0200 Subject: [PATCH] display "new therapy" button only when no therapies exist --- cards/list.sh | 2 -- cards/widgets.sh | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cards/list.sh b/cards/list.sh index 33ca991..12b4a9e 100755 --- a/cards/list.sh +++ b/cards/list.sh @@ -77,8 +77,6 @@ print_cards(){ while read cardfile; do cachefile="${_DATA}/cache/${cardfile##*/}.cache" - # if [ -s "$cachefile" -a "$cachefile" -nt "$cardfile" \ - # -a "$cachefile" -nt "${_EXEC}/cards" ]; then if [ -s "$cachefile" -a "$cachefile" -nt "$cardfile" ]; then cat "$cachefile" else diff --git a/cards/widgets.sh b/cards/widgets.sh index b0d188c..8be5cde 100755 --- a/cards/widgets.sh +++ b/cards/widgets.sh @@ -137,7 +137,9 @@ card_item(){ printf '[h3 %s]' "$(l10n therapies)" (cd "$_DATA/therapies/"; printf '%s\n' "${client}".*.tpy) \ | while read tpyfile; do - [ "$tpyfile" = "${client}.*.tpy" ] && break + [ "$tpyfile" = "${client}.*.tpy" ] \ + && printf '[a .item .therapy href="/therapies/%s/new" . +]' "${client}" \ + && break tpy="${tpyfile%.tpy}"; tpydates="$(sed -En 's;^session[0-9]+_date:;;p;' "$_DATA/therapies/$tpyfile" \ | sort \ @@ -146,7 +148,6 @@ card_item(){ printf '[a .item .therapy href="/therapies/%s" . %s] ' \ "${tpy%.*}/${tpy#*.}" "$(HTML "${tpydates:--}")" done |sort -n - printf '[a .item .therapy href="/therapies/%s/new" . +]' "${client}" ;; *)[ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n "$item")" shy="$(printf '\302\255')" -- 2.39.2