kms 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/kms/application/controllers/pages_controller.coffee.erb +1 -2
  3. data/app/assets/javascripts/templates/assets/index.html.slim +4 -12
  4. data/app/assets/javascripts/templates/help/scopes.html.slim +74 -0
  5. data/app/assets/javascripts/templates/pages/index.html.slim +4 -3
  6. data/app/assets/javascripts/templates/snippets/index.html.slim +4 -3
  7. data/app/assets/javascripts/templates/templates/index.html.slim +4 -3
  8. data/app/assets/javascripts/templates/users/index.html.slim +3 -2
  9. data/app/assets/stylesheets/kms/custom.css.scss +3 -0
  10. data/app/controllers/kms/pages_controller.rb +2 -2
  11. data/app/models/ability.rb +0 -1
  12. data/app/models/concerns/kms/positioned.rb +18 -0
  13. data/app/models/kms/page.rb +2 -12
  14. data/app/services/kms/functions_registry.rb +11 -0
  15. data/app/uploaders/kms/asset_uploader.rb +1 -1
  16. data/config/initializers/help.rb +1 -1
  17. data/config/initializers/liquor.rb +0 -47
  18. data/config/locales/en.yml +22 -0
  19. data/config/locales/ru.yml +22 -0
  20. data/lib/generators/kms/install/install_generator.rb +2 -0
  21. data/lib/generators/kms/install/templates/carrierwave.rb +14 -0
  22. data/lib/kms/dependencies.rb +2 -0
  23. data/lib/kms/engine.rb +1 -1
  24. data/lib/kms/version.rb +1 -1
  25. data/spec/controllers/kms/snippets_controller_spec.rb +6 -6
  26. data/spec/internal/log/test.log +2439 -0
  27. data/spec/services/kms/functions_registry_spec.rb +14 -0
  28. data/spec/spec_helper.rb +1 -1
  29. data/vendor/assets/bower.json +1 -1
  30. data/vendor/assets/bower_components/angular-ui-tree/CHANGELOG.md +164 -0
  31. data/vendor/assets/bower_components/angular-ui-tree/CONTRIBUTING.md +39 -0
  32. data/vendor/assets/bower_components/angular-ui-tree/README.md +145 -37
  33. data/vendor/assets/bower_components/angular-ui-tree/bower.json +28 -18
  34. data/vendor/assets/bower_components/angular-ui-tree/{source → dist}/angular-ui-tree.css +18 -16
  35. data/vendor/assets/bower_components/angular-ui-tree/dist/angular-ui-tree.js +1408 -822
  36. data/vendor/assets/bower_components/angular-ui-tree/dist/angular-ui-tree.min.css +1 -2
  37. data/vendor/assets/bower_components/angular-ui-tree/dist/angular-ui-tree.min.js +3 -3
  38. data/vendor/assets/bower_components/angular-ui-tree/e2e/basic-example/basic-example.js +81 -0
  39. data/vendor/assets/bower_components/angular-ui-tree/e2e/basic-example/page.js +42 -0
  40. data/vendor/assets/bower_components/angular-ui-tree/e2e/table-example/page.js +31 -0
  41. data/vendor/assets/bower_components/angular-ui-tree/e2e/table-example/table-example.js +34 -0
  42. data/vendor/assets/bower_components/angular-ui-tree/index.js +2 -0
  43. data/vendor/assets/bower_components/angular-ui-tree/protractor.conf.js +19 -0
  44. data/vendor/assets/bower_components/angular/angular.js +4880 -2111
  45. data/vendor/assets/bower_components/angular/angular.min.js +320 -297
  46. data/vendor/assets/bower_components/angular/angular.min.js.gzip +0 -0
  47. data/vendor/assets/bower_components/angular/angular.min.js.map +3 -3
  48. data/vendor/assets/bower_components/angular/bower.json +1 -1
  49. data/vendor/assets/bower_components/angular/package.json +1 -1
  50. metadata +32 -40
  51. data/vendor/assets/bower_components/angular-ui-tree/Gruntfile.js +0 -229
  52. data/vendor/assets/bower_components/angular-ui-tree/build/compiler.jar +0 -0
  53. data/vendor/assets/bower_components/angular-ui-tree/demo/css/demo-horizontal.css +0 -47
  54. data/vendor/assets/bower_components/angular-ui-tree/demo/css/demo.css +0 -31
  55. data/vendor/assets/bower_components/angular-ui-tree/demo/css/tree.css +0 -25
  56. data/vendor/assets/bower_components/angular-ui-tree/demo/dist/angular-ui-tree.js +0 -1243
  57. data/vendor/assets/bower_components/angular-ui-tree/demo/dist/angular-ui-tree.min.css +0 -2
  58. data/vendor/assets/bower_components/angular-ui-tree/demo/dist/angular-ui-tree.min.js +0 -6
  59. data/vendor/assets/bower_components/angular-ui-tree/demo/filter.html +0 -64
  60. data/vendor/assets/bower_components/angular-ui-tree/demo/groups.html +0 -100
  61. data/vendor/assets/bower_components/angular-ui-tree/demo/index.html +0 -101
  62. data/vendor/assets/bower_components/angular-ui-tree/demo/js/demo.js +0 -63
  63. data/vendor/assets/bower_components/angular-ui-tree/demo/js/filter.js +0 -91
  64. data/vendor/assets/bower_components/angular-ui-tree/demo/js/groups.js +0 -143
  65. data/vendor/assets/bower_components/angular-ui-tree/demo/js/tree.js +0 -102
  66. data/vendor/assets/bower_components/angular-ui-tree/demo/js/trees.js +0 -60
  67. data/vendor/assets/bower_components/angular-ui-tree/demo/test.html +0 -60
  68. data/vendor/assets/bower_components/angular-ui-tree/demo/tree-horizontal.html +0 -66
  69. data/vendor/assets/bower_components/angular-ui-tree/demo/tree.html +0 -66
  70. data/vendor/assets/bower_components/angular-ui-tree/demo/trees.html +0 -92
  71. data/vendor/assets/bower_components/angular-ui-tree/guide/00_usage.ngdoc +0 -78
  72. data/vendor/assets/bower_components/angular-ui-tree/guide/01_development_setup.ngdoc +0 -58
  73. data/vendor/assets/bower_components/angular-ui-tree/guide/index.ngdoc +0 -33
  74. data/vendor/assets/bower_components/angular-ui-tree/karma.conf.js +0 -49
  75. data/vendor/assets/bower_components/angular-ui-tree/package.json +0 -40
  76. data/vendor/assets/bower_components/angular-ui-tree/source/angular-ui-tree.scss +0 -63
  77. data/vendor/assets/bower_components/angular-ui-tree/source/controllers/handleCtrl.js +0 -16
  78. data/vendor/assets/bower_components/angular-ui-tree/source/controllers/nodeCtrl.js +0 -141
  79. data/vendor/assets/bower_components/angular-ui-tree/source/controllers/nodesCtrl.js +0 -100
  80. data/vendor/assets/bower_components/angular-ui-tree/source/controllers/treeCtrl.js +0 -63
  81. data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTree.js +0 -115
  82. data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTreeHandle.js +0 -27
  83. data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTreeNode.js +0 -427
  84. data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTreeNodes.js +0 -59
  85. data/vendor/assets/bower_components/angular-ui-tree/source/main.js +0 -23
  86. data/vendor/assets/bower_components/angular-ui-tree/source/services/helper.js +0 -265
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kms::FunctionsRegistry, type: :service do
4
+ it 'should contain default functions' do
5
+ expect(Kms::FunctionsRegistry.modules).to contain_exactly(Liquor::Pagination, Kms::Functions::Assets, Kms::Functions::Currency)
6
+ end
7
+ describe '.register' do
8
+ it "should register modules with liquor functions" do
9
+ NewModule = Module.new { include ::Liquor::Library }
10
+ Kms::FunctionsRegistry.register NewModule
11
+ expect(Kms::FunctionsRegistry.modules).to include NewModule
12
+ end
13
+ end
14
+ end
@@ -14,7 +14,7 @@ require 'devise'
14
14
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
15
15
 
16
16
  RSpec.configure do |config|
17
- config.include Devise::TestHelpers, type: :controller
17
+ config.include Devise::Test::ControllerHelpers, type: :controller
18
18
  config.extend ControllerMacros, type: :controller
19
19
  config.include Requests::JsonHelpers, type: :controller
20
20
  config.color = true
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsl-generated dependencies",
3
3
  "dependencies": {
4
- "angular": "1.4.14",
4
+ "angular": "1.5.11",
5
5
  "angular-cookies": "1.4.14",
6
6
  "Responsive-Dashboard": "git://github.com/Ehesp/Responsive-Dashboard",
7
7
  "lodash": "3.6.0",
@@ -0,0 +1,164 @@
1
+ #2.22.5
2
+
3
+ * Move postinstall hook to pretest [#907](https://github.com/angular-ui-tree/angular-ui-tree/issues/907)
4
+
5
+ #2.22.4
6
+
7
+ * Fixed placeholder height calculating [#904](https://github.com/angular-ui-tree/angular-ui-tree/issues/904)
8
+ * Prevent node being non-collapsable after drag-and-drop in-place [#878](https://github.com/angular-ui-tree/angular-ui-tree/issues/878)
9
+ * Edit Protractor installation [#905](https://github.com/angular-ui-tree/angular-ui-tree/issues/905)
10
+
11
+ #2.22.3
12
+
13
+ * Expand-on-hover event not calling toggle callback function [#899](https://github.com/angular-ui-tree/angular-ui-tree/issues/899)
14
+
15
+ #2.22.2
16
+
17
+ * Update devDependencies
18
+ * Remove unused outOfBounds calculation [#856](https://github.com/angular-ui-tree/angular-ui-tree/issues/856)
19
+
20
+ #2.22.1
21
+
22
+ * Fix tree sorting bug, see Issues [#831](https://github.com/angular-ui-tree/angular-ui-tree/issues/831) and [#832](https://github.com/angular-ui-tree/angular-ui-tree/issues/832)
23
+
24
+ #2.22.0
25
+
26
+ * Improve horizontal movement detection for smoother node movement and to address Issue [#562](https://github.com/angular-ui-tree/angular-ui-tree/issues/562)
27
+
28
+ #2.21.3
29
+
30
+ * Set `appendChildOnHover` to `true` by default.
31
+
32
+ #2.21.2
33
+
34
+ * Re-integrate lost patch from PR [#650](https://github.com/angular-ui-tree/angular-ui-tree/pull/650).
35
+
36
+ #2.21.1
37
+
38
+ * Update CHANGELOG.md
39
+
40
+ #2.21.0
41
+
42
+ * New ui-tree-node attribute data-scroll-container allows for specifying any valid querySelector argument to scroll relative to the dragged node.
43
+ * Fixes Issues [#49](https://github.com/angular-ui-tree/angular-ui-tree/issues/49), [#644](https://github.com/angular-ui-tree/angular-ui-tree/issues/644), [#158](https://github.com/angular-ui-tree/angular-ui-tree/issues/158), and [#544](https://github.com/angular-ui-tree/angular-ui-tree/issues/544)
44
+
45
+ #2.20.0
46
+
47
+ * Performance Improvements by skipping dragDelay when no delay is specified
48
+ * Corrected error with ESC key not cancelling drag [#799](https://github.com/angular-ui-tree/angular-ui-tree/issues/799)
49
+ * Corrected error where dropping on a noDrop clone tree would add node to second tree [Example of Error](http://gfycat.com/EverlastingCanineCleanerwrasse)
50
+
51
+ #2.19.0
52
+
53
+ * Fix error caused by version rollback.
54
+
55
+ # 2.18.0
56
+
57
+ * Enable setting a numeric value for the expand-on-hover attribute [#812](https://github.com/angular-ui-tree/angular-ui-tree/pull/812)
58
+
59
+ # 2.17.0
60
+
61
+ * Updated Angular/angularfire references in bower.json
62
+ * Re-introduced feature to expand collapsed nodes when hovering another node [#783](https://github.com/angular-ui-tree/angular-ui-tree/pull/783)
63
+
64
+ # 2.16.0
65
+
66
+ * Updated Angular references to include 1.5
67
+ * Fixed issue dragging and dropping a node into an empty tree
68
+ * Added new callback for a toggle event that fires when any node is expanded or collapsed.
69
+ * Fixed drag/drop error that occurred when the ng-app was attached to document.
70
+
71
+ # 2.15.0
72
+
73
+ * Remove scope dependency [#648](https://github.com/angular-ui-tree/angular-ui-tree/pull/648)
74
+
75
+ # 2.14.0
76
+
77
+ * Include the CSS source files in the build [#685](https://github.com/angular-ui-tree/angular-ui-tree/pull/685)
78
+ * Fix Callback Routing [#673](https://github.com/angular-ui-tree/angular-ui-tree/pull/673)
79
+ * Update to Node v4.2.4 [#696](https://github.com/angular-ui-tree/angular-ui-tree/pull/696)
80
+
81
+ # 2.13.0
82
+
83
+ * Bind keydown handler to document [#636](https://github.com/angular-ui-tree/angular-ui-tree/pull/636)
84
+ * Ability to change whether nodes should be collapsed or expanded by default [#643](https://github.com/angular-ui-tree/angular-ui-tree/pull/643)
85
+ * Drag & drop Protractor tests [#638](https://github.com/angular-ui-tree/angular-ui-tree/pull/638)
86
+ * Fix #680 (drag-drop not working if beforeDrop is not implemented) [#683](https://github.com/angular-ui-tree/angular-ui-tree/pull/683)
87
+
88
+ # 2.12.0
89
+
90
+ * Use this.sourceInfo.cloneModel instead [#627](https://github.com/angular-ui-tree/angular-ui-tree/issues/627)
91
+ * Add documentation for cloneModel [#660](https://github.com/angular-ui-tree/angular-ui-tree/issues/660)
92
+ * Fix accept() to check $treeScope.nodropEnabled [#665](https://github.com/angular-ui-tree/angular-ui-tree/issues/665)
93
+ * Add information about styling to the README file [#666](https://github.com/angular-ui-tree/angular-ui-tree/issues/666)
94
+ * [#507](https://github.com/angular-ui-tree/angular-ui-tree/issues/507) Promise support callbacks [#589](https://github.com/angular-ui-tree/angular-ui-tree/issues/589)
95
+
96
+ # 2.11.0
97
+
98
+ * Reset placeholder display attribute instead of changing it to block [#631](https://github.com/angular-ui-tree/angular-ui-tree/issues/631)
99
+ * Firefox issue where tree offset is wrong if scrolled horizontally [#626](https://github.com/angular-ui-tree/angular-ui-tree/issues/626)
100
+ * Fix `Cannot read property '$type' of undefined"` error / issue [#674](https://github.com/angular-ui-tree/angular-ui-tree/issues/674)
101
+ * Remove line which sets the placeholder width explicitly [#642](https://github.com/angular-ui-tree/angular-ui-tree/issues/642)
102
+ * Added a demo using a table [#656](https://github.com/angular-ui-tree/angular-ui-tree/issues/656)
103
+ * Fix drop placeholder for tables [#654](https://github.com/angular-ui-tree/angular-ui-tree/issues/654)
104
+ * Fix empty tree element for tables [#655](https://github.com/angular-ui-tree/angular-ui-tree/issues/655)
105
+ * Fix `Cannot read property 'childNodes' of undefined` [#650](https://github.com/angular-ui-tree/angular-ui-tree/issues/650)
106
+ * Remove duplicate license entry in package.json [#658](https://github.com/angular-ui-tree/angular-ui-tree/issues/658)
107
+
108
+ # 2.10.0
109
+
110
+ * Fix crashing $nodesScope.$modelValue.length watch [#574](https://github.com/angular-ui-tree/angular-ui-tree/issues/574)
111
+ * Fix out of depth calculation [#582](https://github.com/angular-ui-tree/angular-ui-tree/issues/582)
112
+ * Update default styling to work with tables [#572](https://github.com/angular-ui-tree/angular-ui-tree/issues/572)
113
+ * Call the dragStart callback after setting up the variables [#587](https://github.com/angular-ui-tree/angular-ui-tree/issues/587)
114
+ * Add Angular 1.4.x as dependency [#592](https://github.com/angular-ui-tree/angular-ui-tree/issues/592)
115
+ * Put drag element to the $rootElement instead of the body [#612](https://github.com/angular-ui-tree/angular-ui-tree/issues/612)
116
+ * Add support for Browserify/Webpack [#614](https://github.com/angular-ui-tree/angular-ui-tree/issues/614)
117
+
118
+ # 2.9.0
119
+
120
+ * Updated Bower package name to `angular-ui-tree` [#568](https://github.com/angular-ui-tree/angular-ui-tree/pull/568)
121
+ * Remove placeholder and cancel drop on drag out of bounds [#550](https://github.com/angular-ui-tree/angular-ui-tree/pull/550)
122
+ * Fix position detection on touch devices when using jQuery [#554](https://github.com/angular-ui-tree/angular-ui-tree/pull/554)
123
+
124
+ # 2.8.0
125
+
126
+ * Rename `$uiTreeHelper` service to `UiTreeHelper` [#534](https://github.com/angular-ui-tree/angular-ui-tree/pull/534)
127
+ * Nodrop, clone, and dirty-checking fixes [#525](https://github.com/angular-ui-tree/angular-ui-tree/pull/525)
128
+
129
+ # 2.7.0
130
+
131
+ * Fix edge case error when you have a single node with no parents and no children and and drop the node in the same place [#510](https://github.com/angular-ui-tree/angular-ui-tree/pull/510)
132
+ * Fix error in the `apply` function [#512](https://github.com/angular-ui-tree/angular-ui-tree/pull/512)
133
+ * Fix calculation of the placeholder width [#526](https://github.com/angular-ui-tree/angular-ui-tree/pull/526) [#470](https://github.com/angular-ui-tree/angular-ui-tree/pull/470)
134
+
135
+ # 2.6.0
136
+
137
+ * Use `data-nodrag` instead of `nodrag` attribute in the examples, as `$uiTreeHelper` service looks for the first one [#468](https://github.com/angular-ui-tree/angular-ui-tree/pull/468)
138
+ * Drag-dropping a node in the same position and container no longer removes and re-adds it to its parent node array [#485](https://github.com/angular-ui-tree/angular-ui-tree/pull/485)
139
+ * `bower.json` should reference only one copy of `angular-ui-tree.js` in main [#488](https://github.com/angular-ui-tree/angular-ui-tree/pull/488)
140
+
141
+ # 2.5.0
142
+
143
+ * Prevents child node scope with no children to be counted in depth [#388](https://github.com/angular-ui-tree/angular-ui-tree/pull/388)
144
+ * Fix callback errors when we have intermediate isolated scopes [#423](https://github.com/angular-ui-tree/angular-ui-tree/pull/423)
145
+ * Rename API attribute for toggling the empty placeholder [#450](https://github.com/angular-ui-tree/angular-ui-tree/pull/450)
146
+
147
+ # 2.4.0
148
+
149
+ * Added JSCS validation task [#441](https://github.com/angular-ui-tree/angular-ui-tree/pull/441)
150
+ * Bugfix `data-drag-delay` to actually delay `dragStart` [#444](https://github.com/angular-ui-tree/angular-ui-tree/pull/444)
151
+
152
+ # 2.3.0
153
+
154
+ * Add `data-clone-enabled` option + fix `data-drop-enabled` option ([#411](https://github.com/angular-ui-tree/angular-ui-tree/pull/411))
155
+ * Replaced Grunt with Gulp for the build process ([#435](https://github.com/angular-ui-tree/angular-ui-tree/pull/435))
156
+ * Fixed memory leak [#421](https://github.com/angular-ui-tree/angular-ui-tree/pull/421)
157
+
158
+ # 2.2.0
159
+
160
+ * release has been [reverted](https://github.com/angular-ui-tree/angular-ui-tree/commit/800dd0a43ce105d6301cd42038c1a28dbe3cd21e) to v2.1.5
161
+
162
+ # 2.1.5 (2014-07-31)
163
+
164
+ * latest release without CHANGELOG
@@ -0,0 +1,39 @@
1
+ # Contributing Guidelines
2
+
3
+ First of all, thank you for considering to contribute to the UI Tree project.
4
+ The community is important to us and we appreciate your time and effort to help pushing towards a better generic tree component.
5
+
6
+ ## Submitting a PR
7
+
8
+ As an attempt to make the process of contributing more pleasant for you and the reviewers, we've created a checklist.
9
+ Please make sure your PR confirms to critera listed below.
10
+
11
+ - Use a descriptive title using proper grammar (this is important because the same text will be used for the changelog)
12
+ - Make sure the build passes
13
+ - Do not include files from the `dist/` directory (These are created when a new release is made. Adding them to every PR will result in merge conflicts for other PR's.)
14
+
15
+ ## Accepting a PR
16
+
17
+ 1. Manually review PR in the 'Files Changed' tab of the GitHub PR section
18
+ 2. Ensure Travis build passing
19
+ 3. Review Coveralls and Codacy reports.
20
+ A fail does not necessarily mean a PR should be rejected, but it is a red flag that you should take a close look at the report.
21
+ 4. Merge the PR. If the PR is simple and good as-is you can merge it using GitHub's web UI. If the PR needs some amending, or you want to test the changes, perform a command line merge (the 'commandline instructions' link gives the commands).
22
+ 5. Test the PR locally and run the tests (gulp test and gulp test:e2e)
23
+ 6. Make any additional changes you need (update README, update example site, etc)
24
+ 7. Push the changes
25
+
26
+ ## Creating a release
27
+
28
+ 1. Run the tests (`$ npm test`)
29
+ 3. Update CHANGELOG.md with release notes for the changes in the this release
30
+ 4. Update version string in `source/main.js` and `package.json` and `bower.json`
31
+ 5. Run `$ gulp build` and commit, this time including the new dist files.
32
+ 6. Tag the commit as a new release (like v2.18.0)
33
+ 7. Push all the changes including tags (eg. `$ git push --tags`)
34
+ 8. Publish to npm with `$ npm publish ./`
35
+ 9. Add a new [Release in GitHub](https://github.com/angular-ui-tree/angular-ui-tree/releases)
36
+ 10. Update the website by running `$ gulp website` (runs the ghpages plugin)
37
+ 11. Announce the release on [Gitter](https://gitter.im/angular-ui-tree/angular-ui-tree)
38
+
39
+ Our intention is to keep working on this document. Happy coding!
@@ -1,10 +1,16 @@
1
1
  Angular UI Tree
2
2
  ======================
3
3
 
4
- [![Build Status](https://travis-ci.org/JimLiu/angular-ui-tree.png?branch=master)](https://travis-ci.org/JimLiu/angular-ui-tree)
4
+ [![Build Status](https://travis-ci.org/angular-ui-tree/angular-ui-tree.svg?branch=master)](https://travis-ci.org/angular-ui-tree/angular-ui-tree) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular-ui-tree/angular-ui-tree?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
5
5
 
6
6
  Angular UI Tree is an AngularJS UI component that can sort nested lists, provides drag & drop support and doesn't depend on jQuery. If you are a user who uses `angular-nestedSortable`, this is [How to migrate From v1.x to v2.0](https://github.com/JimLiu/angular-ui-tree/wiki/Migrate-From-v1.x-to-v2.0).
7
7
 
8
+ ### Considering Contributing?
9
+
10
+ Read our contributing guidelines and become a contributing member of Angular UI Tree!
11
+
12
+ [CONTRIBUTING](https://github.com/angular-ui-tree/angular-ui-tree/blob/master/CONTRIBUTING.md)
13
+
8
14
 
9
15
  ## Features
10
16
 
@@ -27,7 +33,7 @@ For IE8 support, make sure you do the following:
27
33
  - use [jQuery 1.x](http://jquery.com/browser-support/)
28
34
 
29
35
  ## Demo
30
- Watch the Tree component in action on the [demo page](http://jimliu.github.io/angular-ui-tree/).
36
+ Watch the Tree component in action on the [demo page](http://angular-ui-tree.github.io/angular-ui-tree/).
31
37
 
32
38
  ## Requirements
33
39
 
@@ -37,7 +43,7 @@ Watch the Tree component in action on the [demo page](http://jimliu.github.io/an
37
43
 
38
44
  ### Download
39
45
  - Using [bower](http://bower.io/) to install it. `bower install angular-ui-tree`
40
- - [Download](https://github.com/JimLiu/angular-ui-tree/archive/master.zip) from github.
46
+ - [Download](https://github.com/angular-ui-tree/angular-ui-tree/archive/master.zip) from github.
41
47
 
42
48
  ### Load CSS
43
49
  Load the css file: `angular-ui-tree.min.css` in your application:
@@ -89,6 +95,12 @@ Injecting `ui.tree`, `ui-tree-nodes`, `ui-tree-node`, `ui-tree-handle` to your h
89
95
  - All `ui-tree`, `ui-tree-nodes`, `ng-model`, `ui-tree-node` are necessary. And they can be nested.
90
96
  - If you don't add a `ui-tree-handle` for a node, the entire node can be dragged.
91
97
 
98
+ **Styling Notes:**
99
+ - While an element is being dragged, it is temporarily removed from the DOM and injected just before closing `</body>` tag. When dropped, it returns to it's original place in the DOM's hierarchy.
100
+ - The dragged element `ui-tree-node`, together with its parent `ui-tree-nodes`, are the only ones being injected. hence any styling that relies on a 'higher' parent, will not apply.
101
+ - To target the dragged element use the class `angular-ui-tree-drag`, which is added to the `ui-tree-nodes` element.
102
+ - While a node is being dragged, a new empty node is added into the tree to act as a placeholder. this node will have the class 'angular-ui-tree-placeholder'.
103
+
92
104
  #### Unlimited nesting HTML View or Templates Example
93
105
 
94
106
  ```html
@@ -123,7 +135,7 @@ Injecting `ui.tree`, `ui-tree-nodes`, `ui-tree-node`, `ui-tree-handle` to your h
123
135
  ui-tree-handle --> Handle
124
136
 
125
137
  ## Migrate From v1.x to v2.0
126
- [Migrate From v1.x to v2.0](https://github.com/JimLiu/angular-ui-tree/wiki/Migrate-From-v1.x-to-v2.0)
138
+ [Migrate From v1.x to v2.0](https://github.com/angular-ui-tree/angular-ui-tree/wiki/Migrate-From-v1.x-to-v2.0)
127
139
 
128
140
  ## API
129
141
 
@@ -131,6 +143,19 @@ Injecting `ui.tree`, `ui-tree-nodes`, `ui-tree-node`, `ui-tree-handle` to your h
131
143
  `ui-tree` is the root scope for a tree
132
144
 
133
145
  #### Attributes
146
+ ##### data-nodrop-enabled
147
+ Prevent dropping of nodes into this tree. This applies to both nodes dragged within this tree and nodes from a connected tree.
148
+ Adding this attribute to the `ui-tree` effectively makes the tree a drag source only.
149
+ To prevent a particular node from accepting children, add the attribute to the `ui-tree-nodes` element instead (see below).
150
+ See the [demo page](http://angular-ui-tree.github.io/angular-ui-tree/#/nodrop) for examples.
151
+ - `false` (default): turn off
152
+ - `true`: turn on no drop
153
+
154
+ ##### data-clone-enabled
155
+ Turn on cloning of nodes. This will clone the source node to the destination when dragging between 2 trees.
156
+ - `false` (default): turn off clone
157
+ - `true`: turn on clone
158
+
134
159
  ##### data-drag-enabled
135
160
  Turn on dragging and dropping of nodes.
136
161
  - `true` (default): allow drag and drop
@@ -144,30 +169,35 @@ If you write your own [$callbacks.accept](#accept) method, you have to check `da
144
169
  ##### data-drag-delay
145
170
  Number of milliseconds a click must be held to start a drag. (default 0)
146
171
 
147
- ##### data-empty-place-holder-enabled
148
- If a tree is empty, there will be an empty place hoder which is used to drop node from other trees by default.
149
- - `true` (default): display an empty place holder if the tree is empty
150
- - `false`: do not display an empty place hoder
172
+ ##### data-empty-placeholder-enabled
173
+ If a tree is empty, there will be an empty placeholder which is used to drop node from other trees by default.
174
+ - `true` (default): display an empty placeholder if the tree is empty
175
+ - `false`: do not display an empty placeholder
151
176
 
152
- ##### Example
177
+ ##### Example
153
178
  - turn on/off drag and drop.
154
179
  - Limit depth to 5
155
180
  - 500 milliseconds delay
181
+
156
182
  ```html
157
183
  <div ui-tree data-drag-enabled="tree.enabled" data-max-depth="5" data-drag-delay="500">
158
184
 
159
185
  </div>
160
186
  ```
161
187
 
162
- #### Methods of scope
163
- ##### collapseAll()
188
+ #### Events
189
+ `angular-ui-tree:collapse-all`
164
190
  Collapse all it's child nodes.
165
191
 
166
- ##### expandAll()
192
+ `angular-ui-tree:expand-all`
167
193
  Expand all it's child nodes.
168
194
 
195
+ #### Methods of scope
169
196
  ##### $callbacks (type: Object)
170
- `$callbacks` is a very important property for `angular-ui-tree`. When some special events trigger, the functions in `$callbacks` are called. The callbacks can be passed through the directive.
197
+ `$callbacks` is a very important property for `angular-ui-tree`.
198
+ When some special events trigger, the functions in `$callbacks` are called.
199
+ The callbacks can be passed through the directive.
200
+
171
201
  Example:
172
202
  ```js
173
203
  myAppModule.controller('MyController', function($scope) {
@@ -211,6 +241,12 @@ If current node is draggable.
211
241
  - `true` Allow it to drag.
212
242
  - `false` Not allow.
213
243
 
244
+ ##### <a name="removed"></a>removed(node)
245
+ If a node is removed, the `removed` callback will be called.
246
+
247
+ **Parameters:**
248
+ - `node`: The node that was removed
249
+
214
250
  ##### <a name="dropped"></a>dropped(event)
215
251
  If a node moves it's position after dropped, the `nodeDropped` callback will be called.
216
252
 
@@ -220,6 +256,7 @@ If a node moves it's position after dropped, the `nodeDropped` callback will be
220
256
  + `nodeScope`: The scope of source node which was dragged.
221
257
  + `nodesScope`: The scope of the parent nodes of source node when it began to drag.
222
258
  + `index`: The position when it began to drag.
259
+ + `cloneModel`: Given data-clone-enabled is true, holds the model of the cloned node that is to be inserted, this can be edited before drop without affecting the source node.
223
260
  * `dest`: Destination object
224
261
  + `nodesScope`: The scope of `ui-tree-nodes` which you just dropped in.
225
262
  + `index`: The position you dropped in.
@@ -228,6 +265,7 @@ If a node moves it's position after dropped, the `nodeDropped` callback will be
228
265
  + `dragging`: The dragging element.
229
266
  * `pos`: Position object.
230
267
 
268
+ To change the node being dropped before
231
269
  ##### <a name="dragStart"></a>dragStart(event)
232
270
  The `dragStart` function is called when the user starts to drag the node.
233
271
  **Parameters:**
@@ -246,25 +284,42 @@ The `dragStop` function is called when the user stop dragging the node.
246
284
  Same as [Parameters](#eventParam) of dropped.
247
285
 
248
286
  ##### beforeDrop(event)
249
- The `beforeDrop` function is called before the dragging node is dropped.
287
+ The `beforeDrop` function is called before the dragging node is dropped. If you implement this callback, the return value determines whether the drop event is allowed to proceed.
250
288
 
251
289
  **Parameters:**
252
290
  Same as [Parameters](#eventParam) of dropped.
253
291
 
292
+ **Callback Return Values**
293
+
294
+ - **Resolved Promise** or **truthy**: Allow the node to be dropped
295
+
296
+ - **Rejected Promise** or **false**: Disallow the node drop and return the dragged node to its original position
297
+
298
+ ##### toggle(collapsed, sourceNodeScope)
299
+ The `toggle` function is called after the node is toggled
300
+
301
+ **Parameters:**
302
+ - `collapsed`: Boolean value with state of the node.
303
+ - `sourceNodeScope`: The scope of source node which is toggled.
304
+
254
305
  ### ui-tree-nodes
255
- `ui-tree-nodes` is the container of nodes. Every `ui-tree-node` should have a `ui-tree-nodes` as it's container, a `ui-tree-nodes` can have multiple child nodes.
306
+ `ui-tree-nodes` is the container of nodes.
307
+ Every `ui-tree-node` should have a `ui-tree-nodes` as it's container, a `ui-tree-nodes` can have multiple child nodes.
256
308
 
257
309
  #### Attributes
258
- ##### data-nodrop<a name="nodes_attrs_nodrop"></a>
259
- Turn off drop of nodes.
260
- ##### data-max-depth<a name="nodes_attrs_maxDepth"></a>
310
+ ##### data-nodrop-enabled <a name="nodes_attrs_nodrop"></a>
311
+ Prevent nodes from being dropped into this node container.
312
+ This prevents nodes from being dropped directly into the container with the attribute but not into children that contain additional containers.
313
+ See the [demo page](http://angular-ui-tree.github.io/angular-ui-tree/#/nodrop) for examples.
314
+
315
+ ##### data-max-depth <a name="nodes_attrs_maxDepth"></a>
261
316
  Number of levels a nodes can be nested (default 0). 0 means no limit. It can override the `data-max-depth` in `ui-tree`.
262
317
  **Note**
263
- If you write your own [$callbacks.accept](#accept) method, you have to check `data-nodrop` and `data-max-depth` by yourself.
318
+ If you write your own [$callbacks.accept](#accept) method, you have to check `data-nodrop-enabled` and `data-max-depth` by yourself.
264
319
 
265
320
  Example: turn off drop.
266
321
  ```html
267
- <ol ui-tree-nodes ng-model="nodes" data-nodrop>
322
+ <ol ui-tree-nodes ng-model="nodes" data-nodrop-enabled="true">
268
323
  <li ng-repeat="node in nodes" ui-tree-node>{{node.title}}</li>
269
324
  </ol>
270
325
  ```
@@ -295,8 +350,8 @@ The property `$nodeScope of` `nodes 1.1` is `node 1.1`. The property `$nodes` of
295
350
  ##### maxDepth
296
351
  Number of levels a node can be nested. It bases on the attribute [data-max-depth](#nodes_attrs_maxDepth).
297
352
 
298
- ##### nodrop
299
- Turn off drop on nodes. It bases on the attribute [data-nodrag](#nodes_attrs_nodrop).
353
+ ##### nodropEnabled
354
+ Turn off drop on nodes. It bases on the attribute [data-nodrop-enabled](#nodes_attrs_nodrop).
300
355
 
301
356
  #### Methods of scope
302
357
  ##### depth()
@@ -315,7 +370,7 @@ Check if the nodes is the parent of the target node.
315
370
  A node of a tree. Every `ui-tree-node` should have a `ui-tree-nodes` as it's container.
316
371
 
317
372
  #### Attributes
318
- ##### data-nodrag
373
+ ##### data-nodrag (type: boolean)
319
374
  Turn off drag of node.
320
375
  Example: turn off drag.
321
376
  ```html
@@ -324,9 +379,27 @@ Example: turn off drag.
324
379
  </ol>
325
380
  ```
326
381
 
327
- ##### data-collapsed
382
+ ##### data-collapsed (type: boolean)
328
383
  Collapse the node.
329
384
 
385
+ ##### data-expand-on-hover (type: boolean, number)
386
+ Causes the node to expand (if it contains child nodes and was collapsed) when dragging a node over it.
387
+ This lets users drag and drop items into a nested tree in a single drag operation, instead of having to expand all the nodes to the destination first.
388
+ The target node will immediately expand when `true` is provided.
389
+ When a number (in milliseconds) is specified, the target node will expand after the specified amount of milliseconds.
390
+
391
+ ##### data-scroll-container (type: string)
392
+ Causes drag-scrolling to happen within a customisable container, as opposed to the default document body.
393
+ Accepts any selector string that document.querySelector accepts.
394
+ Example:
395
+ ```html
396
+ <div ui-tree style="height: 300px; overflow:scroll;" class="wrapper">
397
+ <ul ui-tree-nodes style="height: 600px;">
398
+ <li ui-tree-node ng-repeat="item in items" data-scroll-container=".wrapper">
399
+ </ul>
400
+ </div>
401
+ ```
402
+
330
403
  #### Properties of scope
331
404
  ##### $element (type: AngularElement)
332
405
  The html element which bind with the `ui-tree-nodes` scope.
@@ -334,7 +407,7 @@ The html element which bind with the `ui-tree-nodes` scope.
334
407
  ##### $modelValue (type: Object)
335
408
  The data which bind with the scope.
336
409
 
337
- ##### collapsed (type: Bool)
410
+ ##### collapsed (type: boolean)
338
411
  If the node is collapsed
339
412
 
340
413
  - `true`: Current node is collapsed;
@@ -393,7 +466,29 @@ Check if the current node is a child of the target node.
393
466
 
394
467
 
395
468
  ### ui-tree-handle
396
- Use the `ui-tree-handle` to specify an element used to drag the object. If you don't add a `ui-tree-handle` for a node, the entire node can be dragged.
469
+ Use the `ui-tree-handle` to specify an element used to drag the object.
470
+ If you don't add a `ui-tree-handle` for a node, the entire node can be dragged.
471
+
472
+ ## Runtime Configuration
473
+ Use the `treeConfig` service to configure the tree defaults at runtime.
474
+ With this you can customize the classes applied to various tree elements
475
+ (`treeClass`, `emptyTreeClass`, `hiddenClass`, `nodesClass`, `handleClass`,
476
+ `placeholderClass`, `dragClass`).
477
+
478
+ In addition, you can modify whether or not nodes are collapsed by default
479
+ (`defaultCollapsed`: default false).
480
+
481
+ You can also modify whether or not dragging a node over a parent node will insert the node as a child
482
+ (`appendChildOnHover`: default true).
483
+
484
+ For example:
485
+
486
+ ```js
487
+ module.config(function(treeConfig) {
488
+ treeConfig.defaultCollapsed = true; // collapse nodes by default
489
+ treeConfig.appendChildOnHover = true; // append dragged nodes as children by default
490
+ });
491
+ ```
397
492
 
398
493
  ## NgModules Link
399
494
 
@@ -407,46 +502,59 @@ Use the `ui-tree-handle` to specify an element used to drag the object. If you d
407
502
 
408
503
  #### Dependencies
409
504
 
410
- * [Grunt](http://gruntjs.com/) (task automation)
505
+ * [Gulp](http://gulpjs.com/) (task automation)
411
506
  * [Bower](http://bower.io/) (package management)
412
507
 
413
508
  #### Installation
414
509
  Run the commands below in the project root directory.
415
510
 
416
- #####1. Install Grunt and Bower
511
+ #####1. Install Gulp and Bower
417
512
 
418
- $ sudo npm install -g grunt-cli bower
513
+ $ sudo npm install -g gulp bower
419
514
 
420
515
  #####2. Install project dependencies
421
516
 
422
517
  $ npm install
518
+ $ ./node_modules/protractor/bin/webdriver-manager update
423
519
  $ bower install
424
520
 
425
521
  ## Useful commands
426
522
 
427
523
  ####Running a Local Development Web Server
428
- To debug code and run end-to-end tests, it is often useful to have a local HTTP server. For this purpose, we have made available a local web server based on Node.js.
524
+ To debug code and run end-to-end tests, it is often useful to have a local HTTP server.
525
+ For this purpose, we have made available a local web server based on Node.js.
429
526
 
430
527
  To start the web server, run:
431
528
 
432
- $ grunt webserver
529
+ $ gulp serve
433
530
 
434
531
  To access the local server, enter the following URL into your web browser:
435
532
 
436
- http://localhost:8080/demo/
533
+ http://localhost:9000
437
534
 
438
- By default, it serves the contents of the demo project.
535
+ By default, it serves the contents of the `examples` directory.
439
536
 
440
537
 
441
538
  ####Building angular-ui-tree
442
539
  To build angular-ui-tree, you use the following command.
443
540
 
444
- $ grunt build
541
+ $ gulp build
445
542
 
446
543
  This will generate non-minified and minified JavaScript files in the `dist` directory.
447
544
 
448
545
  ####Run tests
449
- You can run the tests once or continuous.
546
+ You can run the unit test using a separate task.
547
+
548
+ $ gulp test
549
+
550
+ The E2E-tests can be executed using
551
+
552
+ $ gulp test:e2e
553
+
554
+ > Note: make sure you have the example website running on port `9000` (using the `$ gulp serve` command)
555
+
556
+ *Windows: If your e2e tests are failing, run the command prompt as an administrator. ([See symlink issue](https://github.com/ben-eb/gulp-symlink/issues/33))*
557
+
558
+ ####Deploy examples
450
559
 
451
- $ grunt test
452
- $ grunt test:continuous
560
+ $ gulp deploy