Skip to content

Instantly share code, notes, and snippets.

@yak1ex
Last active August 29, 2015 14:00
Show Gist options
  • Save yak1ex/4296db06d4b8b84a9a81 to your computer and use it in GitHub Desktop.
Save yak1ex/4296db06d4b8b84a9a81 to your computer and use it in GitHub Desktop.
Tree selection test by AngularJS
bower_components/
ez-file-tree/
node_modules/
{
"name": "ccf-playground",
"version": "0.0.0",
"description": "Playground for Angular-ize CCF",
"main": "index.html",
"license": "BSL",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"devDependencies": {
"angular-ui-utils": "~0.1.1",
"angular": "~1.2.16"
}
}
<html>
<head>
<!-- Other tree modules -->
<!-- http://ngmodules.org/modules/angular.treeview Basic tree VIEW -->
<!-- http://ngmodules.org/modules/angular-tree-control with configuration and interaction -->
<!-- http://ngmodules.org/modules/angular-treeRepeat repeater -->
<!-- http://ngmodules.org/modules/angular-lazy-tree laziness is not necessary for me -->
<!-- http://ngmodules.org/modules/angular-tree-repeat repeater -->
<!-- http://ngmodules.org/modules/angular-ya-treeview maybe similar to tree-control -->
<!-- so, the following looks like the nearest from my needs -->
<!-- http://ngmodules.org/modules/ez-file-tree -->
<!-- recursive select updates visual effect but not update _selectedFiles -->
<!-- Need to apply inderteminate checkbox referring like the followings: -->
<!-- http://angular-ui.github.io/ui-utils/ -->
<!-- http://jsfiddle.net/cjwprostar/M4vGj/6/ -->
<script src="//code.angularjs.org/1.2.9/angular.js"></script>
<script src="ez-file-tree/src/js/ez-file-tree.js"></script>
<script src="ez-file-tree/dist/ez-file-tree.tpl.js"></script>
<script src="//rawgit.com/jdewit/ez-object2array/master/dist/ez-object2array.min.js"></script>
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="//rawgit.com/jdewit/ez-file-tree/master/dist/ez-file-tree.min.css">
<script type="text/javascript">
function createTree() {
var gcc45 = { id: 'gcc45', name: 'gcc45', type: 'file' };
var gcc46 = { id: 'gcc46', name: 'gcc46', type: 'file' };
var gcc45_11 = { id: 'gcc45-11', name: 'gcc45 C++11', type: 'file' };
var gcc46_11 = { id: 'gcc46-11', name: 'gcc46 C++11', type: 'file' };
var gcc45_1y = { id: 'gcc45-1y', name: 'gcc45 C++1y', type: 'file' };
var gcc46_1y = { id: 'gcc46-1y', name: 'gcc46 C++1y', type: 'file' };
return {
id: 'root',
name: 'All',
_open: true,
children: [
{ id: 'compiler', name: 'Compiler', type: 'folder', _open: true, children: [
{ id: '_gcc45', name: 'GCC 4.5', type: 'folder', _open: true, children: [ gcc45, gcc45_11, gcc45_1y ]},
{ id: '_gcc46', name: 'GCC 4.6', type: 'folder', _open: true, children: [ gcc46, gcc46_11, gcc46_1y ]}
]},
{ id: 'lang', name: 'Language', type: 'folder', _open: true, children: [
{ id: '_cpp03', name: 'C++03', type: 'folder', _open: true, children: [ gcc45, gcc46 ]},
{ id: '_cpp11', name: 'C++11', type: 'folder', _open: true, children: [ gcc45_11, gcc46_11 ]},
{ id: '_cpp1y', name: 'C++1y', type: 'folder', _open: true, children: [ gcc45_1y, gcc46_1y ]}
]}
]
};
}
angular.module('myApp', ['ez.fileTree'])
.controller('TestCtrl', ['$scope', function($scope) {
$scope.folder = createTree();
$scope.selected = function() {
var result = [];
for(var i in $scope.folder._selectedFiles) {
result.push(i);
}
return result;
};
}]);
</script>
</head>
<body>
<div ng-app="myApp">
<div ng-controller="TestCtrl">
<div ez-file-tree="folder" data-instateful-folder="true" data-enable-checking="true" data-has-indeterminate="true">
</div>
<div ng-repeat="selected in selected()">
<span ng-bind="selected"></span>
</div>
</div>
</div>
</body>
</html>
{"gcc44":["Ubuntu/Linaro 4.4.7-1ubuntu2","",""],"clang32-c++11":["Debian 3.2-debian11ppa8","1",""],"clang32":["Debian 3.2-debian11ppa8","",""],"gcc45":["Ubuntu/Linaro 4.5.3-12ubuntu2","",""],"clang34":["Debian 3.4-debian1ppa2","",""],"gcc47":["Ubuntu/Linaro 4.7.3-2ubuntu1~12.04","",""],"gcc46-c++11":["Ubuntu/Linaro 4.6.4-1ubuntu1~12.04","1",""],"clang34-c++1y":["Debian 3.4-debian1ppa2","","1"],"clang30":["Debian 3.0-debian6.2ppa5","",""],"gcc48-c++11":["Ubuntu 4.8.1-2ubuntu1~12.04","1",""],"gcc46":["Ubuntu/Linaro 4.6.4-1ubuntu1~12.04","",""],"clang34-c++11":["Debian 3.4-debian1ppa2","1",""],"clang33":["Debian 3.3-debian16ppa5","",""],"vc 9":["2008 / VC9 / 15.00.30729.01","",""],"gcc44-c++11":["Ubuntu/Linaro 4.4.7-1ubuntu2","1",""],"vc10":["2010 / VC10 / 16.00.30319.01","1",""],"gcc47-c++11":["Ubuntu/Linaro 4.7.3-2ubuntu1~12.04","1",""],"clang33-c++1y":["Debian 3.3-debian16ppa5","","1"],"vc11":["2012 / VC11 / 17.00.50727.1","1",""],"clang31-c++11":["Debian 3.1-debian8ppa5","1",""],"vc12ctp":["2013CTP / VC12CTP / 18.00.21114.1","1","1"],"vc12":["2013 / VC12 / 18.00.21005.1","1",""],"gcc45-c++11":["Ubuntu/Linaro 4.5.3-12ubuntu2","1",""],"gcc48":["Ubuntu 4.8.1-2ubuntu1~12.04","",""],"gcc48-c++1y":["Ubuntu 4.8.1-2ubuntu1~12.04","","1"],"clang33-c++11":["Debian 3.3-debian16ppa5","1",""],"vc 8":["2005 / VC8 / 14.00.50727.42","",""],"clang30-c++11":["Debian 3.0-debian6.2ppa5","1",""],"clang31":["Debian 3.1-debian8ppa5","",""]}
{
"name": "ccf-playground",
"version": "0.0.0",
"description": "Playground for Angular-ize CCF",
"main": "test.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://gist.github.com/yak1ex/4296db06d4b8b84a9a81"
},
"author": "",
"license": "BSL",
"bugs": {
"url": "https://gist.github.com/yak1ex/4296db06d4b8b84a9a81"
},
"homepage": "https://gist.github.com/yak1ex/4296db06d4b8b84a9a81",
"devDependencies": {
"grunt": "^0.4.4",
}
}
require('connect')().use(require('connect').static('.')).listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment