From: Paul Hänsch Date: Mon, 5 Aug 2019 18:14:38 +0000 (+0200) Subject: display delete buttons for fields (not functional yet) X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=56ff6e8a97ae261fca8e293a6c82fad7a69c89b6;p=confetti display delete buttons for fields (not functional yet) --- diff --git a/cards/cards.css b/cards/cards.css index 7d4593c..9adbeca 100644 --- a/cards/cards.css +++ b/cards/cards.css @@ -17,6 +17,8 @@ # along with Confetti. If not, see . */ +.filter, .newcard, .card { box-shadow: 0 0 1ex; } + .filter { display: block; border: solid 1px; @@ -132,19 +134,19 @@ .card .control .item { display: inline-block; width: 100%; - min-height: 2.5em; + height: 2.5em; + line-height: 2.5em; + margin: .25em 0; + padding: 0 .5em; + font-size: .75em; color: #008; - margin: .25em 0 .5em 0; - border: 1px solid black; background: #FFF; - padding: .25em .75ex 0 .75ex; text-decoration: none; - font-size: .75em; + border: 1px solid #888; + box-shadow: 0 0 .5ex #888; } -.card .control .item:hover{ border-color: #888; } -.card .control input.item { font-size: normal; } .card .control button.item { text-align: right;} -.card .control button.item:hover{ border-color: #888;} +.card .control .item:hover{ border-color: #008; box-shadow: 0 0 .5ex #008; } .card .control .item[name=newfield] { width: calc(100% - 2.5em); @@ -250,6 +252,48 @@ .card .section.prescriptions { width: 40ex;} +form.card input.delete { display: none; } +form.card input.delete + label { + display: inline-block; + position: relative; + font-size: .875em; + left: calc(100% - 1.5em); + width: 1.5em; + margin-bottom: -1.5em; + overflow: hidden; + white-space: nowrap; + vertical-align: bottom; +} +form.card input.delete + label:before { + display: inline-block; + content: 'x'; + width: calc(1.5em - 2px); height: calc(1.5em - 2px); + vertical-align: bottom; + text-align: center; + color: #444; + background-color: #FBB; + border: 1px solid #BBB; +} +form.card input.delete + label + input[type=text], +form.card input.delete + label + input:not([type]), +form.card input.delete + label + select + input.TEL { + width: calc(100% - 1.5em); +} +form.card input.delete[name^=TEL_] + label { top: 1.5em; } +form.card input.delete[name^=TEL_] + label:before { border-top: none; } +form.card input.delete[name^=NOTE_] + label, +form.card input.delete[name^=ADR_] + label { margin-bottom: 0; } +form.card input.delete[name^=NOTE_] + label:before, +form.card input.delete[name^=ADR_] + label:before { border-bottom: none; } + +form.card input.delete:checked + label, +form.card input.delete:checked + label + input, +form.card input.delete:checked + label + select, +form.card input.delete:checked + label + select + input, +form.card input.delete:checked + label + textarea { + display: none +} + form.card .section input[type=text], form.card .section input:not([type]), form.card .section textarea, diff --git a/cards/list.sh b/cards/list.sh index ab2be50..0ef5eba 100755 --- a/cards/list.sh +++ b/cards/list.sh @@ -29,53 +29,46 @@ card_item(){ "$(pdi_value "$card" "$item" |HTML)" fi ;; - BDAY) if [ $cnt -gt 0 ]; then - printf '[span .item .BDAY [b *:] %s]' \ - "$(pdi_value "$card" BDAY |grep -xE '[0-9-]+')" - fi + BDAY) + [ $cnt -gt 0 ] && printf '[span .item .BDAY [b *:] %s]' \ + "$(pdi_value "$card" BDAY |grep -xE '[0-9-]+')" ;; - SOUND) if [ $cnt -gt 0 ]; then - printf '[audio .item .SOUND controls="controls" - [source type="audio/ogg" src="data:audio/ogg;base64,%s"] - ]' \ - "$(pdi_value "$card" SOUND |grep -xE '[a-zA-Z0-9/+=]+')" - fi + SOUND) + [ $cnt -gt 0 ] && printf '[audio .item .SOUND controls="controls" + [source type="audio/ogg" src="data:audio/ogg;base64,%s"] + ]' \ + "$(pdi_value "$card" SOUND |grep -xE '[a-zA-Z0-9/+=]+')" ;; - PHOTO|LOGO) if [ $cnt -gt 0 ]; then - printf '[img .item .%s src="data:image/%s;base64,%s"]' "$item" \ - "$(pdi_attrib "$card" "$item" |sed -E 's;^(.*;)?TYPE="?(.+)"?(;.*)?$;\2;')" \ - "$(pdi_value "$card" "$item" |grep -xE '[a-zA-Z0-9/+=]+')" - fi + PHOTO|LOGO) + [ $cnt -gt 0 ] && printf '[img .item .%s src="data:image/%s;base64,%s"]' "$item" \ + "$(pdi_attrib "$card" "$item" |sed -E 's;^(.*;)?TYPE="?(.+)"?(;.*)?$;\2;')" \ + "$(pdi_value "$card" "$item" |grep -xE '[a-zA-Z0-9/+=]+')" ;; - EMAIL) if [ $cnt -gt 0 ]; then - printf '[h3 %s]' "$(l10n EMAIL)" - seq 1 $cnt |while read c; do - printf '[a .item .EMAIL href="mailto:%s" ­%s]' \ - "$(pdi_value "$card" EMAIL $c |unescape |HTML)" \ - "$(pdi_value "$card" EMAIL $c |unescape |HTML)" - done - fi + EMAIL) + [ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n EMAIL)" + seq 1 $cnt |while read c; do + printf '[a .item .EMAIL href="mailto:%s" ­%s]' \ + "$(pdi_value "$card" EMAIL $c |unescape |HTML)" \ + "$(pdi_value "$card" EMAIL $c |unescape |HTML)" + done ;; - TEL) if [ $cnt -gt 0 ]; then - printf '[h3 %s]' "$(l10n TEL)" - seq 1 $cnt |while read c; do - teltype="$(pdi_attrib "$card" TEL $c TYPE)" - [ "$teltype" ] \ - && printf '[span .item .TEL [span .type ­%s:] %s]' \ - "$(l10n "TYPE=$teltype" |HTML)" \ - "$(pdi_value "$card" TEL $c |unescape |HTML)" \ - || printf '[span .item .TEL ­%s]' \ - "$(pdi_value "$card" TEL $c |unescape |HTML)" - done - fi + TEL) + [ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n TEL)" + seq 1 $cnt |while read c; do + teltype="$(pdi_attrib "$card" TEL $c TYPE)" + [ "$teltype" ] \ + && printf '[span .item .TEL [span .type ­%s:] %s]' \ + "$(l10n "TYPE=$teltype" |HTML)" \ + "$(pdi_value "$card" TEL $c |unescape |HTML)" \ + || printf '[span .item .TEL ­%s]' \ + "$(pdi_value "$card" TEL $c |unescape |HTML)" + done ;; - *) if [ $cnt -gt 0 ]; then - printf '[h3 %s]' "$(l10n "$item")" - seq 1 $cnt |while read c; do - printf '[span .item .%s ­%s]' "$item" \ - "$(pdi_value "$card" "$item" $c |unescape |HTML)" - done - fi + *)[ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n "$item")" + seq 1 $cnt |while read c; do + printf '[span .item .%s ­%s]' "$item" \ + "$(pdi_value "$card" "$item" $c |unescape |HTML)" + done ;; esac done @@ -132,19 +125,22 @@ edit_item(){ ;; BDAY|X-ZACK-JOINDATE|X-ZACK-LEAVEDATE) printf '[h3 %s] - [input .item .%s name="%s" value="%s" placeholder="YYYY-MM-DD"] - ' \ + [input .item .%s name="%s" value="%s" placeholder="YYYY-MM-DD"]' \ "$(l10n "$item")" "$item" "$item" "$(pdi_value "$card" "$item" |grep -xE '[0-9-]+')" ;; ADR|NOTE) printf '[h3 %s]' "$(l10n "$item")" seq 1 $cnt |while read c; do + printf '[checkbox "%s_delete" "%i" .delete #%s_delete_%i][label for="%s_delete_%i" %s]' \ + "$item" $c "$item" $c "$item" $c "$(l10n delete)" printf '' \ - "$item" "$item" "$(pdi_value "$card" "$item" $c |unescape |HTML)" + "$item" "$item" "$(pdi_value "$card" "$item" $c |unescape |HTML)" done ;; TEL) printf '[h3 %s]' "$(l10n "$item")" seq 1 $cnt |while read c; do + printf '[checkbox "%s_delete" "%i" .delete #%s_delete_%i][label for="%s_delete_%i" %s]' \ + "$item" $c "$item" $c "$item" $c "$(l10n delete)" teltype="$(pdi_attrib "$card" TEL $c TYPE)" printf '[select .item .teltype name="teltype" [option value="" disabled="disabled" %s %s] @@ -160,13 +156,15 @@ edit_item(){ "$([ "$teltype" = 'FAX' ] && printf 'selected="selected"')" "$(l10n TYPE=FAX)" printf '[input .item .%s name="%s" value="%s" placeholder="%s"]' \ - "$item" "$item" "$(pdi_value "$card" "$item" $c |unescape |HTML)" "$(l10n "$item")" + "$item" "$item" "$(pdi_value "$card" "$item" $c |unescape |HTML)" "$(l10n "$item")" done ;; - *) printf '[h3 %s]' "$(l10n "$item")" + *)printf '[h3 %s]' "$(l10n "$item")" seq 1 $cnt |while read c; do + printf '[checkbox "%s_delete" "%i" .delete #%s_delete_%i][label for="%s_delete_%i" %s]' \ + "$item" $c "$item" $c "$item" $c "$(l10n delete)" printf '[input .item .%s name="%s" value="%s" placeholder="%s"]' \ - "$item" "$item" "$(pdi_value "$card" "$item" $c |unescape |HTML)" "$(l10n "$item")" + "$item" "$item" "$(pdi_value "$card" "$item" $c |unescape |HTML)" "$(l10n "$item")" done ;; esac @@ -277,8 +275,9 @@ 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" \ + # -a "$cachefile" -nt "${_EXEC}/cards" ]; then + if [ -s "$cachefile" -a "$cachefile" -nt "$cardfile" ]; then cat "$cachefile" else print_card "$cardfile" |tee "$cachefile"