tree
by Bretto
HTML
<script src="http://code.angularjs.org/1.0.1/angular-1.0.1.js"></script>
<body ng-app>
<div class="alert alert-warning span12" style="margin-top:5px; margin-left: 0; background-color: #fff;" ng-controller="PracticeCtrl">
<div class="page-header">
<h1>Practice</h1>
</div>
Search: <input ng-model="query">
<ol class="dd-list" ng-repeat="strand in strands">
<li class="dd-item strand" data-id="{{strandId}}">
<div class="dd-handle">{{strand.strandName}}</div>
<ol class="dd-list" ng-repeat="topic in strand.topics">
<li class="dd-item sub-topic" data-id="{{topicId}}">
<div class="dd-handle">{{topic.topicName}}</div>
<ol class="dd-list" ng-repeat="subtopic in topic.subtopics">
<li class="dd-item sub-topic" data-id="{{subTopicId}}">
<div class="dd-handle">{{subtopic.subtopicName}}</div>
<ol class="dd-list" ng-repeat="exercise in subtopic.exercises | filter:query">
<li class="dd-item exercise" data-id="{{topicId}}">
<div class="dd-handle">{{exercise.exerciseName}}</div>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</div><!--/span-->
</body>
<body ng-app>
<div class="alert alert-warning span12" style="margin-top:5px; margin-left: 0; background-color: #fff;" ng-controller="PracticeCtrl">
<div class="page-header">
<h1>Practice</h1>
</div>
Search: <input ng-model="search"/>
<ol class="dd-list" ng-repeat="(key, strand) in exercises">
<li class="dd-item strand" data-id="{{key}}">
<div class="dd-handle">{{strand.strandName}}</div>
<ol class="dd-list" ng-repeat="(topicID,...
CSS
.cf:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
* html .cf { zoom: 1; }
*:first-child+html .cf { zoom: 1; }
html { margin: 0; padding: 0; }
body { font-size: 100%; margin: 0; padding: 1.75em; font-family: 'Helvetica Neue', Arial, sans-serif; }
h1 { font-size: 1.75em; margin: 0 0 0.6em 0; }
a { color: #2996cc; }
a:hover { text-decoration: none; }
p { line-height: 1.5em; }
.small { color: #666; font-size: 0.875em; }
.large { font-size: 1.25em; }
/**
* Nestable
*/
.dd { position: relative; display: block; margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 20px; }
.dd-list { display: block; position: relative; margin: 0; padding: 0; list-style: none; }
.dd-list .dd-list { padding-left: 30px; }
.dd-collapsed .dd-list { display: none; }
.dd-item,
.dd-empty,
.dd-placeholder { display: block; position: relative; margin: 0; padding: 0; min-height: 20px; font-size: 13px; line-height: 20px; }
.dd-handle { display: block; height: 30px; margin: 5px 0; padding: 5px 10px; color: #333; text-decoration: none; font-weight: bold; border: 1px solid #ccc;
background: #fafafa;
background: -webkit-linear-gradient(top, #fafafa 0%, #eee 100%);
background: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
background: linear-gradient(top, #fafafa 0%, #eee 100%);
-webkit-border-radius: 3px;
border-radius: 3px;
box-sizing: border-box; -moz-box-sizing: border-box;
}
.dd-handle:hover { color: #2ea8e5; background: #fff; }
.dd-item > button { display: block; position: relative; cursor: pointer; float: left; width: 25px; height: 20px; margin: 5px 0; padding: 0; text-indent: 100%; white-space: nowrap; overflow: hidden; border: 0; background: transparent; font-size: 12px; line-height: 1; text-align: center; font-weight: bold; }
.dd-item > button:before { content: '+'; display: block; position: absolute; width: 100%; text-align: center; text-indent: 0; }
.dd-item >...
JavaScript
function PracticeCtrl($scope) {
$scope.strands = [{
"strandId":"1",
"strandName": "Strand 1",
"topics": [{
"topicId": "13",
"topicName":"Topic 1",
"subtopics": [{
"subtopicId": "74",
"subtopicName":"Numbers 1-100 (incl. odd and even)",
"exercises": [
{"exerciseId":"21900","exerciseName":"How many counters `0-5`","grade":"0"},
{"exerciseId":"21901","exerciseName":"How many counters `0-9`","grade":"0"},
{"exerciseId":"21902","exerciseName":"How many counters `10-20`","grade":"0"},
{"exerciseId":"30088","exerciseName":"How many counters `1-20`","grade":"0"},
{"exerciseId":"21903","exerciseName":"How many objects `0-9`","grade":"0"}
]
}]
}]
},
{
"strandId":"2",
"strandName": "aa",
"topics": [{
"topicId": "13",
"topicName":"Test Number",
"subtopics": [{
"subtopicId": "74",
"subtopicName":"Numbers 2-200 (incl. odd and even)",
"exercises": [
{"exerciseId":"22900","exerciseName":"bla bla","grade":"0"},
{"exerciseId":"22901","exerciseName":"test","grade":"0"},
]
}]
}]
}
]
}