Skip to content

Commit

Permalink
chore: add example notes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielo515 committed Aug 23, 2024
1 parent 6c1f7c8 commit 578bd3e
Show file tree
Hide file tree
Showing 14 changed files with 178 additions and 0 deletions.
6 changes: 6 additions & 0 deletions EXAMPLE_VAULT/000 - Templates/as dataview example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Data
<%*
const formApi = app.plugins.plugins.modalforms.api;
const result = await formApi.exampleForm({ values: {dataview_example:'John', age: 32}});
tR += result.asDataviewProperties();
-%>
10 changes: 10 additions & 0 deletions EXAMPLE_VAULT/000 - Templates/basic frontmatter example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
<%*
const modalForm = app.plugins.plugins.modalforms.api;
const result = await modalForm.openForm('example-form',{values: {
second: 5,
select: 'second'
}});
tR += result.asFrontmatterString();
-%>
---
5 changes: 5 additions & 0 deletions EXAMPLE_VAULT/000 - Templates/format with template example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%*
const modalForm = app.plugins.plugins.modalforms.api;
const result = await modalForm.openForm('example-form');
tR += result.asString('{{Name}} is {{age}} years old and his/her favourite food is {{favorite_meal}}. Family status: {{is_family}}');
%>
9 changes: 9 additions & 0 deletions EXAMPLE_VAULT/000 - Templates/pick omit example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
<%*
const modalForm = app.plugins.plugins.modalforms.api;
const result1 = await modalForm.limitedForm('example-form',{pick:['second']});
tR += result1.asFrontmatterString();
const result2 = await modalForm.limitedForm('example-form',{omit:['second','toggle']});
tR += result2.asFrontmatterString();
-%>
---
16 changes: 16 additions & 0 deletions EXAMPLE_VAULT/000 - Templates/pick omit results.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
<%*
const modalForm = app.plugins.plugins.modalforms.api;
const result = await modalForm.openForm('example-form');
tR += result.asFrontmatterString({
pick:['second']
});
-%>
---

<%*
tR += result.asDataviewProperties({ omit:['second','toggle'] });
tp.context = { parent: "parent" }
await tp.file.include('[[02_sub_template]]')
console.log("parent",tp.context, this.context)
%>
3 changes: 3 additions & 0 deletions EXAMPLE_VAULT/Books/1984.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
tags: book
---
3 changes: 3 additions & 0 deletions EXAMPLE_VAULT/Books/Alice in wonderland.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
tags: book
---
18 changes: 18 additions & 0 deletions EXAMPLE_VAULT/People/Fátima.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
fileClass: [Person]
tags: person, person/Estudiante
aliases: Fátima
family: false
company: Unknown
roles: Estudiante
name: Fátima

---

## Information

relations:: [[]]
company:: [[Unknown]]
introducer:: [[Alicia]]

#some-tag
4 changes: 4 additions & 0 deletions EXAMPLE_VAULT/People/John.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
tag: person
age: 29
---
16 changes: 16 additions & 0 deletions EXAMPLE_VAULT/People/Jose AliFriend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
fileClass: [Person]
tags: person, person/Amigo
aliases: Jose
family: false
company: Unknown
roles: Amigo
name: Jose AliFriend

---

## Information

relations:: [[]]
company:: [[Unknown]]
introducer:: [[Alicia]]
4 changes: 4 additions & 0 deletions EXAMPLE_VAULT/People/Mari Sue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
tag: person
age: 25
---
9 changes: 9 additions & 0 deletions EXAMPLE_VAULT/People/Mr Smith.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
tag: person
age: 33
aliases: Jesus
---

```js
const x = 'lol'
```
37 changes: 37 additions & 0 deletions EXAMPLE_VAULT/Result helpers example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<%*
const modalForm = app.plugins.plugins.modalforms.api;
const result = await modalForm.openForm('simple', {values:{
list:['1984','Hello'],
name: 'Fedever',
number: 55
}});
%>

## Simple values
<% result.getV('name') %>
### Upper
<% result.getV('name').upper %>
number
<% result.getV('number') %>
<% result.getV('number').toBullets() %>
<%* console.log(result.getV('number')) %>
## Shorthand
<% result.getV('number').bullets %>
## List
<% result.getV('list') %>
<% result.getV('list').toBullets() %>
### Shorthand
<% result.getV('list').bullets %>
<% result.getV('list').upper.bullets %>
<% result.getV('list').lower.bullets %>
<% result.getV('list').toDv() %>
<% result.getV('list').upper.toDv() %>
## Invalid
<% result.getV('invalid') %>
<% result.getV('invalid').bullets %>
<% result.getV('invalid').toBullets() %>

```dataview
table list
where file.name = this.file.name
```
38 changes: 38 additions & 0 deletions EXAMPLE_VAULT/Result shorthands example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<%*
const modalForm = app.plugins.plugins.modalforms.api;
const result = await modalForm.openForm('simple', {values:{
list:['1984','Hello'],
name: 'Fedever',
number: 55
}});
%>

## Simple values
<% result.name %>
### Upper
<% result.name.upper %>
number
<% result.number %>
<% result.number.toBullets() %>
<%* console.log(result.number) %>
## Shorthand
<% result.number.bullets %>
## List
<% result.list %>
<% result.list.toBullets() %>
### Shorthand
<% result.list.bullets %>
<% result.list.upper.bullets %>
<% result.list.lower.bullets %>
<% result.list.toDv() %>
<% result.list.upper.toDv() %>
## Invalid
<% result.invalid -%>
<% result.invalid.bullets -%>
<% result.invalid.toBullets() -%>

```dataview
table list
where file.name = this.file.name
```
[[Fátima|Fátima]]

0 comments on commit 578bd3e

Please sign in to comment.