From: Paul Hänsch Date: Mon, 4 Feb 2019 17:11:28 +0000 (+0100) Subject: reenabled filter dialog X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=516b1d6b0427b42924a60bd63ed48d8087a9e4e8;p=confetti reenabled filter dialog --- diff --git a/cards/cards.css b/cards/cards.css index 981a667..9515e83 100644 --- a/cards/cards.css +++ b/cards/cards.css @@ -39,7 +39,8 @@ } .filter input[type="text"] { width: 100%; - margin-bottom: .5em; + height: 2em; + margin-bottom: 1em; } .filter fieldset { position: relative; @@ -84,11 +85,11 @@ border: 1px solid #000; border-bottom-color: #FFF; } -.filter fieldset.item input[type=radio][value="CATEGORIES:"]:checked + label + input[type=text], -.filter fieldset.item input[type=radio][value="CATEGORIES:"] + label + input[type=text] + fieldset.categories { +.filter fieldset.item input[type=radio][value="CATEGORIES"]:checked + label + input[type=text], +.filter fieldset.item input[type=radio][value="CATEGORIES"] + label + input[type=text] + fieldset.categories { display: none; } -.filter fieldset.item input[type=radio][value="CATEGORIES:"]:checked + label + input[type=text] + fieldset.categories { +.filter fieldset.item input[type=radio][value="CATEGORIES"]:checked + label + input[type=text] + fieldset.categories { display: block; } .filter fieldset.item fieldset.categories a { diff --git a/cards/filter_card.sh b/cards/filter_card.sh index d09adab..9c79459 100755 --- a/cards/filter_card.sh +++ b/cards/filter_card.sh @@ -20,7 +20,17 @@ if [ "$(POST choice)" = new_filter ]; then filter="$( seq 0 100 |while read n; do - printf %s "$(POST filter$n)" + filter_type="$(POST "filter_type${n}")" + filter_text="$(POST "filter_text${n}")" + [ ! "$filter_type" -a ! "$filter_text" ] && break + if [ "$filter_type" = CATEGORIES ]; then + printf '^CATEGORIES:' + seq 0 $(POST_COUNT filter_cat$n) |while read m; do + printf '|%s' "$(POST filter_cat$n $m)" + done + else + printf '^%s:%s' "$filter_type" "$filter_text" + fi done | sed -r \ 's;\|+;\|;g; s;\^+;\^;g; s;:\|;:;g; :X; s;\^[^:]*:\^;\^;g; /\^[^:]*:\^/bX; diff --git a/cards/main.cgi b/cards/main.cgi index 6cdc8f2..bfc574f 100755 --- a/cards/main.cgi +++ b/cards/main.cgi @@ -19,7 +19,7 @@ order="$(GET order)" printf 'Content-Type: text/html; charset=utf-8\r\n\r\n' $_EXEC/cgilite/html-sh.sed <. +list_categories() { + grep -vxE '^[ ]*$' "${_DATA}/mappings/categories" +} + w_filter_item() { +n=$3 cat <