Skip to content
Permalink
Browse files

Updated "tag" field for data to "type" (to match backend). Updated mo…

…ck data for testing. Updated application in in bower.json.
  • Loading branch information...
Alex Garcia
Alex Garcia committed Nov 20, 2018
1 parent 0ddc252 commit 42a7f95d6464dafb2115f5e9737f84eb6ccab00c
Showing with 114 additions and 94 deletions.
  1. +108 −88 app/index.html
  2. +5 −5 app/scripts/main.js
  3. +1 −1 bower.json
@@ -77,103 +77,123 @@ <h3 class="text-center">
</script>

<script>
window.__INITIAL_STATE__ = {
"data": [
{
"id": 1,
"title": "Fruit",
"tag": "topic",
"parent_id": null
},
{
"id": 42,
"title": "Fruit is good for you",
"tag": "thought",
"parent_id": 1
},
{
"id": 43,
"title": "Fruit is bad for you",
"tag": "thought",
"parent_id": 42
},
{
"id": 4,
"title": "Eat",
"tag": "action",
"parent_id": 1
},
{
"id": 5,
"title": "Give",
"tag": "action",
"parent_id": 1
},
{
"id": 6,
"title": "Plant",
"tag": "action",
"parent_id": 1
},
{
"id": 7,
"title": "Preserve",
"tag": "action",
"parent_id": 1
},
{
"id": 8,
"title": "Refrigerator",
"tag": "need",
"parent_id": 7
},
{
"id": 59,
"title": "Temperature Control",
"tag": "need",
"parent_id": 8
},
{
"id": 10,
"title": "Squash",
"tag": "action",
"parent_id": 1
},
{
"id": 11,
"title": "Ferment",
"tag": "action",
"parent_id": 1
},
{
"id": 12,
"title": "Cook",
"tag": "action",
"parent_id": 1
},
{
"id": 13,
"title": "Refine",
"tag": "action",
"parent_id": 1
"id": 1,
"title": "U4U",
"label": "Distributed Network System for Distributed and Open Deliberation",
"type": "topic",
"parent_id": null,
"lft": 1,
"rght": 8,
"created": "2018-11-07T07:17:27+00:00",
"modified": "2018-11-20T04:00:43+00:00",
"user_id": 1,
"user": {
"id": 1,
"email": "",
"created": "2018-11-07T07:07:27+00:00",
"modified": "2018-11-07T07:07:27+00:00",
"username": "admin"
},
"parent_node": null
},
{
"id": 14,
"title": "Food",
"tag": "topic",
"parent_id": 1
"id": 4,
"title": "Modules",
"label": "U4U user interfaces for persuances\u0027 specific needs",
"type": "topic",
"parent_id": 1,
"lft": 2,
"rght": 5,
"created": "2018-11-20T03:00:58+00:00",
"modified": "2018-11-20T03:00:58+00:00",
"user_id": 1,
"user": {
"id": 1,
"email": "",
"created": "2018-11-07T07:07:27+00:00",
"modified": "2018-11-07T07:07:27+00:00",
"username": "admin"
},
"parent_node": {
"id": 1,
"title": "U4U",
"label": "Distributed Network System for Distributed and Open Deliberation",
"type": "topic",
"parent_id": null,
"lft": 1,
"rght": 8,
"created": "2018-11-07T07:17:27+00:00",
"modified": "2018-11-20T04:00:43+00:00",
"user_id": 1
}
},
{
"id": 15,
"title": "Alex Garcia",
"tag": "person",
"parent_id": 14
"id": 5,
"title": "U4U Module",
"label": "U4U module from USHIN, Inc., introducing the USHIN Semantic Screen.",
"type": "topic",
"parent_id": 4,
"lft": 3,
"rght": 4,
"created": "2018-11-20T03:58:47+00:00",
"modified": "2018-11-20T04:02:01+00:00",
"user_id": 1,
"user": {
"id": 1,
"email": "",
"created": "2018-11-07T07:07:27+00:00",
"modified": "2018-11-07T07:07:27+00:00",
"username": "admin"
},
"parent_node": {
"id": 4,
"title": "Modules",
"label": "U4U user interfaces for persuances\u0027 specific needs",
"type": "topic",
"parent_id": 1,
"lft": 2,
"rght": 5,
"created": "2018-11-20T03:00:58+00:00",
"modified": "2018-11-20T03:00:58+00:00",
"user_id": 1
}
},
{
"id": 16,
"title": "Big fan of food",
"tag": "feeling",
"parent_id": 15
"id": 6,
"title": "Backend",
"label": "Backend service for U4U Distributed Network System",
"type": "topic",
"parent_id": 1,
"lft": 6,
"rght": 7,
"created": "2018-11-20T04:01:32+00:00",
"modified": "2018-11-20T04:01:32+00:00",
"user_id": 1,
"user": {
"id": 1,
"email": "",
"created": "2018-11-07T07:07:27+00:00",
"modified": "2018-11-07T07:07:27+00:00",
"username": "admin"
},
"parent_node": {
"id": 1,
"title": "U4U",
"label": "Distributed Network System for Distributed and Open Deliberation",
"type": "topic",
"parent_id": null,
"lft": 1,
"rght": 8,
"created": "2018-11-07T07:17:27+00:00",
"modified": "2018-11-20T04:00:43+00:00",
"user_id": 1
}
}
]
};
@@ -48,8 +48,8 @@
function traverseNodes(nodes, rootNode) {
var output = '';
output += '<ul><li>';
output += '<a ' + ((rootNode.id === selectedNode.id) ? 'class="selected" ' : '') + 'href="#!/' + rootNode.id + '" data-id="' + rootNode.id + '" data-tag="' + rootNode.tag +'">';
output += '<img style="height: 12px;" alt="" src="images/' + pluralize(rootNode.tag) + '.png" /> ' + rootNode.title;
output += '<a ' + ((rootNode.id === selectedNode.id) ? 'class="selected" ' : '') + 'href="#!/' + rootNode.id + '" data-id="' + rootNode.id + '" data-type="' + rootNode.type +'">';
output += '<img style="height: 12px;" alt="" src="images/' + pluralize(rootNode.type) + '.png" /> ' + rootNode.title;
output += '</a>';
nodes.filter(node => node.parent_id === rootNode.id).forEach(currentNode => {
output += traverseNodes(nodes, currentNode);
@@ -72,11 +72,11 @@

$(el).html('<div id="semui-view-region-focus"><span class="focus">' + selectedNode.title + '</span></div>');

['merit', 'person', 'action', 'topic', 'need', 'feeling', 'thought', 'fact'].forEach(tag => {
['merit', 'person', 'action', 'topic', 'need', 'feeling', 'thought', 'fact'].forEach(type => {
var template = $('#semuiViewRegionTemplate').html();
var rendered = Mustache.render(template, {
regionName: pluralize(tag),
nodes: nodesToRender.filter(node => node.tag === tag)
regionName: pluralize(type),
nodes: nodesToRender.filter(node => node.type === type)
});
$(el).append(rendered);
});
@@ -1,5 +1,5 @@
{
"name": "cui-interface",
"name": "u4u-interface",
"private": true,
"dependencies": {
"bootstrap-sass": "~3.3.5",

0 comments on commit 42a7f95

Please sign in to comment.
You can’t perform that action at this time.