Skip to content

Commit

Permalink
doc: show how to qualify a field as URL
Browse files Browse the repository at this point in the history
  • Loading branch information
DE MERINGO Olivier committed Jun 11, 2024
1 parent dcbe113 commit a45d63b
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 7 deletions.
39 changes: 32 additions & 7 deletions doc/how-to-configure-widget.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
- [Example with just 2 fields](#example-with-just-2-fields)
- [Restricting allowed values](#restricting-allowed-values)
- [2.Configure the display and edition of fields](#2configure-the-display-and-edition-of-fields)
- [Multi valued vs mono valued inputs](#multi-valued-vs-mono-valued-inputs)
- [Example](#example)
- [Basic Example](#basic-example)
- [How to display a URL](#how-to-display-a-url)
- [How to configure lists with multi valued vs mono valued inputs](#how-to-configure-lists-with-multi-valued-vs-mono-valued-inputs)
- [3.Configure the widget](#3configure-the-widget)
- [4.Tips to ease development](#4tips-to-ease-development)
- [TODO](#todo)

Configuring the widget needs 3 steps:
Expand Down Expand Up @@ -109,11 +111,7 @@ Edit ictst/widget/tools.fields-custom-properties.json

>[!NOTE] The configuration of cards view (how content is displayed as cards insted of table is done separately.
### Multi valued vs mono valued inputs

Use the `tag`vs `tags`(plural) to let the widget know if the field accepts multiple values.

### Example
### Basic Example

```json
{
Expand All @@ -132,8 +130,35 @@ Use the `tag`vs `tags`(plural) to let the widget know if the field accepts multi

```


### How to display a URL

Use `link` as the subtype.

"subtype": "link"

```json
{
"name": "website",
"subtype": "link"
}
```


### How to configure lists with multi valued vs mono valued inputs

Use the `tag`vs `tags`(plural) to let the widget know if the field accepts multiple values.



## 3.Configure the widget

## 4.Tips to ease development

During development phase it is tedious to use a separate configuration file or the widget. Because this configuration is declared as a github url in the html, it would involve constantly committing / pushing a change to test it.

💡 An alternative is to write the json configuration *inline* in the HTML file (see the example in [tools-widget-inline-dev.html](../ictst/widget/tools-widget-inline-dev.html)).

## TODO

Things that remain to be explained
Expand Down
5 changes: 5 additions & 0 deletions ictst/model/tools.frictionless-table-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"name": "organization",
"title": "the organization behind the tool",
"type": "string"
},
{
"name": "website",
"title": "website",
"type": "string"
}
]
}
49 changes: 49 additions & 0 deletions ictst/widget/tools-widget-inline-dev.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@


<!DOCTYPE html>
<html>
<body>


<h1>The content of the tool repository</h1>
<!-- DATAMI - contribute with GIT ...but without minding it -->
<!-- An open source widget coded with 🤍 by the tech cooperative multi : https://multi.coop -->

<!-- DATAMI WIDGET'S HTML BLOCK -->
<datami-file
title="Tools"
gitfile="https://github.com/Boavizta/ict-sustainability-tools/blob/main/ictst/data/tools.csv"
options='{
"schema": {
"file": "https://github.com/Boavizta/ict-sustainability-tools/blob/main/ictst/model/tools.frictionless-table-schema.json"
},
"fields-custom-properties": {
"fields": [
{
"name": "name",
"sticky": true,
"primaryKey": true,
"maxLength": 50
},
{
"name": "organization"
},
{
"name": "website",
"subtype": "link"
}
]
}
}'
usertoken='<A_GITHUB_PAT>'
locale="en"
>
</datami-file>

<!-- DATAMI WIDGET'S APP.JS SCRIPT -->
<script src="https://datami-widget.multi.coop/js/app.js" type="text/javascript" defer></script>


</body>
</html>
4 changes: 4 additions & 0 deletions ictst/widget/tools.fields-custom-properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
},
{
"name": "organization"
},
{
"name": "website",
"subtype": "link"
}
]
}
Expand Down

0 comments on commit a45d63b

Please sign in to comment.