From fc6247752876daac4f5bfaa8b4e442fa7b0f07cb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Thu, 10 Sep 2020 18:30:48 +0200 Subject: [PATCH] top-button in card-view, display clients by last name --- cards/cards.css | 18 ++++++++++++++++++ cards/index.cgi | 3 ++- cards/l10n.sh | 1 + cards/list.sh | 18 ++++++++++++++---- index.cgi | 2 +- 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/cards/cards.css b/cards/cards.css index c227c60..49efe39 100644 --- a/cards/cards.css +++ b/cards/cards.css @@ -101,17 +101,35 @@ } .newcard { + position: sticky; + top: 0; display: block; border: solid 1px; margin: 1em 2em .5em 2em; padding: .5em; text-align: right; background: #EEF; + z-index: 1; +} +.newcard a[href="#top"] { + position: absolute; + left: .5em; + font-weight: bold; + text-decoration: none; + color: inherit; +} +.newcard a[href="#top"]:before { + content: '\2b06'; } .newcard button { box-shadow: 0 0 .5ex #888; } +.card-anchor { + position: relative; + height: 0; + top: -4em; +} .card { display: block; position: relative; diff --git a/cards/index.cgi b/cards/index.cgi index 24f7a86..43f949c 100755 --- a/cards/index.cgi +++ b/cards/index.cgi @@ -29,8 +29,9 @@ list_hi_companies(){ { w_filter_diag printf ' [form class="newcard" action="/cards/new_card.sh" method="POST" + [a href="#top" . %s] [button type="submit" %s] - ]' "$(l10n newcard)" + ]' "$(l10n top)" "$(l10n newcard)" [ "$edit" ] && edit_card "$edit" list_cards diff --git a/cards/l10n.sh b/cards/l10n.sh index b0930c1..f10007e 100755 --- a/cards/l10n.sh +++ b/cards/l10n.sh @@ -93,6 +93,7 @@ l10n(){ X-ZACK-JOINDATE_short) printf %s "Anm.";; X-ZACK-LEAVEDATE_short) printf %s "Abm.";; + top) printf 'Seitenanfang';; edit) printf %s "Bearbeiten";; edit_categories) printf %s "Kategorien Bearbeiten";; vcf_export) printf %s "Vcard Exportieren";; diff --git a/cards/list.sh b/cards/list.sh index 12b4a9e..9d5457c 100755 --- a/cards/list.sh +++ b/cards/list.sh @@ -13,7 +13,8 @@ edit_card(){ else card="$(pdi_load "$tempfile")" cat <<-EOF - [form .card #${cardfile##*/} action="/cards/update_card.sh" method="POST" + [span .card-anchor #${cardfile##*/}] + [form .card action="/cards/update_card.sh" method="POST" [input type="hidden" name="tid" value="$(transid ${tempfile})"] [div .section .basic $( edit_item "$card" N GENDER @@ -54,10 +55,19 @@ edit_card(){ print_card(){ local cardfile="$1" local card="$(pdi_load "$cardfile")" + local N1 N2 N3 N4 N5 + IFS=\; read N1 N2 N3 N4 N5 <<-EOF + $(pdi_value "$card" N |pdi_unescape |HTML) + EOF + cat <<-EOF - [div .card #${cardfile##*/} - [div .section .basic $( - card_item "$card" FN GENDER NICKNAME BDAY X-ZACK-JOINDATE X-ZACK-LEAVEDATE SOUND PHOTO LOGO + [span .card-anchor #${cardfile##*/}] + [div .card + [div .section .basic + [h2 .item .FN . $N4 $N1 $N5] + [span .item .firstname . $N2 $N3] + $( + card_item "$card" GENDER NICKNAME BDAY X-ZACK-JOINDATE X-ZACK-LEAVEDATE SOUND PHOTO LOGO )] [div .section .address $(card_item "$card" ADR)] [div .section .phone $(card_item "$card" TEL EMAL IMPP URL)] diff --git a/index.cgi b/index.cgi index 9d7d18f..0d85c87 100755 --- a/index.cgi +++ b/index.cgi @@ -53,7 +53,7 @@ yield_page() { [link rel="stylesheet" type="text/css" href="%s"] ' "$style" printf ' - ] [body class="%s" + ] [body #top class="%s" ' "$class" cat [ "$message" ] && printf '[p #message\n%s\n]' $(l10n "$message") -- 2.39.2