Skip to content

Commit

Permalink
editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Produit committed Dec 10, 2018
1 parent 2a5fc13 commit f2bad9c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 10 additions & 1 deletion ckanext-editor/ckanext/editor/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,16 @@ def setup_template_variables(self, context, data_dict):
for tag in root.iter():
tag_list.append(tag.tag)

data = json.dumps(xmltodict.parse(open(file_path, 'r').read())
a=xmltodict.parse(open(file_path, 'r').read())
b = {}
for i in a:
b[i] = {
'id' : 'node_2',
'text' : 'Root node with options',
'state' : { 'opened' : true, 'selected' : true },
'children' : [ { 'text' : 'Child 1' }, 'Child 2']
}
data = json.dumps()

return {'root': root, 'tree': tree, 'treeview': Markup(treeview), 'tag_list': tag_list, 'data': data}

9 changes: 5 additions & 4 deletions ckanext-editor/ckanext/editor/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
<script>
var schema = [];
console.log({{data}})
console.log({{ data |safe }})

function getCheckedBoxes() {
var treeview = document.getElementById("treeview");
var ul = treeview.getElementsByTagName("ul");
Expand All @@ -38,11 +39,11 @@
}
function term() {
var input = document.getElementById("input-script");
var output = eval(input.value)
var output = input.value
document.getElementById('output-script').innerHTML = output;
}
$(function () {
$("#jstree_demo_div").jstree({
$("#jstree").jstree({
"checkbox" : {
"keep_selected_style" : false
},
Expand All @@ -54,7 +55,7 @@

<!------------------------ Main ----------------------->

<div id="jstree_demo_div"></div>

<div class="container-fluid bg-white border rounded p-3">
<h2> Column selection </h2>
Select columns from the original:
Expand Down

0 comments on commit f2bad9c

Please sign in to comment.