Skip to content

Commit 260fb1b

Browse files
committed
update form info
1 parent d95a9e2 commit 260fb1b

File tree

2 files changed

+75
-7
lines changed

2 files changed

+75
-7
lines changed

content/create.html

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: "Create a CodeMeta file"
3+
#layout: login
4+
---
5+
6+
<div class="section">
7+
8+
<div class="alert alert-warning">
9+
<div class="container-fluid">
10+
<div class="alert-icon">
11+
<i class="material-icons">warning</i>
12+
</div>
13+
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
14+
<span aria-hidden="true"><i class="material-icons">clear</i></span>
15+
</button>
16+
<b>Warning:</b> This generator is an experimental beta!
17+
</div>
18+
</div>
19+
</div>
20+
21+
To get started creating a codemeta file, simply fill out the fields below. While all fields are recommended, there are no strictly required fields in the standard at this time. When you hit the "submit" button, the form will validate the fields provided and allow you save your <code>codemeta.json</code> to your computer.
22+
23+
24+
<div class="section">
25+
<div id="app"></div>
26+
27+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.4.2/umd/react.production.min.js"></script>
28+
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.4.2/umd/react-dom.production.min.js"></script>
29+
<script src="https://unpkg.com/react-jsonschema-form/dist/react-jsonschema-form.js"></script>
30+
<script type="text/javascript" src="/schema.json"></script>
31+
<script type="text/javascript" src="/uiSchema.json"></script>
32+
33+
<script>
34+
const Form = JSONSchemaForm.default;
35+
36+
37+
38+
const formData= {
39+
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
40+
"@type": "SoftwareSourceCode"
41+
}
42+
43+
const log = (type) => console.log.bind(console, type);
44+
45+
function saveData(data, fileName) {
46+
log("submitted")
47+
var content = JSON.stringify(data, null, 2);
48+
var a = document.createElement("a");
49+
var file = new Blob([content], {type: "application/json"});
50+
a.href = URL.createObjectURL(file);
51+
a.download = fileName;
52+
a.click();
53+
};
54+
const onSubmit = ({formData}) => saveData(formData, "codemeta.json");
55+
56+
57+
var fileName = "codemeta.json";
58+
ReactDOM.render(React.createElement(Form, {
59+
schema: schema,
60+
uiSchema: uiSchema,
61+
formData: formData,
62+
onChange: log("changed"),
63+
onSubmit: onSubmit,
64+
onError: log("errors")
65+
}), document.getElementById("app"));
66+
67+
68+
</script>
69+
</div>
70+
71+
<div class="section">
72+
Note that the full codemeta specification allows for many more fields than indicated here.
73+
74+
Data entered in this from remains on your own computer and is not submitted to any central server. The CodeMeta project recommends adding your <code>codemeta.json</code> file to the source code repository of your software.
75+
</div>

content/create.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)