add a checkbox example
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
select 'form' as component;
|
||||
select 'text' as type, 'Username' as name, username as value
|
||||
from users where id = $id;
|
||||
update users
|
||||
set username = :Username,
|
||||
is_admin = :Administrator is not null
|
||||
where :Username is not null and id = $id;
|
||||
|
||||
update users set username = :Username
|
||||
where id = $id and :Username is not null;
|
||||
select 'form' as component;
|
||||
select 'text' as type, 'Username' as name, username as value from users where id = $id;
|
||||
select 'checkbox' as type, 'Has administrator privileges' as label, 'Administrator' as name, is_admin as checked from users where id = $id;
|
||||
@@ -15,6 +15,7 @@ SELECT 'list' AS component,
|
||||
'Users' AS title;
|
||||
SELECT username AS title,
|
||||
username || ' is a user on this website.' as description,
|
||||
case when is_admin then 'red' end as color,
|
||||
'user' as icon,
|
||||
'user.sql?id=' || id as link
|
||||
FROM users;
|
||||
@@ -1,4 +1,5 @@
|
||||
CREATE TABLE users (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
username TEXT NOT NULL
|
||||
username TEXT NOT NULL,
|
||||
is_admin BOOLEAN NOT NULL DEFAULT FALSE
|
||||
);
|
||||
Reference in New Issue
Block a user