Last active
June 2, 2016 10:52
-
-
Save janbrohl/0c9aa1c8d026b7b5e4e4cd3c869e42f5 to your computer and use it in GitHub Desktop.
CKAN Editor from Schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Basic CKAN Editor</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.js" type="text/javascript"> | |
</script> | |
<link crossorigin="anonymous" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" rel="stylesheet"> | |
<link crossorigin="anonymous" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" rel="stylesheet"> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"> | |
</script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/json-editor/0.7.25/jsoneditor.js" type="text/javascript"> | |
</script> | |
</head> | |
<body> | |
<h1>Basic CKAN Editor</h1> | |
<div id='editor_holder'></div><button id='submit'>Show Result</button> | |
<script> | |
var editor = new JSONEditor(document.getElementById('editor_holder'),{ | |
theme:"bootstrap3", | |
ajax:true, | |
schema: {"$ref":"https://raw.githubusercontent.com/KSP-CKAN/CKAN/v1.16.1/CKAN.schema"} | |
}); | |
// Hook up the submit button | |
document.getElementById('submit').addEventListener('click',function() { | |
// Get the value from the editor | |
var v=editor.getValue(); | |
console.log(v); | |
alert(JSON.stringify(v,null,1)); | |
}); | |
</script> | |
<p>Thrown together by Jan Brohl 2016. License: <a href="https://opensource.org/licenses/mit-license.php">MIT</a></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment