Skip to content

Commit 074a1bc

Browse files
committed
better documentation
1 parent e30c381 commit 074a1bc

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
- Optimize queries like `select 'xxx' as component, sqlpage.some_function(...) as parameter`
1212
to avoid making an unneeded database query.
1313
This is especially important for the performance of `sqlpage.run_sql` and the `dynamic` component.
14+
- New `dropdown` row-level property in the [`form` component](https://sql.ophir.dev/documentation.sql?component=form#component)
15+
- ![select dropdown in form](https://github.com/lovasoa/SQLpage/assets/552629/5a2268d3-4996-49c9-9fb5-d310e753f844)
16+
- ![multiselect input](https://github.com/lovasoa/SQLpage/assets/552629/e8d62d1a-c851-4fef-8c5c-a22991ffadcf)
1417

1518
## 0.20.2 (2024-04-01)
1619

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
SELECT 'shell' as component, 'SQLPage' as title,
2+
'chart' as menu_item,
3+
'layouts' as menu_item,
4+
'tabs' as menu_item,
5+
'show_variables' as menu_item;
6+
7+
select 'list' as component, 'POST variables' as title,
8+
'Here is the list of POST variables sent to this page.
9+
Post variables are accessible with `:variable_name`.' as description_md,
10+
'No POST variable.' as empty_title;
11+
select key as title, ':' || key || ' = ' || "value" as description
12+
from json_each(sqlpage.variables('post'));
13+
14+
select 'list' as component, 'GET variables' as title,
15+
'Here is the list of GET variables sent to this page.
16+
Get variables are accessible with `$variable_name`.' as description_md,
17+
'No GET variable.' as empty_title;
18+
select key as title, '$' || key || ' = ' || "value" as description
19+
from json_each(sqlpage.variables('get'));

examples/official-site/examples/tabs.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
SELECT 'shell' as component, 'SQLPage' as title,
2+
'chart' as menu_item,
3+
'layouts' as menu_item,
4+
'tabs' as menu_item,
5+
'show_variables' as menu_item;
6+
17
create table if not exists tab_example_cards as
28
select 'Leaf' as title, 'Leaf_1_web' as img, 'f4' as prefix, 'green' as color, 'Autumn''s dance begins, Crimson leaves in breezy waltz, Nature''s fleeting art.' as description union all
39
select 'Caterpillar', 'Caterpillar_of_box_tree_moth%2C_Germany_2019', 'a9', 'green', 'Caterpillar crawls, silent transformation unfolds.' union all

examples/official-site/sqlpage/migrations/01_documentation.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ SELECT
299299
)) as options
300300
FROM fruits
301301
```
302-
', json('[{"component":"form"}, '||
303-
'{"name": "Fruit", "type": "select", "dropdown": true, "value": 1, "options": '||
304-
'"[{\"label\": \"Orange\", \"value\": 0}, {\"label\": \"Apple\", \"value\": 1}, {\"label\": \"Banana\", \"value\": 3}]"}
302+
', json('[{"component":"form", "action":"examples/show_variables.sql"},
303+
{"name": "Fruit", "type": "select", "dropdown": true, "value": 1, "options":
304+
"[{\"label\": \"Orange\", \"value\": 0}, {\"label\": \"Apple\", \"value\": 1}, {\"label\": \"Banana\", \"value\": 3}]"}
305305
]')),
306306
('form', '### Multi-select
307307
You can authorize the user to select multiple options by setting the `multiple` property to `true`.
@@ -337,7 +337,7 @@ left join my_user_options
337337
on my_options.id = my_user_options.option_id
338338
and my_user_options.user_id = $user_id
339339
```
340-
', json('[{"component":"form"},
340+
', json('[{"component":"form", "action":"examples/show_variables.sql"},
341341
{"label": "Fruits", "name": "fruits[]", "type": "select", "multiple": true, "create_new":true, "placeholder": "Good fruits...", "dropdown": true, "description": "press ctrl to select multiple values", "options":
342342
"[{\"label\": \"Orange\", \"value\": 0, \"selected\": true}, {\"label\": \"Apple\", \"value\": 1}, {\"label\": \"Banana\", \"value\": 3, \"selected\": true}]"}
343343
]')),

0 commit comments

Comments
 (0)