From e2fd5749ff2086b88e51a7954c99580275b058df Mon Sep 17 00:00:00 2001 From: vjeantet Date: Fri, 25 Sep 2020 10:01:01 +0200 Subject: checklist: condition are an DOM element attribute --- layouts/shortcodes/c/show.html | 8 +++----- static/js/checklist.js | 28 ++++++++++++---------------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/layouts/shortcodes/c/show.html b/layouts/shortcodes/c/show.html index 637f430..830c784 100644 --- a/layouts/shortcodes/c/show.html +++ b/layouts/shortcodes/c/show.html @@ -1,17 +1,15 @@ -{{ $formID := "6d2ab01b-fad4-4e70-83a8-b910ca848fec" }} -{{ $random := delimit (shuffle (split (md5 $formID) "" )) "" }} +{{ $random := delimit (shuffle (split (md5 .Page.File.UniqueID) "" )) "" }} {{ $id := printf "dp-show-%s" $random}} {{ $condition := trim (.Get 0) " "}} -{{ $regFormValue := printf "formValue('%s','$1')" $formID}} +{{ $regFormValue := printf "formValue('$1')"}} {{ $conditionFix := replaceRE `{(\w+)}` $regFormValue $condition }} {{ $conditionFix = replace $conditionFix ` and ` ` && ` }} {{ $conditionFix = replace $conditionFix ` or ` ` || ` }} {{ $conditionFix = replaceRE `[^)]+has\s+('\w+')` ".includes($1)" $conditionFix }} -