Skip to content

Commit

Permalink
fixes #37
Browse files Browse the repository at this point in the history
  • Loading branch information
ezraroi committed Jul 12, 2015
1 parent 43ec15a commit a564146
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 27 deletions.
21 changes: 20 additions & 1 deletion Gruntfile.js
Expand Up @@ -67,10 +67,29 @@ module.exports = function (grunt) {
]
}
},

wiredep: {
test: {
src: 'karma.conf.js',
fileTypes: {
js: {
block: /(([\s\t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi,
detect: {
js: /'(.*\.js)'/gi
},
replace: {
js: '\'{{filePath}}\','
}
}
},
devDependencies: true
}
},

coveralls: {
options: {
debug: true,
coverage_dir: 'dist/coverage',
coverageDir: 'coverage',
dryRun: false,
force: true,
recursive: true
Expand Down
3 changes: 2 additions & 1 deletion bower.json
@@ -1,7 +1,7 @@
{
"name": "ng-js-tree",
"main": "dist/ngJsTree.js",
"version": "0.0.5",
"version": "0.0.6",
"homepage": "https://github.com/ezraroi/ngJsTree",
"authors": [
"ezraroi <ezraroi@gmail.com>"
Expand All @@ -18,6 +18,7 @@
"license": "MIT",
"ignore": [
"**/.*",
"coverage",
"node_modules",
"bower_components",
"test",
Expand Down
14 changes: 5 additions & 9 deletions dist/ngJsTree.js
Expand Up @@ -98,26 +98,20 @@
shouldApply : '&'
},
controller: 'jsTreeCtrl',
link: function (scope, elm, attrs, controller) {
link: function link(scope, elm, attrs, controller) {

var config = null,
nodesWatcher = controller.changeWatcher(scope.treeData, controller.nodesFingerprint);

var blocked = false;

var dndEvents = ['dnd_scroll','dnd_start','dnd_move','dnd_stop'];

function manageEvents(s, e, a) {
if (a.treeEvents) {
var evMap = a.treeEvents.split(';');
for (var i = 0; i < evMap.length; i++) {
if (evMap[i].length > 0) {
var name = evMap[i].split(':')[0];
var extension = '.jstree';
if (dndEvents.indexOf(name) !== -1) {
extension = '.vakata';
}
var evt = name + extension,
var evt = name + '.jstree',
cb = evMap[i].split(':')[1];
s.tree.on(evt, s.$parent.$eval(cb));
}
Expand Down Expand Up @@ -161,7 +155,9 @@
};

nodesWatcher.onChanged = function (node) {
scope.tree.jstree(true).set_type(node.id, node.type);
if (angular.isDefined(scope.tree.jstree(true).set_type)) {
scope.tree.jstree(true).set_type(node.id, node.type);
}
scope.tree.jstree(true).rename_node(node.id, node.text);
};

Expand Down
2 changes: 1 addition & 1 deletion dist/ngJsTree.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions karma.conf.js
Expand Up @@ -2,18 +2,18 @@ module.exports = function(config) {

config.set({

basePath: 'dist/',

frameworks: ['jasmine'],

// list of files / patterns to load in the browser
files: [
'../bower_components/jquery/dist/jquery.min.js',
'../bower_components/angular/angular.min.js',
'../bower_components/angular-mocks/angular-mocks.js',
'../bower_components/jstree/dist/jstree.min.js',
'ngJsTree.js',
'../test/**/*.js'
// bower:
'bower_components/jquery/dist/jquery.js',
'bower_components/angular/angular.js',
'bower_components/jstree/dist/jstree.js',
'bower_components/angular-mocks/angular-mocks.js',
// endbower
'dist/ngJsTree.js',
'test/**/*.js'
],

reporters: ['coverage'],
Expand Down
6 changes: 4 additions & 2 deletions ngJsTree.js
Expand Up @@ -98,7 +98,7 @@
shouldApply : '&'
},
controller: 'jsTreeCtrl',
link: function (scope, elm, attrs, controller) {
link: function link(scope, elm, attrs, controller) {

var config = null,
nodesWatcher = controller.changeWatcher(scope.treeData, controller.nodesFingerprint);
Expand Down Expand Up @@ -155,7 +155,9 @@
};

nodesWatcher.onChanged = function (node) {
scope.tree.jstree(true).set_type(node.id, node.type);
if (angular.isDefined(scope.tree.jstree(true).set_type)) {
scope.tree.jstree(true).set_type(node.id, node.type);
}
scope.tree.jstree(true).rename_node(node.id, node.text);
};

Expand Down
11 changes: 6 additions & 5 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "ng-js-tree",
"version": "0.0.5",
"version": "0.0.6",
"description": "Angular Directive for the famous JsTree",
"main": "ngJsTree.js",
"scripts": {
Expand All @@ -22,10 +22,10 @@
"homepage": "https://github.com/ezraroi/ngJsTree",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-bump": "0.0.16",
"grunt-bump": "0.3.1",
"grunt-contrib-connect": "~0.7.1",
"grunt-contrib-copy": "~0.6.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-jshint": "~0.11.0",
"grunt-contrib-uglify": "~0.6.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-karma": "^0.9.0",
Expand All @@ -39,7 +39,8 @@
"load-grunt-tasks": "~0.6.0",
"grunt-ng-annotate": "~0.4.0",
"grunt-karma-coveralls": "^2.5.2",
"karma-coverage": "^0.2.6"
"karma-coverage": "^0.2.6",
"grunt-wiredep": "~2.0.0"
},
"dependencies": {}
}

0 comments on commit a564146

Please sign in to comment.