Skip to content

Commit 9e804cc

Browse files
committed
improve links in lists
and improve docs
1 parent b07e38e commit 9e804cc

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
- In the form component, allow the usage of the `value` property in checkboxes and radio buttons. The custom `checked` property still works, but it is now optional.
3838
- Updated the welcome message displayed on the terminal when starting the server to be friendlier and more helpful.
3939
- Display the page footer (by default: `Built with SQLPage`) at the bottom of the page instead of immediately after the main content.
40+
- Improve links in the list component: The entire list item is now clickable, when a `link` property is provided.
4041

4142
## 0.31.0 (2024-11-24)
4243

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,16 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
5757
INSERT INTO example(component, description, properties) VALUES
5858
('list', 'A basic compact list', json('[{"component":"list", "compact": true, "title": "SQLPage lists are..."},{"title":"Beautiful"},{"title":"Useful"},{"title":"Versatile"}]')),
5959
('list', 'An empty list with a link to add an item', json('[{"component":"list", "empty_title": "No items yet", "empty_description": "This list is empty. Click here to create a new item !", "empty_link": "documentation.sql"}]')),
60-
('list', 'A list with rich text descriptions', json('[{"component":"list", "wrap": true},
61-
{"title":"SQLPage", "image_url": "https://raw.githubusercontent.com/sqlpage/SQLPage/main/docs/favicon.png", "description_md":"A **SQL**-based **page** generator for **PostgreSQL**, **MySQL**, **SQLite** and **SQL Server**. [Free on Github](https://github.com/sqlpage/SQLPage)"},
62-
{"title":"Tabler", "image_url": "https://avatars.githubusercontent.com/u/35471246", "description_md":"A **free** and **open-source** **HTML** template pack based on **Bootstrap**."},
63-
{"title":"Tabler Icons", "image_url": "https://tabler.io/favicon.ico", "description_md":"A set of over **700** free MIT-licensed high-quality **SVG** icons for you to use in your web projects."}
60+
('list', '
61+
### A list with rich text descriptions
62+
63+
This example illustrates creating a nice list where each item has a title, a description, an image, and a link to another page.
64+
65+
> Be careful, nested links are not supported. If you use the list''s `link` property, then your markdown `description_md` should not contain any link.
66+
', json('[{"component":"list", "wrap": true},
67+
{"title":"SQL Websites", "image_url": "/favicon.ico", "description_md":"Write SQL, get a website. SQLPage is a **SQL**-based **site** generator for **PostgreSQL**, **MySQL**, **SQLite** and **SQL Server**.", "link": "/"},
68+
{"title":"SQL Forms", "image_url": "https://upload.wikimedia.org/wikipedia/commons/b/b6/FileStack_retouched.jpg", "description_md":"Easily collect data **from users to your database** using the *form* component. Handle the data in SQL with `INSERT` or `UPDATE` queries.", "link": "?component=form"},
69+
{"title":"SQL Maps", "image_url": "https://upload.wikimedia.org/wikipedia/commons/1/15/Vatican_City_map_EN.png", "description_md":"Show database contents on a map using the *map* component. Works well with *PostGIS* and *SpatiaLite*.", "link": "?component=map"}
6470
]')),
6571
('list', 'A beautiful list with bells and whistles.',
6672
json('[{"component":"list", "title":"Top SQLPage features" }, '||

examples/official-site/sqlpage/migrations/10_map.sql

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@ VALUES
99
1010
The map component displays a custom interactive map with markers on it.
1111
12-
Useful in combination with PostgreSQL''s PostGIS or SQLite''s spatialite,
13-
to create custom visualizations of your geospatial data.
14-
15-
The map component is also compatible with non-geospatial databases,
16-
by manually setting the `latitude` and `longitude` parameters.
12+
In its simplest form, the component displays points on a map from a table of latitudes and longitudes.
13+
But it can also be used by cartographers in combination with PostgreSQL''s PostGIS or SQLite''s spatialite,
14+
to create custom visualizations of geospatial data.
15+
Use the `geojson` property to generate rich maps from a GIS database.
1716
1817
### Example Use Cases
1918
2019
1. **Store Locator**: Build an interactive map to find the nearest store information using SQL-stored geospatial data.
2120
2. **Delivery Route Optimization**: Visualize the results of delivery route optimization algorithms.
2221
3. **Sales Heatmap**: Identify high-performing regions by mapping sales data stored in SQL.
23-
4. **Real-Time Tracking**: Create dynamic dashboards that track vehicles, assets, or users live using PostGIS or MS SQL Server geospatial time series data.
22+
4. **Real-Time Tracking**: Create dynamic dashboards that track vehicles, assets, or users live using PostGIS or MS SQL Server geospatial time series data. Use the [shell](?component=shell) component to auto-refresh the map.
2423
5. **Demographic Insights**: Map customer demographics or trends geographically to uncover opportunities for growth or better decision-making.
2524
',
2625
'map',
@@ -216,7 +215,7 @@ Perfect for visualizing multi-dimensional relationships between points on a map,
216215
'[
217216
{ "component": "map", "title": "Paris", "zoom": 11, "latitude": 48.85, "longitude": 2.34 },
218217
{ "title": "Notre Dame", "icon": "building-castle", "color": "indigo", "latitude": 48.8530, "longitude": 2.3498, "description_md": "A beautiful cathedral.", "link": "https://en.wikipedia.org/wiki/Notre-Dame_de_Paris" },
219-
{ "title": "Eiffel Tower", "icon": "tower", "color": "yellow", "latitude": 48.8584, "longitude": 2.2945, "description_md": "A tall tower. [Wikipedia](https://en.wikipedia.org/wiki/Eiffel_Tower)" },
218+
{ "title": "Eiffel Tower", "icon": "tower", "color": "red", "latitude": 48.8584, "longitude": 2.2945, "description_md": "A tall tower. [Wikipedia](https://en.wikipedia.org/wiki/Eiffel_Tower)" },
220219
{ "title": "Tower to Cathedral", "geojson": {"type": "LineString", "coordinates": [[2.2945, 48.8584], [2.3498, 48.8530]]}, "color": "teal", "description": "A nice 45 minutes walk." }
221220
]'
222221
)

sqlpage/templates/list.handlebars

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
{{/if}}
77
<div class="list-group list-group-flush list-group-hoverable">
88
{{#each_row}}
9+
{{#if link}}
10+
<a href="{{link}}" {{#if id}}id="{{id}}"{{/if}}
11+
class="list-group-item list-group-item-action {{#if active}}active{{/if}} {{#if ../compact}}py-1{{/if}} {{class}} text-decoration-none link-body-emphasis">
12+
{{else}}
913
<div {{#if id}}id="{{id}}"{{/if}}
1014
class="list-group-item list-group-item-action {{#if active}}active{{/if}} {{#if ../compact}}py-1{{/if}} {{class}}">
11-
<div class="row align-items-center">
12-
{{#if link}}
13-
<a href="{{link}}" class="col text-truncate row align-items-center text-decoration-none link-body-emphasis">
14-
{{/if}}
15-
15+
{{/if}}
16+
<div class="row align-items-center">
1617
{{#if color}}
1718
<div class="col-auto"><span class="badge bg-{{color}}"></span></div>
1819
{{/if}}
@@ -36,11 +37,6 @@
3637
</div>
3738
</div>
3839

39-
{{#if link}}
40-
</a>
41-
{{/if}}
42-
43-
4440
{{#if view_link}}
4541
<a href="{{view_link}}" class="link-secondary col-auto" title="View">
4642
{{~icon_img 'eye'~}}
@@ -59,7 +55,11 @@
5955
</a>
6056
{{/if}}
6157
</div>
58+
{{#if link}}
59+
</a>
60+
{{else}}
6261
</div>
62+
{{/if}}
6363
{{/each_row}}
6464
{{#if (eq @row_index 0)}}
6565
<a href="{{default empty_link '#'}}" class="list-group-item list-group-item-action">

0 commit comments

Comments
 (0)