]> git.plutz.net Git - lobster/commitdiff
display "new therapy" button only when no therapies exist
authorPaul Hänsch <paul@plutz.net>
Mon, 7 Sep 2020 01:35:39 +0000 (03:35 +0200)
committerPaul Hänsch <paul@plutz.net>
Mon, 7 Sep 2020 01:35:39 +0000 (03:35 +0200)
cards/list.sh
cards/widgets.sh

index 33ca99110ebdb4cf37ee81e9d42f00b816f3d146..12b4a9ebe28e0b8f936a33bbe2731255b49c8b86 100755 (executable)
@@ -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
index b0d188cabb06b90c9bc77ae0ca5d436480836e03..8be5cdec305c2f20679d34414f0c98135cc0b607 100755 (executable)
@@ -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')"