Skip to content

Commit f02623e

Browse files
authored
Material Theme (#13)
* material theme * first pass at codemeta generation form * add download action on submit
1 parent afc6e2b commit f02623e

File tree

353 files changed

+51171
-26861
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

353 files changed

+51171
-26861
lines changed

config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
theme = "hugo-now-ui"
1+
theme = "hugo-material"
22
baseurl = "/"
33
relativeurls = true
44
title = "The CodeMeta Project"
@@ -41,7 +41,7 @@ publishDir = "../website"
4141
[params]
4242
name = "codemeta"
4343
github = "codemeta"
44-
custom_css = ["cboettig.css"]
44+
#custom_css = ["cboettig.css"]
4545
repo = "codemeta.github.io"
4646
background = "img/pyramids.jpg"
4747

content/create.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "Create a CodeMeta file"
3+
#layout: login
4+
---
5+
6+
{{< react-schema >}}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<div id="app"></div>
2+
3+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.4.2/umd/react.production.min.js"></script>
4+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.4.2/umd/react-dom.production.min.js"></script>
5+
<script src="https://unpkg.com/react-jsonschema-form/dist/react-jsonschema-form.js"></script>
6+
<script type="text/javascript" src="/schema.json"></script>
7+
<script type="text/javascript" src="/uiSchema.json"></script>
8+
9+
<script>
10+
const Form = JSONSchemaForm.default;
11+
12+
13+
14+
const formData= {
15+
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
16+
"@type": "SoftwareSouceCode"
17+
}
18+
19+
const log = (type) => console.log.bind(console, type);
20+
21+
function saveData(data, fileName) {
22+
log("submitted")
23+
var content = JSON.stringify(data, null, 2);
24+
var a = document.createElement("a");
25+
var file = new Blob([content], {type: "application/json"});
26+
a.href = URL.createObjectURL(file);
27+
a.download = fileName;
28+
a.click();
29+
};
30+
const onSubmit = ({formData}) => saveData(formData, "codemeta.json");
31+
32+
33+
var fileName = "codemeta.json";
34+
ReactDOM.render(React.createElement(Form, {
35+
schema: schema,
36+
uiSchema: uiSchema,
37+
formData: formData,
38+
onChange: log("changed"),
39+
onSubmit: onSubmit,
40+
onError: log("errors")
41+
}), document.getElementById("app"));
42+
43+
44+
45+
46+
47+
</script>

static/SoftwareSourceCode.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
const schema = {
2+
"id": "SoftwareSourceCode.json",
3+
"title": "SoftwareSourceCode",
4+
"format": "http://schema.org/SoftwareSourceCode",
5+
"media": {"type": "application/json;profile=http://schema.org/SoftwareSourceCode"},
6+
"type": "object",
7+
"properties": {
8+
9+
10+
"codeRepository": {
11+
"type": "array",
12+
"items": {
13+
"type": "string",
14+
"format": "uri",
15+
"links": [{
16+
"rel": "http://schema.org/codeRepository",
17+
"href": "{+$}",
18+
"linkSource": 2
19+
}]
20+
}
21+
},
22+
"programmingLanguage": {"type": "string"},
23+
"targetProduct": {"type": "string"},
24+
"runtimePlatform": {
25+
"description": "Runtime platform or script interpreter dependencies (Example - Java v1, Python2.3, .Net Framework 3.0)",
26+
"type": "string"
27+
},
28+
29+
30+
"sameAs": {
31+
"type": "array",
32+
"items": {
33+
"type": "string",
34+
"format": "uri"
35+
}
36+
},
37+
"url": {
38+
"type": "string",
39+
"format": "uri"
40+
},
41+
"description": {
42+
"title": "Description",
43+
"description": "A short description of the item.",
44+
"type": "string"
45+
},
46+
"name": {
47+
"title": "Name",
48+
"description": "The name of the item.",
49+
"type": "string"
50+
}
51+
}
52+
};

static/example.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const schema = {
2+
title: "A registration form",
3+
description: "A simple form example.",
4+
type: "object",
5+
required: ["firstName", "lastName"],
6+
properties: {
7+
firstName: {
8+
type: "string",
9+
title: "First name",
10+
default: "Chuck",
11+
},
12+
lastName: {
13+
type: "string",
14+
title: "Last name",
15+
},
16+
age: {
17+
type: "integer",
18+
title: "Age",
19+
},
20+
bio: {
21+
type: "string",
22+
title: "Bio",
23+
},
24+
password: {
25+
type: "string",
26+
title: "Password",
27+
minLength: 3,
28+
},
29+
telephone: {
30+
type: "string",
31+
title: "Telephone",
32+
minLength: 10,
33+
},
34+
},
35+
};
36+

static/img/untitled folder/R.png

16 KB
Loading
45.4 KB
Loading
22.5 KB
Loading
8.42 KB
Loading
145 KB
Loading

0 commit comments

Comments
 (0)