Skip to content

Commit ac001b9

Browse files
Added tags component to support free response list
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
1 parent 6e9f0cf commit ac001b9

3 files changed

Lines changed: 57 additions & 4 deletions

File tree

js/generateFormComponents.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ function transformArrayToOptions(arr) {
2424

2525
function determineType(field) {
2626
if (field.type === "array") {
27-
// TODO: Implement multi-select fields
27+
// Multi-select
2828
if (field.items.hasOwnProperty("enum")) {
2929
return "selectboxes";
3030
}
31-
return "array-textfield";
31+
// Free response list
32+
return "tags";
3233
} else if (field.hasOwnProperty("enum")) {
34+
// Single select
3335
return "radio";
3436
} else if (field.type === "number") {
3537
return "number";
@@ -51,6 +53,17 @@ function createComponent(fieldName, fieldObject) {
5153
tooltip: fieldObject["description"],
5254
description: fieldObject["description"],
5355
};
56+
case "tags":
57+
return {
58+
label: fieldName,
59+
tableView: false,
60+
storeas: "array",
61+
validateWhenHidden: false,
62+
key: fieldName,
63+
type: "tags",
64+
input: true,
65+
description: fieldObject["description"]
66+
};
5467
case "number":
5568
return {
5669
label: fieldName,
@@ -80,6 +93,7 @@ function createComponent(fieldName, fieldObject) {
8093
key: fieldName,
8194
type: "radio",
8295
input: true,
96+
description: fieldObject["description"]
8397
};
8498
case "selectboxes":
8599
var options = transformArrayToOptions(fieldObject.items.enum);
@@ -93,7 +107,8 @@ function createComponent(fieldName, fieldObject) {
93107
key: fieldName,
94108
type: "selectboxes",
95109
input: true,
96-
inputType: "checkbox"
110+
inputType: "checkbox",
111+
description: fieldObject["description"]
97112
};
98113
default:
99114
break;

schemas/schema.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,40 @@
4646
"type": "string",
4747
"enum": ["web", "windows", "mac", "linux", "ios", "android", "other"]
4848
}
49+
},
50+
"categories": {
51+
"type": "array",
52+
"description": "Categories the project belongs to. Select from: https://yml.publiccode.tools/categories-list.html",
53+
"items": {
54+
"type": "string"
55+
}
56+
},
57+
"softwareType": {
58+
"type": "string",
59+
"description": "Type of software",
60+
"enum": [
61+
"standalone/mobile",
62+
"standalone/iot",
63+
"standalone/desktop",
64+
"standalone/web",
65+
"standalone/backend",
66+
"standalone/other",
67+
"addon",
68+
"library",
69+
"configurationFiles"
70+
]
71+
},
72+
"languages": {
73+
"type": "array",
74+
"description": "Programming languages that make up the codebase",
75+
"items": {
76+
"type": "string"
77+
}
78+
},
79+
"maintenance": {
80+
"type": "string",
81+
"description": "Maintenance status",
82+
"enum": ["internal", "contract", "community", "none"]
4983
}
5084
}
5185
}

schemas/template-code.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@
55
"organization": "",
66
"vcs": "",
77
"laborHours": 0,
8-
"platforms": [ "" ]
8+
"platforms": [""],
9+
"categories": [""],
10+
"softwareType": [""],
11+
"languages": [""],
12+
"maintenance": ""
913
}

0 commit comments

Comments
 (0)