From: Paul Hänsch Date: Mon, 7 Sep 2020 01:35:39 +0000 (+0200) Subject: display "new therapy" button only when no therapies exist X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=e02d0ff1d16d508b9d8091e313cf8eecf77a8d35;p=lobster display "new therapy" button only when no therapies exist --- 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')"