mirror of
https://github.com/okxlin/appstore.git
synced 2026-10-30 16:05:49 +00:00
fix(sqlpage): restore 0.46.3 starter assets
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
create table todos(
|
||||
id integer primary key,
|
||||
title text not null,
|
||||
created_at timestamp default current_timestamp
|
||||
);
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"database_url": "sqlite:///var/www/sqlpage.db?mode=rwc"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
delete from todos
|
||||
where id = $todo_id and $confirm = 'yes'
|
||||
returning
|
||||
'redirect' as component,
|
||||
'/' as link;
|
||||
|
||||
select 'dynamic' as component, sqlpage.run_sql('shell.sql') as properties;
|
||||
|
||||
select
|
||||
'alert' as component,
|
||||
'red' as color,
|
||||
'Confirm deletion' as title,
|
||||
'Are you sure you want to delete the following todo item?\n\n> ' || title as description_md,
|
||||
'?todo_id=' || $todo_id || '&confirm=yes' as link,
|
||||
'Delete' as link_text
|
||||
from todos where id = $todo_id;
|
||||
@@ -0,0 +1,20 @@
|
||||
select 'dynamic' as component, sqlpage.run_sql('shell.sql') as properties;
|
||||
|
||||
select 'list' as component,
|
||||
'Todo' as title,
|
||||
'No todo yet...' as empty_title;
|
||||
|
||||
select
|
||||
title,
|
||||
'todo_form.sql?todo_id=' || id as edit_link,
|
||||
'delete.sql?todo_id=' || id as delete_link
|
||||
from todos;
|
||||
|
||||
select
|
||||
'button' as component,
|
||||
'center' as justify;
|
||||
select
|
||||
'todo_form.sql' as link,
|
||||
'green' as color,
|
||||
'Add new todo' as title,
|
||||
'circle-plus' as icon;
|
||||
@@ -0,0 +1,4 @@
|
||||
select 'shell' as component,
|
||||
printf('Todo list (%d)', count(*)) as title,
|
||||
'timeline' as menu_item
|
||||
from todos;
|
||||
@@ -0,0 +1,12 @@
|
||||
select 'dynamic' as component, sqlpage.run_sql('shell.sql') as properties;
|
||||
|
||||
select 'timeline' as component;
|
||||
select
|
||||
title,
|
||||
'todo_form.sql?todo_id=' || id as link,
|
||||
created_at as date,
|
||||
'calendar' as icon,
|
||||
'green' as color,
|
||||
printf('%d days ago', julianday('now') - julianday(created_at)) as description
|
||||
from todos
|
||||
order by created_at desc;
|
||||
@@ -0,0 +1,22 @@
|
||||
insert or replace into todos(id, title)
|
||||
select $todo_id, :todo
|
||||
where :todo is not null
|
||||
returning
|
||||
'redirect' as component,
|
||||
'/' as link;
|
||||
|
||||
select 'dynamic' as component, sqlpage.run_sql('shell.sql') as properties;
|
||||
|
||||
select
|
||||
'form' as component,
|
||||
'Todo' as title,
|
||||
case when $todo_id is null then
|
||||
'Add new todo'
|
||||
else
|
||||
'Edit todo'
|
||||
end as validate;
|
||||
select
|
||||
'Todo item' as label,
|
||||
'todo' as name,
|
||||
'What do you have to do?' as placeholder,
|
||||
(select title from todos where id = $todo_id) as value;
|
||||
Reference in New Issue
Block a user