work in progress:person form; shortcode for dynamic links

This commit is contained in:
Helmut Merz 2023-03-16 11:02:23 +01:00
parent 80779cbea7
commit 275ed6590c
3 changed files with 15 additions and 12 deletions

View file

@ -1,17 +1,17 @@
--- ---
title: "test1" title: Person
summary: "Test Page #1" summary: View/Edit Person
img: img:
pageid: test1 pageid: app_form_person
domains: [App] domains: [App]
topics: [Examples] topics: [Examples]
date: 2023-03-12 date: 2023-03-16
author: helmutm author: helmutm
draft: false draft: false
weight: 100 weight: 100
--- ---
cyberscopes example site - use petite-vue in Hugo-generated sites. cyberscopes example site - view / edit person (user) data.
{{< pv/fieldset >}} {{< pv/fieldset >}}
@ -23,8 +23,10 @@ cyberscopes example site - use petite-vue in Hugo-generated sites.
{{< pv/display linkto="data.id" {{< pv/display linkto="data.id"
expr="`${data.firstname} ${data.lastname}`.trim() || '???'" >}} expr="`${data.firstname} ${data.lastname}`.trim() || '???'" >}}
<br>
{{< pv/display name="id" linkto="data.id" >}} {{< pv/link >}}
Reload page with id {{< pv/display name="id" >}}
{{< /pv/link >}}
{{< /pv/fieldset >}} {{< /pv/fieldset >}}

View file

@ -1,8 +1,6 @@
{{- $name := .Get "name" | default "textline" -}} {{- $name := .Get "name" | default "textline" -}}
{{- $expr := .Get "expr" | default (printf "data.%s" $name) -}} {{- $expr := .Get "expr" | default (printf "data.%s" $name) -}}
{{- $linkto := .Get "linkto" -}} {{- $linkto := .Get "linkto" -}}
<div> {{- if $linkto }}<a :href="'?id=' + {{ $linkto }}">{{ end -}}
{{- if $linkto }}<a :href="'?id=' + {{ $linkto }}">{{ end -}} <span v-text="{{ $expr }}"></span>
<pre v-text="{{ $expr }}"></pre> {{- if $linkto }}</a>{{ end -}}
{{- if $linkto }}</a>{{ end -}}
</div>

View file

@ -0,0 +1,3 @@
{{- $target := .Get "target" | default "data.id" -}}
{{- $prefix := .Get "prefix" | default "?id=" -}}
<a :href="'{{ $prefix }}' + {{ $target }}">{{ .Inner }}</a>