-
-
Notifications
You must be signed in to change notification settings - Fork 170
Success stories page #1202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Success stories page #1202
Changes from 2 commits
83df6c0
176dc07
5ca8acd
6e2bc34
c933ea9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| This directory contains the images used on the stories page. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| CREATE TABLE stories ( | ||
| id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
| title TEXT NOT NULL, | ||
| publication_date TEXT NOT NULL, | ||
| contents_md TEXT NOT NULL, | ||
| optional_contents_md TEXT, | ||
| image TEXT, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should have a way to include more than one image ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. The carousel component is suitable for this type of need. The |
||
| website TEXT, | ||
| git_repository TEXT, | ||
| tags JSON | ||
| ); | ||
|
|
||
| INSERT INTO stories(title, publication_date, contents_md, optional_contents_md, image, website, git_repository, tags) VALUES | ||
| ( | ||
| 'Greater Lincolnshire species data bank', | ||
| '2025-11-20 21:15:00', | ||
| 'This is an SQLPage based system I''ve developed for the organisation I work for to collate information on species within our area, running on FreeBSD and MariaDB. Collating the information is still a work in progress, but there''s a complete example data sheet at https://glincsson.glnp.org.uk/view?taxon_list_item_key=NBNORG0000018213 which pulls in all the various elements of information and a complete group listing at https://glincsson.glnp.org.uk/taxon_group?taxon_group=60 showing various colour coding and indicators.', | ||
| 'SQLPage has made it trivial to implement this and allowed us to easily add in new aspects based on feedback from others. Most of it is stock SQLPage, but there are a couple of simple modified/custom components, with some custom javascript to allow saving png images of the maps. Its something we''ve long been wanted to do and have attempted in various guises over the years but using SQLPage is the first time we''ve been able to achieve exactly what we wanted (and more). And it''s been fun!', | ||
|
Comment on lines
+17
to
+18
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the stories should either be in the third person, or be clearly signed by their author
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree. The text is just an example to present the addition of the success stories page. We need to define how users will submit their content. By email? |
||
| 'glsdb.jpg', | ||
| 'https://glincsson.glnp.org.uk', | ||
| NULL, | ||
| '["MariaDB"]' | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <h1 class="mt-2 mb-0"><a href="stories.sql?id={{id}}">{{title}}</a></h1> | ||
| <div class="remove-bottom-margin markdown mb-4"> | ||
| <span class="badge bg-grey-lt text-grey-lt-fg">{{publication_date}}</span> | ||
|
|
||
| <div> | ||
| {{ ~#each (to_array tags) }} | ||
| <a href="stories?filter={{this}}" class="badge bg-yellow-lt">{{this}}</a> | ||
| {{~/each}} | ||
| </div> | ||
|
|
||
| <span remove-bottom-margin> | ||
| {{{~markdown truncated_contents~}}}<a href="stories?id={{id}}{{#if filter neq ''}}&filter={{filter}}{{/if}}">Read the story</a> | ||
| </span> | ||
| </div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <h1 class="mt-2 mb-0">{{title}}</h1> | ||
|
|
||
| <div class="remove-bottom-margin markdown mb-4"> | ||
| <span class="badge bg-gray-lt text-white-lt-fg">{{publication_date}}</span> | ||
| {{{~markdown contents_md~}}} | ||
| </div> | ||
|
|
||
| {{#if image}} | ||
| <div class="card my-2 col-md-6 mx-auto"><img src="assets/stories/{{image}}" alt="image"></div> | ||
| {{/if}} | ||
|
|
||
| {{#if optional_contents_md}} | ||
| <div class="remove-bottom-margin markdown mb-4">{{{~markdown optional_contents_md~}}}</div> | ||
| {{/if}} | ||
|
|
||
| <div class="remove-bottom-margin mb-4"> | ||
| {{#if website}}<a href="{{website}}" class="badge bg-yellow-lt">{{website}}</a>{{/if}} | ||
| {{#if git_repository}}<a href="{{git_repository}}" class="badge bg-green-lt">{{git_repository}}</a>{{/if}} | ||
| </div> | ||
|
|
||
| <div class="text-center"> | ||
| <a href='stories{{#if filter neq=''}}?filter={{filter}}{{/if}}'>Back</a> | ||
| </div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| SELECT 'http_header' AS component, | ||
| 'no-store, no-cache, must-revalidate, max-age=0' AS "Cache-Control", | ||
| 'no-cache' AS "pragma", | ||
| '0' AS "expires", | ||
| '<https://sql-page.com/safety>; rel="canonical"' AS "Link"; | ||
|
||
|
|
||
| SELECT 'dynamic' AS component, json_patch(json_extract(properties, '$[0]'), json_object( | ||
| 'title', 'SQLPage Success Stories' | ||
| )) AS properties | ||
| FROM example WHERE component = 'shell' LIMIT 1; | ||
|
|
||
| SET TEXT_MAX_LENGTH = 300; | ||
|
|
||
| SELECT | ||
| 'alert' AS component, | ||
| CONCAT('You have selected the "', $filter, '" filter.') AS title, | ||
| 'filter' AS icon, | ||
| 'teal' AS color, | ||
| TRUE AS dismissible, | ||
| '[Click here to deactivate it.](stories)' AS description_md | ||
| WHERE $id IS NULL | ||
| AND $filter IS NOT NULL | ||
|
|
||
| SELECT | ||
| 'stories' AS component, | ||
| $filter AS filter, | ||
| id, | ||
| title, | ||
| publication_date, | ||
| tags, | ||
| CASE | ||
| WHEN LENGTH(contents_md) > CAST($EXT_MAX_LENGTH AS INTEGER) THEN SUBSTR(contents_md, 1, CAST($TEXT_MAX_LENGTH AS INTEGER)) || '...' | ||
| ELSE contents_md | ||
| END as truncated_contents | ||
| FROM stories | ||
| WHERE | ||
| $id IS NULL | ||
| AND ($filter IS NULL OR EXISTS (SELECT 1 FROM json_each(tags) WHERE value LIKE $filter COLLATE NOCASE)) | ||
| ORDER BY publication_date DESC; | ||
|
|
||
| SELECT | ||
| 'story' AS component, | ||
|
Comment on lines
+23
to
+41
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we have a single component with top level and row level props instead of two components ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that the two components serve two different purposes with two different layouts. Using components here allows for a single page to display the list of success stories and the content of a success story. This reduces the amount of code and makes the stories page easier to maintain. It's also a nice little demo of logic implemented in SQL with filtering and context. |
||
| $filter AS filter, | ||
| id, | ||
| title, | ||
| publication_date, | ||
| contents_md, | ||
| optional_contents_md, | ||
| image, | ||
| website, | ||
| git_repository | ||
| FROM stories | ||
| WHERE id = $id; | ||
Uh oh!
There was an error while loading. Please reload this page.