Skip to content

Commit

Permalink
forms added to sample data, docs updated
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Nov 4, 2018
1 parent ef48bea commit 7b4f8ee
Show file tree
Hide file tree
Showing 10 changed files with 217 additions and 130 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ A text-only [command line client](./tn-cli) implements every possible command.
* User search/discovery.
* Rich formatting of messages, markdown-style: \*style\* → **style**.
* Inline images and file attachments.
* Forms and templated responses suitable for chatbots.
* Message status notifications: message delivery to server; received and read notifications; typing notifications.
* Support for client-side data caching.
* Ability to block unwanted communication server-side.
Expand Down
27 changes: 15 additions & 12 deletions docs/drafty.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ To create a message with just a single image and no text, use the following Draf
```js
{
txt: " ",
fmt: {at: 0, len: 1, key: 0},
ent: {tp: "IM", data: {<your image data here>}}
fmt: [{len: 1}],
ent: [{tp: "IM", data: {<your image data here>}]}
}
```

Expand Down Expand Up @@ -161,14 +161,14 @@ Form provides means to arrange an array of text or Drafty elements in a predicta
"layout": "vlist",
"name": "consent",
"val": [
{"txt": "Do you agree?", "fmt": {"len": 12, "tp": "ST"},
{"txt": "Yes", "fmt": {"len":3}, "ent":{"tp": "BN", "data": {"name": "yes", "act": "pub"}}},
{"txt": "No", "fmt": {"len":2}, "ent":{"tp": "BN", "data": {"name": "no", "act": "pub"}}}
{"txt": "Do you agree?", "fmt": [{"len": 12, "tp": "ST"}]},
{"txt": "Yes", "fmt": [{"len":3}], "ent":[{"tp": "BN", "data": {"name": "yes", "act": "pub"}}]},
{"txt": "No", "fmt": [{"len":2}], "ent":[{"tp": "BN", "data": {"name": "no", "act": "pub"}}]}
]
}
}
```
* `name`: optional name of the form.
* `name`: optional name of the form. This name is returned as a part of the answer.
* `layout`: optional name of layout:
* `vlist`: elements are arranged in a column, default order.
* `hlist`: elements are arranged in a row.
Expand All @@ -177,17 +177,20 @@ If a `Yes` button is pressed in the example above, the client is expected to sen
```js
{
"txt": "Yes",
"fmt": {
"fmt": [{
"at":-1
},
"ent": {
}],
"ent": [{
"tp": "EX",
"data": {
"mime": "application/json",
"name": "consent",
"val": "{\"yes\": 1}"
"val": {
"name": "consent", // name of the form.
"seq": 15, // seq id of the message containing the form.
"resp": {"yes": 1}
}
}
}
}]
}
```

Expand Down
Binary file modified docs/web-desktop-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/web-mob-chat-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/web-mob-contacts-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/web-mob-info-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/web-mob-new-chat-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 82 additions & 26 deletions tinode-db/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"text": "DND"
},
"username": "alice",
"addressBook": ["email:bob@example.com", "email:carol@example.com", "email:dave@example.com",
"email:eve@example.com","email:frank@example.com","email:george@example.com","email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550006", "tel:17025550007", "tel:17025550008", "tel:17025550009"]
"addressBook": ["email:bob@example.com", "email:carol@example.com", "email:dave@example.com",
"email:eve@example.com","email:frank@example.com","email:george@example.com","email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550006", "tel:17025550007", "tel:17025550008", "tel:17025550009"]
},
{
"createdAt": "-139h",
Expand All @@ -28,10 +28,10 @@
"state": 1,
"status": "stuff",
"username": "bob",
"addressBook": ["email:alice@example.com", "email:carol@example.com", "email:dave@example.com",
"email:eve@example.com", "email:frank@example.com", "email:george@example.com", "email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550006", "tel:17025550007", "tel:17025550008", "tel:17025550009"]
"addressBook": ["email:alice@example.com", "email:carol@example.com", "email:dave@example.com",
"email:eve@example.com", "email:frank@example.com", "email:george@example.com", "email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550006", "tel:17025550007", "tel:17025550008", "tel:17025550009"]
},
{
"createdAt": "-138h",
Expand All @@ -43,10 +43,10 @@
"state": 1,
"status": "ho ho ho",
"username": "carol",
"addressBook": ["email:alice@example.com", "email:bob@example.com", "email:dave@example.com",
"email:eve@example.com", "email:frank@example.com", "email:george@example.com", "email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550006", "tel:17025550007", "tel:17025550008", "tel:17025550009"]
"addressBook": ["email:alice@example.com", "email:bob@example.com", "email:dave@example.com",
"email:eve@example.com", "email:frank@example.com", "email:george@example.com", "email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550006", "tel:17025550007", "tel:17025550008", "tel:17025550009"]
},
{
"createdAt": "-137h",
Expand All @@ -58,10 +58,10 @@
"state": 1,
"status": "hiding!",
"username": "dave",
"addressBook": ["email:alice@example.com", "email:bob@example.com", "email:carol@example.com",
"email:eve@example.com", "email:frank@example.com", "email:george@example.com", "email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550006", "tel:17025550007", "tel:17025550008", "tel:17025550009"]
"addressBook": ["email:alice@example.com", "email:bob@example.com", "email:carol@example.com",
"email:eve@example.com", "email:frank@example.com", "email:george@example.com", "email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550006", "tel:17025550007", "tel:17025550008", "tel:17025550009"]
},
{
"createdAt": "-136h",
Expand All @@ -72,10 +72,10 @@
"public": {"fn": "Eve Adams", "photo": "eve-64.jpg", "type": "jpg"},
"state": 1,
"username": "eve",
"addressBook": ["email:alice@example.com", "email:bob@example.com", "email:carol@example.com",
"email:dave@example.com", "email:george@example.com", "email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550006", "tel:17025550007", "tel:17025550008", "tel:17025550009"]
"addressBook": ["email:alice@example.com", "email:bob@example.com", "email:carol@example.com",
"email:dave@example.com", "email:george@example.com", "email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550006", "tel:17025550007", "tel:17025550008", "tel:17025550009"]
},
{
"createdAt": "-135h",
Expand All @@ -87,10 +87,10 @@
"state": 2,
"status": "singing!",
"username": "frank",
"addressBook": ["email:bob@example.com", "email:carol@example.com", "email:dave@example.com",
"email:eve@example.com", "email:george@example.com", "email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550007", "tel:17025550008", "tel:17025550009"]
"addressBook": ["email:bob@example.com", "email:carol@example.com", "email:dave@example.com",
"email:eve@example.com", "email:george@example.com", "email:tino@example.com",
"tel:17025550001", "tel:17025550002", "tel:17025550003", "tel:17025550004", "tel:17025550005",
"tel:17025550007", "tel:17025550008", "tel:17025550009"]
},
{
"createdAt": "-134h",
Expand Down Expand Up @@ -157,7 +157,7 @@
},
{
"createdAt": "-119h",
"users": [{"name": "alice"}, {"name": "carol", "private": {"comment": "Alice Joha"}}]
"users": [{"name": "alice"}, {"name": "carol", "private": {"comment": "Alice Joha"}}]
},
{
"createdAt": "-118h",
Expand Down Expand Up @@ -315,5 +315,61 @@
"Outlook not so good",
"Very doubtful",
"All your base are belong to us"
]
],
"forms": [
{
"txt": "form",
"fmt": [{
"at": 0,
"len": 4,
"key": 0
}],
"ent": [{
"tp": "FM",
"data": {
"layout": "vlist",
"name": "consent",
"val": [
{"txt": "Post response", "fmt": [{"len": 13, "tp": "ST"}]},
{"txt": "Yes", "fmt": [{"len":3}], "ent":[{"tp": "BN", "data": {"name": "yes", "act": "pub"}}]},
{"txt": "OK", "fmt": [{"len":2}], "ent":[{"tp": "BN", "data": {"name": "no", "act": "pub"}}]}
]
}
}]
},
{
"txt": "form",
"fmt": [{
"at": 0,
"len": 4,
"key": 0
}],
"ent": [{
"tp": "FM",
"data": {
"layout": "vlist",
"name": "consent",
"val": [
{"txt": "Go to URL:", "fmt": [{"len": 13, "tp": "ST"}]},
{"ent": [{
"tp": "FM",
"data": {
"layout": "hlist",
"val": [
{"txt": "OK",
"fmt": [{"len":2}],
"ent":[{"tp": "BN",
"data": {"name": "yes", "act": "url", "ref": "https://www.example.com/?key=val"}}]},
{"txt": "Yes",
"fmt": [{"len":3}],
"ent":[{"tp": "BN",
"data": {"name": "no", "act": "url", "ref": "https://www.example.com"}}]}
]
}
}]}
]
}
}]
}
]
}
Loading

0 comments on commit 7b4f8ee

Please sign in to comment.