Skip to content
Permalink
Browse files

Merge pull request USHIN-Inc#1 from hiimalexjgarcia/master

Migrating codebase into Yeoman webapp scaffold.
  • Loading branch information...
HoldingHands committed Sep 20, 2018
2 parents 28d0fca + b2e0169 commit 0ddc252b6e605f638d5513545ea03f55e3620871
@@ -0,0 +1,5 @@
{
"presets": [
"es2015"
]
}
@@ -0,0 +1,3 @@
{
"directory": "bower_components"
}
@@ -0,0 +1,25 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]

# change these settings to your own preference
indent_style = space
indent_size = 2

# we recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[{package,bower}.json]
indent_style = space
indent_size = 2
@@ -0,0 +1 @@
* text=auto
@@ -0,0 +1,7 @@
node_modules
dist
.tmp
bower_components
test/bower_components
.vscode
.vs
@@ -0,0 +1,6 @@
{
"generator-mocha": {
"ui": "tdd",
"rjs": false
}
}
661 LICENSE

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
BIN +4.19 KB app/favicon.ico
Binary file not shown.
BIN +7.92 KB app/images/actions.png
Binary file not shown.
BIN +3.55 KB app/images/facts.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN +4.86 KB app/images/needs.png
Binary file not shown.
BIN +8.26 KB app/images/people.png
Binary file not shown.
Binary file not shown.
BIN +5.73 KB app/images/topics.png
Binary file not shown.
@@ -0,0 +1,215 @@
<!doctype html>
<html class="no-js" lang="">

<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>U2U Semantic Screen</title>
<!-- build:css styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="/bower_components/jQuery-contextMenu/dist/jquery.contextMenu.css" />
<!-- endbower -->
<!-- endbuild -->
<!-- build:css styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
<!-- build:js scripts/vendor/modernizr.js -->
<script src="/bower_components/modernizr/modernizr.js"></script>
<!-- endbuild -->
</head>

<body>

<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="text-center">U2U Semantic Screen</h1>
</div>
</div>
<div class="row">
<div class="col-md-4 collapse" id="collapseExample">
<div class="row">
<h3>Navigation</h3>
</div>
<div class="row">
<div class="well" id="semui-view-navigation">
<p>Node hierarchy goes here...</p>
</div>
</div>
</div>
<div class="col-md-12" id="UINavPane">
<div class="row">
<h3 class="text-center">
UI
<button id="showNavButton" class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
Show Navigation
</button>
</h3>
</div>
<div class="row">
<div id="semui-view-regions">
<div id="semui-view-region-focus">
<span class="focus">Focus node goes here...</span>
</div>
<div id="semui-view-region-merits"></div>
<div id="semui-view-region-people"></div>
<div id="semui-view-region-actions"></div>
<div id="semui-view-region-topics"></div>
<div id="semui-view-region-needs"></div>
<div id="semui-view-region-feelings"></div>
<div id="semui-view-region-thoughts"></div>
<div id="semui-view-region-facts"></div>
</div>
</div>
</div>
</div>
</div>

<script id="semuiViewRegionTemplate" type="x-tmpl-mustache">
<div id="semui-view-region-{{ regionName }}" class="semui-view-region-editable">
<ul>
{{#nodes}}
<li><a href="#!/{{id}}" data-id="{{id}}" data-tag="{{tag}}">{{title}}</a></li>
{{/nodes}}
</ul>
</div>
</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": 14,
"title": "Food",
"tag": "topic",
"parent_id": 1
},
{
"id": 15,
"title": "Alex Garcia",
"tag": "person",
"parent_id": 14
},
{
"id": 16,
"title": "Big fan of food",
"tag": "feeling",
"parent_id": 15
}
]
};
</script>

<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>

<!-- build:js scripts/vendor.js -->
<!-- bower:js -->
<script src="/bower_components/jquery/dist/jquery.js"></script>
<script src="/bower_components/jQuery-contextMenu/dist/jquery.contextMenu.js"></script>
<script src="/bower_components/pluralize/pluralize.js"></script>
<script src="/bower_components/mustache.js/mustache.js"></script>
<!-- endbower -->
<!-- endbuild -->

<!-- build:js scripts/plugins.js -->
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/affix.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/alert.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/dropdown.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/tooltip.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/modal.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/transition.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/button.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/popover.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/carousel.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/scrollspy.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/collapse.js"></script>
<script src="/bower_components/bootstrap-sass/assets/javascripts/bootstrap/tab.js"></script>
<!-- endbuild -->

<script>if (window.module) module = window.module;</script>

<!-- build:js scripts/main.js -->
<script src="scripts/main.js"></script>
<!-- endbuild -->
</body>

</html>
@@ -0,0 +1,4 @@
# robotstxt.org/

User-agent: *
Disallow:
@@ -0,0 +1,112 @@
(function($, window){

var nodes = window.__INITIAL_STATE__.data || [{}];

// Check if route is valid, otherwise set route to root node ID
if (location.hash === '') {
var rootNode = nodes.find(node => node.parent_id === null);
if (rootNode) {
window.history.replaceState(null, null, '#!/' + rootNode.id);
}
}

// Render the node collection
renderSemUINav(nodes, '#semui-view-navigation');
renderSemUIRegions(nodes, '#semui-view-regions');

// enable collapsible navigation column
$('#collapseExample').on('hidden.bs.collapse', function () {
console.log('navigation hidden...');
$('#showNavButton').html('Show Navigation');
$('#UINavPane').removeClass('col-md-8');
$('#UINavPane').addClass('col-md-12');
});
$('#collapseExample').on('show.bs.collapse', function () {
console.log('showing navigation...');
$('#showNavButton').html('Hide Navigation');
$('#UINavPane').removeClass('col-md-12');
$('#UINavPane').addClass('col-md-8');
})

// Listen for route changes and re-render
$(window).on('hashchange', function(e) {
renderSemUINav(nodes, '#semui-view-navigation');
renderSemUIRegions(nodes, '#semui-view-regions');
});


// Render functions
function renderSemUINav(nodes, el) {
var selectedNodeID = location.hash.replace('#!/', '');
var selectedNode = nodes.find(node => node.id.toString() === selectedNodeID);
var rootNode = nodes.find(node => node.parent_id === null);

if (rootNode) {
$(el).html(traverseNodes(nodes, rootNode));
}

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>';
nodes.filter(node => node.parent_id === rootNode.id).forEach(currentNode => {
output += traverseNodes(nodes, currentNode);
});
output += '</li></ul>';
return output;
}
};

function renderSemUIRegions(nodes, el) {
var selectedNodeID = location.hash.replace('#!/', '');
var selectedNode = nodes.find(node => node.id.toString() === selectedNodeID);

var nodesToRender = [];
nodesToRender.push(nodes.filter(node => node.id === selectedNode.parent_id));
nodesToRender.push(nodes.filter(node => node.parent_id === selectedNode.id));
nodesToRender = nodesToRender.reduce((acc, val) => acc.concat(val), []);

if (selectedNode && nodesToRender) {

$(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 => {
var template = $('#semuiViewRegionTemplate').html();
var rendered = Mustache.render(template, {
regionName: pluralize(tag),
nodes: nodesToRender.filter(node => node.tag === tag)
});
$(el).append(rendered);
});

}

$.contextMenu({
selector: el + ' li',
callback: function(key, options) {
var m = 'clicked: ' + key + ' on ' + $(this).text();
console.log(m);
console.log(options);
},
items: {
'delete': {name: 'Delete', icon: 'delete'},
}
});

$.contextMenu({
selector: el + ' div.semui-view-region-editable',
callback: function(key, options) {
var m = 'clicked: ' + key;
console.log(m);
console.log(options);
},
items: {
'add': {name: 'Add', icon: 'add'}
}
});

};

})(jQuery, window);
Oops, something went wrong.

0 comments on commit 0ddc252

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