proper input form for UNESCO WHS

This commit is contained in:
Mateusz Konieczny 2022-09-24 12:37:58 +02:00
parent b80cdb23b4
commit cea4bad4e4
8 changed files with 19 additions and 24 deletions

View File

@ -185,7 +185,7 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true, edit: true,
verify: true, verify: true,
}, },
planning_world_list_url: { planning_world_list_id: {
edit: true, edit: true,
verify: true, verify: true,
}, },

View File

@ -206,23 +206,24 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
user_verified_as={props.user_verified.planning_local_list_url} user_verified_as={props.user_verified.planning_local_list_url}
verified_count={props.building.verified.planning_local_list_url} verified_count={props.building.verified.planning_local_list_url}
/> />
<DataEntry <NumericDataEntryWithFormattedLink
title={dataFields.planning_world_list_url.title} title={dataFields.planning_world_list_id.title}
slug="planning_world_list_url" slug="planning_world_list_id"
value={props.building.planning_world_list_url} value={props.building.planning_world_list_id}
mode={props.mode} mode={props.mode}
copy={props.copy} copy={props.copy}
onChange={props.onChange} onChange={props.onChange}
isUrl={true} placeholder="If yes, add ID"
placeholder="https://..." linkTargetFunction={(id: String) => { return "https://whc.unesco.org/en/list/" + id } }
linkDescriptionFunction={(id: String) => { return "ID Link" } }
/> />
<Verification <Verification
slug="planning_world_list_url" slug="planning_world_list_id"
allow_verify={props.user !== undefined && props.building.planning_world_list_url !== null && !props.edited} allow_verify={props.user !== undefined && props.building.planning_world_list_id !== null && !props.edited}
onVerify={props.onVerify} onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_world_list_url")} user_verified={props.user_verified.hasOwnProperty("planning_world_list_id")}
user_verified_as={props.user_verified.planning_world_list_url} user_verified_as={props.user_verified.planning_world_list_id}
verified_count={props.building.verified.planning_world_list_url} verified_count={props.building.verified.planning_world_list_id}
/> />
<DataEntry <DataEntry

View File

@ -476,10 +476,10 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
example: "", example: "",
//tooltip: , //tooltip: ,
}, },
planning_world_list_url: { planning_world_list_id: {
category: Category.Planning, category: Category.Planning,
title: "Is it within a <a href=\"https://historicengland.org.uk/advice/hpg/has/whs/\" target=\"_blank\">World Heritage Site</a>?", title: "Is it within a <a href=\"https://historicengland.org.uk/advice/hpg/has/whs/\" target=\"_blank\">World Heritage Site</a>?",
example: "", example: "488",
//tooltip: , //tooltip: ,
}, },
planning_glher_url: { planning_glher_url: {

View File

@ -146,7 +146,7 @@ const LAYER_QUERIES = {
WHEN planning_list_grade = 'II' THEN 'Grade II Listed' WHEN planning_list_grade = 'II' THEN 'Grade II Listed'
WHEN planning_local_list_url <> '' THEN 'Locally Listed' WHEN planning_local_list_url <> '' THEN 'Locally Listed'
WHEN planning_heritage_at_risk_url <> '' THEN 'Heritage at Risk' WHEN planning_heritage_at_risk_url <> '' THEN 'Heritage at Risk'
WHEN planning_world_list_url <> '' THEN 'In World Heritage Site' WHEN planning_world_list_id IS NOT NULL THEN 'In World Heritage Site'
WHEN planning_in_apa_url <> '' THEN 'In Archaeological Priority Area' WHEN planning_in_apa_url <> '' THEN 'In Archaeological Priority Area'
ELSE 'None' ELSE 'None'
END END
@ -157,7 +157,7 @@ const LAYER_QUERIES = {
planning_list_grade IS NOT NULL planning_list_grade IS NOT NULL
OR planning_in_conservation_area_url <> '' OR planning_in_conservation_area_url <> ''
OR planning_local_list_url <> '' OR planning_local_list_url <> ''
OR planning_world_list_url <> '' OR planning_world_list_id IS NOT NULL
OR planning_heritage_at_risk_url <> '' OR planning_heritage_at_risk_url <> ''
OR planning_in_apa_url <> '' OR planning_in_apa_url <> ''
`, `,

View File

@ -75,7 +75,7 @@ This is the main table, containing almost all data collected by Colouring London
- `planning_in_conservation_area_url`: conservation area data source link - `planning_in_conservation_area_url`: conservation area data source link
- `planning_list_grade`: National Heritage List for England listing grade - `planning_list_grade`: National Heritage List for England listing grade
- `planning_heritage_at_risk_url`: Heritage at Risk link - `planning_heritage_at_risk_url`: Heritage at Risk link
- `planning_world_list_url`: UNESCO World Heritage list id - `planning_world_list_id`: UNESCO World Heritage list id
- `planning_glher_url`: Greater London Historic Environment Record link - `planning_glher_url`: Greater London Historic Environment Record link
- `planning_in_apa_url`: an Archeological Priority Area (APA) link - `planning_in_apa_url`: an Archeological Priority Area (APA) link
- `planning_local_list_url`: local list reference link - `planning_local_list_url`: local list reference link

View File

@ -48,7 +48,7 @@ COPY (SELECT
planning_list_cat, planning_list_cat,
planning_list_grade, planning_list_grade,
planning_heritage_at_risk_url, planning_heritage_at_risk_url,
planning_world_list_url, planning_world_list_id,
planning_glher_url, planning_glher_url,
planning_in_apa_url, planning_in_apa_url,
planning_local_list_url, planning_local_list_url,

View File

@ -5,9 +5,6 @@ ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_nhle_link text[];
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_apa_url; ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_apa_url;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_apa boolean DEFAULT FALSE; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_apa boolean DEFAULT FALSE;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_world_list_url;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_world_list_id int DEFAULT NULL;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_heritage_at_risk_url; ALTER TABLE buildings DROP COLUMN IF EXISTS planning_heritage_at_risk_url;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_heritage_at_risk_id int DEFAULT NULL; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_heritage_at_risk_id int DEFAULT NULL;

View File

@ -13,9 +13,6 @@ ALTER TABLE buildings DROP COLUMN IF EXISTS planning_nhle_link;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_apa; ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_apa;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_apa_url VARCHAR DEFAULT ''; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_apa_url VARCHAR DEFAULT '';
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_world_list_id;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_world_list_url VARCHAR DEFAULT '';
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_heritage_at_risk_id; ALTER TABLE buildings DROP COLUMN IF EXISTS planning_heritage_at_risk_id;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_heritage_at_risk_url VARCHAR DEFAULT ''; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_heritage_at_risk_url VARCHAR DEFAULT '';