diff --git a/Cargo.lock b/Cargo.lock index 2ba9298b..8c9fb342 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1298,9 +1298,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.18" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "markdown" @@ -1811,9 +1811,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ "bitflags", "errno", @@ -2010,7 +2010,7 @@ dependencies = [ [[package]] name = "sqlpage" -version = "0.6.11" +version = "0.6.12" dependencies = [ "actix-web", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 51cf8d47..14b9009d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqlpage" -version = "0.6.11" +version = "0.6.12" edition = "2021" description = "A SQL-only web application framework. Takes .sql files and formats the query result using pre-made configurable professional-looking components." keywords = ["web", "sql", "framework"] diff --git a/examples/official-site/sqlpage/migrations/01_documentation.sql b/examples/official-site/sqlpage/migrations/01_documentation.sql index 000a0ced..eade5fd6 100644 --- a/examples/official-site/sqlpage/migrations/01_documentation.sql +++ b/examples/official-site/sqlpage/migrations/01_documentation.sql @@ -317,14 +317,22 @@ INSERT INTO component(name, icon, description) VALUES INSERT INTO parameter(component, name, description, type, top_level, optional) SELECT 'table', * FROM (VALUES -- top level ('sort', 'Make the columns clickable to let the user sort by the value contained in the column.', 'BOOLEAN', TRUE, TRUE), - ('search', 'Add a search bar at the top of the table, letting users easily filter table rows by value.', 'BOOLEAN', TRUE, TRUE) + ('search', 'Add a search bar at the top of the table, letting users easily filter table rows by value.', 'BOOLEAN', TRUE, TRUE), + ('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) ) x; INSERT INTO example(component, description, properties) VALUES + ('table', 'The most basic table.', + json('[{"component":"table"}, {"a": 1, "b": 2}, {"a": 3, "b": 4}]')), ('table', 'A table of users with filtering and sorting.', json('[{"component":"table", "sort":true, "search":true}, '|| '{"Forename": "Ophir", "Surname": "Lojkine", "Pseudonym": "lovasoa"},' || - '{"Forename": "Linus", "Surname": "Torvalds", "Pseudonym": "torvalds"}]')); + '{"Forename": "Linus", "Surname": "Torvalds", "Pseudonym": "torvalds"}]')), + ('table', 'A table that uses markdown to display links', + json('[{"component":"table", "markdown": "Documentation"}, '|| + '{"name": "table", "description": "Displays SQL results as a searchable table.", "Documentation": "[docs](documentation.sql?component=table)"}, + {"name": "chart", "description": "Show graphs based on numeric data.", "Documentation": "[docs](documentation.sql?component=chart)"} + ]')); INSERT INTO component(name, icon, description) VALUES diff --git a/sqlpage/templates/table.handlebars b/sqlpage/templates/table.handlebars index 9d8220d9..b1fd994b 100644 --- a/sqlpage/templates/table.handlebars +++ b/sqlpage/templates/table.handlebars @@ -27,7 +27,13 @@