You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Cargo.toml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
[package]
2
2
name = "sqlpage"
3
-
version = "0.34.0"
3
+
version = "0.35.0"
4
4
edition = "2021"
5
5
description = "Build data user interfaces entirely in SQL. A web server that takes .sql files and formats the query result using pre-made configurable professional-looking components."
Copy file name to clipboardExpand all lines: examples/official-site/sqlpage/migrations/01_documentation.sql
+14-5Lines changed: 14 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -770,6 +770,7 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
770
770
('sort', 'Make the columns clickable to let the user sort by the value contained in the column.', 'BOOLEAN', TRUE, TRUE),
771
771
('search', 'Add a search bar at the top of the table, letting users easily filter table rows by value.', 'BOOLEAN', TRUE, TRUE),
772
772
('initial_search_value', 'Pre-fills the search bar used to filter the table. The user will still be able to edit the value to display table rows that will initially be filtered out.', 'TEXT', TRUE, TRUE),
773
+
('search_placeholder', 'Customizes the placeholder text shown in the search input field. Replaces the default "Search..." with text that better describes what users should search for.', 'TEXT', TRUE, TRUE),
773
774
('markdown', 'Set this to the name of a column whose content should be interpreted as markdown . Used to display rich text with links in the table. This argument can be repeated multiple times to intepret multiple columns as markdown.', 'TEXT', TRUE, TRUE),
774
775
('icon', 'Set this to the name of a column whose content should be interpreted as a tabler icon name. Used to display icons in the table. This argument can be repeated multiple times to intepret multiple columns as icons. Introduced in v0.8.0.', 'TEXT', TRUE, TRUE),
775
776
('align_right', 'Name of a column the contents of which should be right-aligned. This argument can be repeated multiple times to align multiple columns to the right. Introduced in v0.15.0.', 'TEXT', TRUE, TRUE),
@@ -801,9 +802,11 @@ INSERT INTO example(component, description, properties) VALUES
@@ -1174,6 +1181,8 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
1174
1181
('fixed_top_menu', 'Fixes the top bar with menu at the top (the top bar remains visible when scrolling long pages).', 'BOOLEAN', TRUE, TRUE),
1175
1182
('search_target', 'When this is set, a search field will appear in the top navigation bar, and load the specified sql file with an URL parameter named "search" when the user searches something.', 'TEXT', TRUE, TRUE),
1176
1183
('search_value', 'This value will be placed in the search field when "search_target" is set. Using the "$search" query parameter value will mirror the value that the user has searched for.', 'TEXT', TRUE, TRUE),
1184
+
('search_placeholder', 'Customizes the placeholder text shown in the search input field. Replaces the default "Search" with text that better describes what users should search for.', 'TEXT', TRUE, TRUE),
1185
+
('search_button', 'Customizes the text displayed on the search button. Replaces the default "Search" label with custom text that may better match your applications terminology or language.', 'TEXT', TRUE, TRUE),
1177
1186
('norobot', 'Forbids robots to save this page in their database and follow the links on this page. This will prevent this page to appear in Google search results for any query, for instance.', 'BOOLEAN', TRUE, TRUE),
1178
1187
('font', 'Specifies the font to be used for displaying text, which can be a valid font name from fonts.google.com or the path to a local WOFF2 font file starting with a slash (e.g., "/fonts/MyLocalFont.woff2").', 'TEXT', TRUE, TRUE),
1179
1188
('font_size', 'Font size on the page, in pixels. Set to 18 by default.', 'INTEGER', TRUE, TRUE),
This component is useful for implementing redirects after a form submission,
6
-
or to redirect users to a login page if they are not logged in.
7
-
8
-
Contrary to the http_header component, this component completely stops the execution of the page after it is called,
9
-
so it is suitable to use to hide sensitive information from users that are not logged in, for example.
10
5
11
-
Since it uses an HTTP header to redirect the user, it is not possible to use this component after the page has started being sent to the browser.',
6
+
This component helps you:
7
+
1. Send users to a different page
8
+
1. Stop execution of the current page
9
+
10
+
### Conditional logic
11
+
12
+
There is no `IF` statement in SQL. Even when you use a [`CASE` expression](https://modern-sql.com/caniuse/case_(simple)), all branches are always evaluated (and only one is returned).
13
+
14
+
To conditionally execute a component or a [SQLPage function](/functions.sql), you can use the `redirect` component.
15
+
A common use case is error handling. You may want to proceed with the rest of a page only when certain pre-conditions are met.
16
+
17
+
```sql
18
+
SELECT
19
+
''redirect'' AS component,
20
+
''error_page.sql'' AS link
21
+
WHERE NOT your_condition;
22
+
23
+
-- The rest of the page is only executed if the condition is true
24
+
```
25
+
### Technical limitation
26
+
27
+
You must use this component **at the beginning of your SQL file**, before any other components that might send content to the browser.
28
+
Since the component needs to tell the browser to go to a different page by sending an *HTTP header*,
29
+
it will fail if the HTTP headers have already been sent by the time it is executed.
30
+
31
+
> **Important difference from [http_header](?component=http_header)**
32
+
>
33
+
> This component completely stops the page from running after it''s called.
34
+
> This makes it a good choice for protecting sensitive information from unauthorized users.
INSERT INTO component(name, icon, description, introduced_in_version) VALUES
2
+
('empty_state', 'info-circle', 'Displays a large placeholder message to communicate a single information to the user and invite them to take action.
3
+
4
+
Typically includes a title, an optional icon/image, descriptive text (rich text formatting and images supported via Markdown), and a call-to-action button.
5
+
6
+
Ideal for first-use screens, empty data sets, "no results" pages, or error messages.', '0.35.0');
('title','Description of the empty state.','TEXT',TRUE,FALSE),
10
+
('header','Text displayed on the top of the empty state.','TEXT',TRUE,TRUE),
11
+
('icon','Name of an icon to be displayed on the top of the empty state.','ICON',TRUE,TRUE),
12
+
('image','The URL (absolute or relative) of an image to display at the top of the empty state.','URL',TRUE,TRUE),
13
+
('description','A short text displayed below the title.','TEXT',TRUE,TRUE),
14
+
('link_text','The text displayed on the button.','TEXT',TRUE,FALSE),
15
+
('link_icon','Name of an icon to be displayed on the left side of the button.','ICON',TRUE,FALSE),
16
+
('link','The URL to which the button should navigate when clicked.','URL',TRUE,FALSE),
17
+
('class','Class attribute added to the container in HTML. It can be used to apply custom styling to this item through css.','TEXT',TRUE,TRUE),
18
+
('id','ID attribute added to the container in HTML. It can be used to target this item through css or for scrolling to this item through links (use "#id" in link url).','TEXT',TRUE,TRUE)
19
+
) x;
20
+
21
+
INSERT INTO example(component, description, properties) VALUES
22
+
('empty_state', '
23
+
This example shows how to create a 404-style "Not Found" empty state with
24
+
- a prominent header displaying "404",
25
+
- a helpful description suggesting to adjust search parameters, and
26
+
- a "Search again" button with a search icon that links back to the search page.
27
+
',
28
+
json('[{
29
+
"component": "empty_state",
30
+
"title": "No results found",
31
+
"header": "404",
32
+
"description": "Try adjusting your search or filter to find what you''re looking for.",
33
+
"link_text": "Search again",
34
+
"link_icon": "search",
35
+
"link": "#not-found",
36
+
"id": "not-found"
37
+
}]')),
38
+
('empty_state', '
39
+
It''s possible to use an icon or an image to illustrate the problem.
40
+
',
41
+
json('[{
42
+
"component": "empty_state",
43
+
"title": "A critical problem has occurred",
44
+
"icon": "mood-wrrr",
45
+
"description_md": "SQLPage can do a lot of things, but this is not one of them.
46
+
47
+
Please restart your browser and **cross your fingers**.",
0 commit comments