push_type_admin 0.3.3 → 0.4.0.beta.3

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 (170) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/push_type/admin.js.coffee +9 -2
  3. data/app/assets/javascripts/push_type/directives.js.coffee +43 -0
  4. data/app/assets/javascripts/push_type/nodes.js.coffee +8 -3
  5. data/app/assets/javascripts/push_type/taxonomies.js.coffee +103 -0
  6. data/app/assets/stylesheets/push_type/admin.scss +262 -2
  7. data/app/assets/stylesheets/push_type/foundation_and_overrides.scss +1 -1
  8. data/app/controllers/push_type/taxonomies_controller.rb +36 -0
  9. data/app/controllers/push_type/taxonomy_terms_controller.rb +81 -0
  10. data/app/helpers/push_type/taxonomies_helper.rb +6 -0
  11. data/app/views/push_type/nodes/_form_fields.html.haml +34 -33
  12. data/app/views/push_type/nodes/_form_submit.html.haml +1 -1
  13. data/app/views/push_type/nodes/edit.html.haml +1 -2
  14. data/app/views/push_type/nodes/new.html.haml +1 -2
  15. data/app/views/push_type/taxonomies/index.html.haml +16 -0
  16. data/app/views/push_type/taxonomies/show.html.haml +57 -0
  17. data/config/routes.rb +6 -0
  18. data/lib/push_type/admin/engine.rb +9 -0
  19. data/test/controllers/push_type/taxonomies_controller_test.rb +25 -0
  20. data/test/controllers/push_type/taxonomy_terms_controller_test.rb +84 -0
  21. data/test/dummy/app/models/category.rb +6 -0
  22. data/test/dummy/app/views/taxonomies/category.html.erb +3 -0
  23. data/test/dummy/config/initializers/push_type.rb +3 -1
  24. data/test/dummy/config/secrets.yml +2 -2
  25. data/test/dummy/db/migrate/{20150310192202_create_push_type_users.push_type.rb → 20150406131551_create_push_type_users.push_type.rb} +1 -1
  26. data/test/dummy/db/migrate/{20150310192203_create_push_type_nodes.push_type.rb → 20150406131552_create_push_type_nodes.push_type.rb} +1 -1
  27. data/test/dummy/db/migrate/{20150310192204_create_push_type_node_hierarchies.push_type.rb → 20150406131553_create_push_type_node_hierarchies.push_type.rb} +2 -2
  28. data/test/dummy/db/migrate/{20150310192205_create_push_type_assets.push_type.rb → 20150406131554_create_push_type_assets.push_type.rb} +1 -1
  29. data/test/dummy/db/migrate/20150406131555_create_push_type_taxonomies.push_type.rb +19 -0
  30. data/test/dummy/db/migrate/20150406131556_create_push_type_taxonomy_hierarchies.push_type.rb +17 -0
  31. data/test/dummy/db/schema.rb +29 -9
  32. data/test/dummy/log/test.log +4893 -3071
  33. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_accordion.scssc +0 -0
  34. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_alert-boxes.scssc +0 -0
  35. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_block-grid.scssc +0 -0
  36. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_breadcrumbs.scssc +0 -0
  37. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_button-groups.scssc +0 -0
  38. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_buttons.scssc +0 -0
  39. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_clearing.scssc +0 -0
  40. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_dropdown-buttons.scssc +0 -0
  41. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_dropdown.scssc +0 -0
  42. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_flex-video.scssc +0 -0
  43. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_forms.scssc +0 -0
  44. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_global.scssc +0 -0
  45. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_grid.scssc +0 -0
  46. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_icon-bar.scssc +0 -0
  47. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_inline-lists.scssc +0 -0
  48. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_joyride.scssc +0 -0
  49. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_keystrokes.scssc +0 -0
  50. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_labels.scssc +0 -0
  51. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_magellan.scssc +0 -0
  52. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_offcanvas.scssc +0 -0
  53. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_orbit.scssc +0 -0
  54. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_pagination.scssc +0 -0
  55. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_panels.scssc +0 -0
  56. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_pricing-tables.scssc +0 -0
  57. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_progress-bars.scssc +0 -0
  58. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_range-slider.scssc +0 -0
  59. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_reveal.scssc +0 -0
  60. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_side-nav.scssc +0 -0
  61. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_split-buttons.scssc +0 -0
  62. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_sub-nav.scssc +0 -0
  63. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_switches.scssc +0 -0
  64. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_tables.scssc +0 -0
  65. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_tabs.scssc +0 -0
  66. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_thumbs.scssc +0 -0
  67. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_tooltips.scssc +0 -0
  68. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_top-bar.scssc +0 -0
  69. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_type.scssc +0 -0
  70. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_visibility.scssc +0 -0
  71. data/test/dummy/tmp/cache/assets/test/sass/{0bf981301b6f8cfa0a13d38a3554eafaa08d4bc1 → 8e964fb9e2b714a9d3faad7ab62f9bb5096b21bf}/foundation.scssc +0 -0
  72. data/test/dummy/tmp/cache/assets/test/sass/{9ffd013d383870261f2263c294cb3119536e8d59 → c67795fea8d999e739d183abcc4d1330e25b5d36}/_functions.scssc +0 -0
  73. data/test/dummy/tmp/cache/assets/test/sass/ddc338bd04efa4c6ae329e9f4f514bc8d0636fb5/admin.scssc +0 -0
  74. data/test/dummy/tmp/cache/assets/test/sass/ddc338bd04efa4c6ae329e9f4f514bc8d0636fb5/admin_assets.scss.erbc +0 -0
  75. data/test/dummy/tmp/cache/assets/test/sass/{2df752541ff0a319141a1cb83ca971d2ffd2d050 → ddc338bd04efa4c6ae329e9f4f514bc8d0636fb5}/foundation_and_overrides.scssc +0 -0
  76. data/test/dummy/tmp/cache/assets/test/sass/{2df752541ff0a319141a1cb83ca971d2ffd2d050 → ddc338bd04efa4c6ae329e9f4f514bc8d0636fb5}/tagsinput.scssc +0 -0
  77. data/test/dummy/tmp/cache/assets/test/sprockets/{aab84c1f5c24fa406a94eac09d22b2a4 → 01a43d14de05969bd75be96787102a8f} +0 -0
  78. data/test/dummy/tmp/cache/assets/test/sprockets/{5eb2ada2e9af19cdbe5cb8750ce801df → 02df7daeaf181d2bf9db0859ace7ac78} +0 -0
  79. data/test/dummy/tmp/cache/assets/test/sprockets/{0ad373f2b4d9f428b6e58e76da4ec0b9 → 052abf5f4f37b5a381d365f1d81a384f} +0 -0
  80. data/test/dummy/tmp/cache/assets/test/sprockets/{ab6e14fb85dc2ad554e941848018ed3f → 0a4219947cd1a8d37dfcf91d3a09d557} +0 -0
  81. data/test/dummy/tmp/cache/assets/test/sprockets/{3508023b6222e6b0876c773e38ec700d → 0dfb030e402960ab0409cd82dee0f77a} +0 -0
  82. data/test/dummy/tmp/cache/assets/test/sprockets/{e6e78e14e8c962d31e6148ca56230af9 → 0f8fb5fc24f5163e89c3120d0db8a55c} +0 -0
  83. data/test/dummy/tmp/cache/assets/test/sprockets/{27d0805c68db0e1ea5335f4ad7273237 → 10edc6da95775c8efb1aeeeccb3861c1} +0 -0
  84. data/test/dummy/tmp/cache/assets/test/sprockets/{5f85da4ac11a64f005e2656b99be44ac → 165305bae06b65fba3b83e6f050e9449} +0 -0
  85. data/test/dummy/tmp/cache/assets/test/sprockets/{a656594778473574f77b201837cc446f → 1bca52bd72c5954d6cec5490cfd19619} +0 -0
  86. data/test/dummy/tmp/cache/assets/test/sprockets/{faa4ce8149d6e520b0a0855bfd8853e0 → 1c148cfaa96fc18dd39206f147e0be89} +0 -0
  87. data/test/dummy/tmp/cache/assets/test/sprockets/{9850ccc5ff77cfe44eef6c931be25fa2 → 1c1650864315928ff30ac15efdbd6a72} +0 -0
  88. data/test/dummy/tmp/cache/assets/test/sprockets/234ab1ed0a06b51e80d3ce1f22eef80f +0 -0
  89. data/test/dummy/tmp/cache/assets/test/sprockets/26a5499486141a1cfbcd492fca683376 +0 -0
  90. data/test/dummy/tmp/cache/assets/test/sprockets/2b9a9bdd2d50fe0617cfd3ac8f3c7535 +0 -0
  91. data/test/dummy/tmp/cache/assets/test/sprockets/{1956e934d0761e89293cf096aef2ad04 → 2c88d5a49fa0567e394c1d802a1143bd} +0 -0
  92. data/test/dummy/tmp/cache/assets/test/sprockets/2cccbe983a0c901f050bbeb7e6560bb2 +0 -0
  93. data/test/dummy/tmp/cache/assets/test/sprockets/{c8e888c4098e2f3e7e08e7aad9233bd9 → 3b4a91ef8ae8c6c733bbf380db4a51b5} +0 -0
  94. data/test/dummy/tmp/cache/assets/test/sprockets/4291f70c0b1b49b8cb37180e005f1ca5 +0 -0
  95. data/test/dummy/tmp/cache/assets/test/sprockets/{ada55ab3ebb32ffd74145d341fbbcb06 → 44c04143276bf3ec3cb625eac0b4eb5f} +0 -0
  96. data/test/dummy/tmp/cache/assets/test/sprockets/45fede24e630a3890ff78603adac3b40 +0 -0
  97. data/test/dummy/tmp/cache/assets/test/sprockets/{fb4793fb33ff5da9202b3b44e1997140 → 4b96e071d5b0bea51754baa3a4fbcd67} +0 -0
  98. data/test/dummy/tmp/cache/assets/test/sprockets/{03fbfd831772639fdac75dfe5fe9cf64 → 4f11fbb0626468698ded19f801463860} +0 -0
  99. data/test/dummy/tmp/cache/assets/test/sprockets/50e721194ac7b2603499066264fe669d +0 -0
  100. data/test/dummy/tmp/cache/assets/test/sprockets/{30f88df6b769522639aee569e18ab005 → 50ef1236c1f68b14a4447176f367df02} +0 -0
  101. data/test/dummy/tmp/cache/assets/test/sprockets/{cf51890ac703ed5a5d704515a4721815 → 6270c8cc9bce4e44a28cb79decd0c682} +0 -0
  102. data/test/dummy/tmp/cache/assets/test/sprockets/{257233cf9d7cbb01dd74d0fefd6a9384 → 66d5f5d6173f5fcb483c033826309fe9} +0 -0
  103. data/test/dummy/tmp/cache/assets/test/sprockets/{e540a9dc1aa001f8c4cba7a6b00f69d2 → 6892513841335338f628eb301e5e46f4} +0 -0
  104. data/test/dummy/tmp/cache/assets/test/sprockets/{6afb6cb0462c9dab19086aa6c02e619a → 69fad8b0193556718134a4be4088511b} +0 -0
  105. data/test/dummy/tmp/cache/assets/test/sprockets/{b78741de2e56d8ac6629bb0dbf1d5c20 → 6aab772e07a59a05ace08e2f0a8e4f6c} +0 -0
  106. data/test/dummy/tmp/cache/assets/test/sprockets/{488d63b20534d2642d48b86b5a267a3b → 6ddd06b6619f4db1c4c72ec71f516a9f} +0 -0
  107. data/test/dummy/tmp/cache/assets/test/sprockets/{9c34afd1737e54e4eb06cc87ddf17b78 → 736f20368870e59baea915c56e465ce4} +0 -0
  108. data/test/dummy/tmp/cache/assets/test/sprockets/{eeb045e353d91335ea6ec8a8869c322f → 74286734f262b9bfdaba269993f75768} +0 -0
  109. data/test/dummy/tmp/cache/assets/test/sprockets/{0e97b69ac6f777e5725c5faa99228b8b → 74ec7f6ddd6cd98a7a197f6d1fdc7bdc} +0 -0
  110. data/test/dummy/tmp/cache/assets/test/sprockets/{0e01ae9de0f3914c8317853aedd9ace4 → 755a8cd3fa84cdf03061014ccc2dd621} +0 -0
  111. data/test/dummy/tmp/cache/assets/test/sprockets/{8b83fd34df285c871e41af1e2c3efda9 → 7dfe1759f6792869148aa1ee5ee25c32} +0 -0
  112. data/test/dummy/tmp/cache/assets/test/sprockets/80c23adecc9454798ddea565b6e2f955 +0 -0
  113. data/test/dummy/tmp/cache/assets/test/sprockets/81aeaaced37b66582a071d5aa54667be +0 -0
  114. data/test/dummy/tmp/cache/assets/test/sprockets/{2929961e63046a72db4e8d82548a8f31 → 84af7f78cb0d1ce3a3fa87718e171f1c} +0 -0
  115. data/test/dummy/tmp/cache/assets/test/sprockets/{0c7d363f5622cc1f9d3584fdea9a45a8 → 86297411722f24c420a876ea9ae18e37} +0 -0
  116. data/test/dummy/tmp/cache/assets/test/sprockets/{b05f3b842ea70a8728bdfc77fe0c3a37 → 8c74b5681ecb45af77b61df5f959d79a} +0 -0
  117. data/test/dummy/tmp/cache/assets/test/sprockets/{bb38dd1514d70d46cc209c23beacf4ae → 8ca58c6921452f516b6d3d1d6c86b4f5} +0 -0
  118. data/test/dummy/tmp/cache/assets/test/sprockets/93ebdecd5089eeabed49b171f1373c1c +0 -0
  119. data/test/dummy/tmp/cache/assets/test/sprockets/{e28b8ab6a5b3ff792f45d5a6b7d806bc → 95dabfa1407631937482632b2fffcb03} +0 -0
  120. data/test/dummy/tmp/cache/assets/test/sprockets/{8df98e9b5189ffce4cf77a33533416a6 → 99a0c3679c80558e28bba1ecd515a14a} +0 -0
  121. data/test/dummy/tmp/cache/assets/test/sprockets/{226a629ec094e8ad208f2c273121699a → 9a2b48c02d01f27d021a726feaca4fd0} +0 -0
  122. data/test/dummy/tmp/cache/assets/test/sprockets/9d76f803477c4099b6eb8f9d4d52736a +0 -0
  123. data/test/dummy/tmp/cache/assets/test/sprockets/{a9b8decaa2942e8913458c9f35da2693 → 9fa1a48cec5e59b8081516d8f1979087} +0 -0
  124. data/test/dummy/tmp/cache/assets/test/sprockets/{edaf2543a96ee921c30a071b3a73036f → a0869545029330f96741fc96ea2c6930} +0 -0
  125. data/test/dummy/tmp/cache/assets/test/sprockets/{6ffb1f074155829dca88c57f3730a9c3 → a8bde5e0b1b491fb1a275b927bfcb5d8} +0 -0
  126. data/test/dummy/tmp/cache/assets/test/sprockets/{7925f8f38f5165ad9d36a7d73dd00c06 → b1f4d4e270e25cda21255f606e3d8ffe} +0 -0
  127. data/test/dummy/tmp/cache/assets/test/sprockets/{ac6920ecb59148769117dba39b8bb574 → b29fe26f1c1071b42a0bf9f055177649} +0 -0
  128. data/test/dummy/tmp/cache/assets/test/sprockets/{93f1c8b2c57b6a34ce6be7a69af2eeab → b2e69a2811b5e6f453beaa71ff2faa3d} +0 -0
  129. data/test/dummy/tmp/cache/assets/test/sprockets/{633ffb1bd470dc99106053fe08ffcef3 → b5576320a141123874f4348adeb3133f} +0 -0
  130. data/test/dummy/tmp/cache/assets/test/sprockets/be63e5150ae78af2a53a3691c8edb579 +0 -0
  131. data/test/dummy/tmp/cache/assets/test/sprockets/{5c694af01dab7474cace85e2e37233af → c0d10e77d7fb7d6d965e882edfc5da61} +0 -0
  132. data/test/dummy/tmp/cache/assets/test/sprockets/{1821710663a22c38d025f3600144b386 → c1b559fa06c770cd7065a4114d8fd93e} +0 -0
  133. data/test/dummy/tmp/cache/assets/test/sprockets/{508e9ca93a5c6a60e79e3496654497cf → c3d450aa26d5c5f83bc68bcde998f61d} +0 -0
  134. data/test/dummy/tmp/cache/assets/test/sprockets/{0be1680e56bd474e90098c85ed3613f1 → c3f4e4af5c70f490ae17047d3ed2bb51} +0 -0
  135. data/test/dummy/tmp/cache/assets/test/sprockets/{edd24c59de6c00e4e68dbbdf2775984a → c642987b1e8317371d1fc3b3e1a7b55e} +0 -0
  136. data/test/dummy/tmp/cache/assets/test/sprockets/{a93ec74f5cd7f26f8c663d4c481fe689 → c9cc9568b2b18e604aa3a9c9480d9763} +0 -0
  137. data/test/dummy/tmp/cache/assets/test/sprockets/cda72f48ef5c694d8c96c8fe2d854629 +0 -0
  138. data/test/dummy/tmp/cache/assets/test/sprockets/{25da091131e25acf0f55a6528a94f309 → d09161ef4c6cd263e36df8c8a4c86e18} +0 -0
  139. data/test/dummy/tmp/cache/assets/test/sprockets/{ec01e589b2029448373e8112cfd62b6a → d5037255409c85197806006794fcdf40} +0 -0
  140. data/test/dummy/tmp/cache/assets/test/sprockets/{fd06309bc284d80f9c2a30f32ed8df14 → d96931783ed30aa240c60fde4617a351} +0 -0
  141. data/test/dummy/tmp/cache/assets/test/sprockets/{fba226eba4fa5dba560496c64a18009c → d9ddb0aea190ab4fea31822b19386853} +0 -0
  142. data/test/dummy/tmp/cache/assets/test/sprockets/{b762effbcb1d2a5c2e967b26de0b8e2a → db712d4dbb79c4ac60432dcce07bd466} +0 -0
  143. data/test/dummy/tmp/cache/assets/test/sprockets/{6245a5f4c9368169ba2cab2de39b1316 → dd4cfbacaf337f92d161db82f61315b8} +0 -0
  144. data/test/dummy/tmp/cache/assets/test/sprockets/{2196fdacd39bb9f5c4e3755b86d84888 → e09a07bb146f5f5ce0f5b629c800acf3} +0 -0
  145. data/test/dummy/tmp/cache/assets/test/sprockets/{756b24d1d6762675f2f3d781313c59b6 → e129f696cc74c9cc667e27d4fad400d4} +0 -0
  146. data/test/dummy/tmp/cache/assets/test/sprockets/{91e13d81afe9041372ad8f79ee9159f4 → e5ca6700a0d0b3ddc3d4ce604e677015} +0 -0
  147. data/test/dummy/tmp/cache/assets/test/sprockets/{64550cb088f2a8bd25da69f8e7623a7a → e5e26fc0f6b8bda87e424fc53d074460} +0 -0
  148. data/test/dummy/tmp/cache/assets/test/sprockets/{312dcc14683b058a2ecb35f844b45deb → e5e6786891e684e0780275d5931e0d4c} +0 -0
  149. data/test/dummy/tmp/cache/assets/test/sprockets/{7cd04ce7e67cb693aa31bd3e03199ecd → f1a08fd2d7d7ac59d48d3673f528208f} +0 -0
  150. data/test/dummy/tmp/cache/assets/test/sprockets/{720b83386eaf5707c1535472e36ba7fb → f76b0143f821cd347e8668babc8473c2} +0 -0
  151. data/test/dummy/tmp/cache/assets/test/sprockets/{f96cec87308c4d1efa7993c38b770ba3 → ffd5d537d0557053f0955aefea60e00e} +0 -0
  152. data/vendor/assets/javascripts/angular-ui-tree.js +1259 -0
  153. metadata +280 -248
  154. data/test/dummy/tmp/cache/assets/test/sass/2df752541ff0a319141a1cb83ca971d2ffd2d050/admin.scssc +0 -0
  155. data/test/dummy/tmp/cache/assets/test/sass/2df752541ff0a319141a1cb83ca971d2ffd2d050/admin_assets.scss.erbc +0 -0
  156. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_block-grid.scssc +0 -0
  157. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_clearing.scssc +0 -0
  158. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_dropdown-buttons.scssc +0 -0
  159. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_icon-bar.scssc +0 -0
  160. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_range-slider.scssc +0 -0
  161. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_reveal.scssc +0 -0
  162. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_tabs.scssc +0 -0
  163. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_top-bar.scssc +0 -0
  164. data/test/dummy/tmp/cache/assets/test/sprockets/147cd256ded8a7797a230bd1f27db96a +0 -0
  165. data/test/dummy/tmp/cache/assets/test/sprockets/23c10c485dbe7ea46614928874120ecf +0 -0
  166. data/test/dummy/tmp/cache/assets/test/sprockets/6c7542a3718ad8d161e94f4816f01ccb +0 -0
  167. data/test/dummy/tmp/cache/assets/test/sprockets/8d531fdb806de0724337e0b80e253914 +0 -0
  168. data/test/dummy/tmp/cache/assets/test/sprockets/c206fbd33f49ab785c6ddf4bcffd3b93 +0 -0
  169. data/test/dummy/tmp/cache/assets/test/sprockets/df90022afc0d52f16bc498be20a5967d +0 -0
  170. data/test/dummy/tmp/cache/assets/test/sprockets/f7cf86568d1c692cb0a565614f282572 +0 -0
@@ -0,0 +1,1259 @@
1
+ /**
2
+ * @license Angular UI Tree v2.1.5
3
+ * (c) 2010-2014. https://github.com/JimLiu/angular-ui-tree
4
+ * License: MIT
5
+ */
6
+ (function () {
7
+ 'use strict';
8
+
9
+ angular.module('ui.tree', [])
10
+ .constant('treeConfig', {
11
+ treeClass: 'angular-ui-tree',
12
+ emptyTreeClass: 'angular-ui-tree-empty',
13
+ hiddenClass: 'angular-ui-tree-hidden',
14
+ nodesClass: 'angular-ui-tree-nodes',
15
+ nodeClass: 'angular-ui-tree-node',
16
+ handleClass: 'angular-ui-tree-handle',
17
+ placeHolderClass: 'angular-ui-tree-placeholder',
18
+ dragClass: 'angular-ui-tree-drag',
19
+ dragThreshold: 3,
20
+ levelThreshold: 30
21
+ });
22
+
23
+ })();
24
+
25
+ (function () {
26
+ 'use strict';
27
+
28
+ angular.module('ui.tree')
29
+
30
+ /**
31
+ * @ngdoc service
32
+ * @name ui.tree.service:$helper
33
+ * @requires ng.$document
34
+ * @requires ng.$window
35
+ *
36
+ * @description
37
+ * angular-ui-tree.
38
+ */
39
+ .factory('$uiTreeHelper', ['$document', '$window',
40
+ function ($document, $window) {
41
+ return {
42
+
43
+ /**
44
+ * A hashtable used to storage data of nodes
45
+ * @type {Object}
46
+ */
47
+ nodesData: {
48
+ },
49
+
50
+ setNodeAttribute: function(scope, attrName, val) {
51
+ if (!scope.$modelValue) {
52
+ return null;
53
+ }
54
+ var data = this.nodesData[scope.$modelValue.$$hashKey];
55
+ if (!data) {
56
+ data = {};
57
+ this.nodesData[scope.$modelValue.$$hashKey] = data;
58
+ }
59
+ data[attrName] = val;
60
+ },
61
+
62
+ getNodeAttribute: function(scope, attrName) {
63
+ if (!scope.$modelValue) {
64
+ return null;
65
+ }
66
+ var data = this.nodesData[scope.$modelValue.$$hashKey];
67
+ if (data) {
68
+ return data[attrName];
69
+ }
70
+ return null;
71
+ },
72
+
73
+ /**
74
+ * @ngdoc method
75
+ * @methodOf ui.tree.service:$nodrag
76
+ * @param {Object} targetElm angular element
77
+ * @return {Bool} check if the node can be dragged.
78
+ */
79
+ nodrag: function (targetElm) {
80
+ return (typeof targetElm.attr('data-nodrag')) != "undefined";
81
+ },
82
+
83
+ /**
84
+ * get the event object for touchs
85
+ * @param {[type]} e [description]
86
+ * @return {[type]} [description]
87
+ */
88
+ eventObj: function(e) {
89
+ var obj = e;
90
+ if (e.targetTouches !== undefined) {
91
+ obj = e.targetTouches.item(0);
92
+ } else if (e.originalEvent !== undefined && e.originalEvent.targetTouches !== undefined) {
93
+ obj = e.originalEvent.targetTouches.item(0);
94
+ }
95
+ return obj;
96
+ },
97
+
98
+ dragInfo: function(node) {
99
+ return {
100
+ source: node,
101
+ sourceInfo: {
102
+ nodeScope: node,
103
+ index: node.index(),
104
+ nodesScope: node.$parentNodesScope
105
+ },
106
+ index: node.index(),
107
+ siblings: node.siblings().slice(0),
108
+ parent: node.$parentNodesScope,
109
+
110
+ moveTo: function(parent, siblings, index) { // Move the node to a new position
111
+ this.parent = parent;
112
+ this.siblings = siblings.slice(0);
113
+ var i = this.siblings.indexOf(this.source); // If source node is in the target nodes
114
+ if (i > -1) {
115
+ this.siblings.splice(i, 1);
116
+ if (this.source.index() < index) {
117
+ index--;
118
+ }
119
+ }
120
+ this.siblings.splice(index, 0, this.source);
121
+ this.index = index;
122
+ },
123
+
124
+ parentNode: function() {
125
+ return this.parent.$nodeScope;
126
+ },
127
+
128
+ prev: function() {
129
+ if (this.index > 0) {
130
+ return this.siblings[this.index - 1];
131
+ }
132
+ return null;
133
+ },
134
+
135
+ next: function() {
136
+ if (this.index < this.siblings.length - 1) {
137
+ return this.siblings[this.index + 1];
138
+ }
139
+ return null;
140
+ },
141
+
142
+ isDirty: function() {
143
+ return this.source.$parentNodesScope != this.parent ||
144
+ this.source.index() != this.index;
145
+ },
146
+
147
+ eventArgs: function(elements, pos) {
148
+ return {
149
+ source: this.sourceInfo,
150
+ dest: {
151
+ index: this.index,
152
+ nodesScope: this.parent
153
+ },
154
+ elements: elements,
155
+ pos: pos
156
+ };
157
+ },
158
+
159
+ apply: function() {
160
+ var nodeData = this.source.$modelValue;
161
+ this.source.remove();
162
+ this.parent.insertNode(this.index, nodeData);
163
+ }
164
+ };
165
+ },
166
+
167
+ /**
168
+ * @ngdoc method
169
+ * @name hippo.theme#height
170
+ * @methodOf ui.tree.service:$helper
171
+ *
172
+ * @description
173
+ * Get the height of an element.
174
+ *
175
+ * @param {Object} element Angular element.
176
+ * @returns {String} Height
177
+ */
178
+ height: function (element) {
179
+ return element.prop('scrollHeight');
180
+ },
181
+
182
+ /**
183
+ * @ngdoc method
184
+ * @name hippo.theme#width
185
+ * @methodOf ui.tree.service:$helper
186
+ *
187
+ * @description
188
+ * Get the width of an element.
189
+ *
190
+ * @param {Object} element Angular element.
191
+ * @returns {String} Width
192
+ */
193
+ width: function (element) {
194
+ return element.prop('scrollWidth');
195
+ },
196
+
197
+ /**
198
+ * @ngdoc method
199
+ * @name hippo.theme#offset
200
+ * @methodOf ui.nestedSortable.service:$helper
201
+ *
202
+ * @description
203
+ * Get the offset values of an element.
204
+ *
205
+ * @param {Object} element Angular element.
206
+ * @returns {Object} Object with properties width, height, top and left
207
+ */
208
+ offset: function (element) {
209
+ var boundingClientRect = element[0].getBoundingClientRect();
210
+
211
+ return {
212
+ width: element.prop('offsetWidth'),
213
+ height: element.prop('offsetHeight'),
214
+ top: boundingClientRect.top + ($window.pageYOffset || $document[0].body.scrollTop || $document[0].documentElement.scrollTop),
215
+ left: boundingClientRect.left + ($window.pageXOffset || $document[0].body.scrollLeft || $document[0].documentElement.scrollLeft)
216
+ };
217
+ },
218
+
219
+ /**
220
+ * @ngdoc method
221
+ * @name hippo.theme#positionStarted
222
+ * @methodOf ui.tree.service:$helper
223
+ *
224
+ * @description
225
+ * Get the start position of the target element according to the provided event properties.
226
+ *
227
+ * @param {Object} e Event
228
+ * @param {Object} target Target element
229
+ * @returns {Object} Object with properties offsetX, offsetY, startX, startY, nowX and dirX.
230
+ */
231
+ positionStarted: function (e, target) {
232
+ var pos = {};
233
+ pos.offsetX = e.pageX - this.offset(target).left;
234
+ pos.offsetY = e.pageY - this.offset(target).top;
235
+ pos.startX = pos.lastX = e.pageX;
236
+ pos.startY = pos.lastY = e.pageY;
237
+ pos.nowX = pos.nowY = pos.distX = pos.distY = pos.dirAx = 0;
238
+ pos.dirX = pos.dirY = pos.lastDirX = pos.lastDirY = pos.distAxX = pos.distAxY = 0;
239
+ return pos;
240
+ },
241
+
242
+ positionMoved: function (e, pos, firstMoving) {
243
+ // mouse position last events
244
+ pos.lastX = pos.nowX;
245
+ pos.lastY = pos.nowY;
246
+
247
+ // mouse position this events
248
+ pos.nowX = e.pageX;
249
+ pos.nowY = e.pageY;
250
+
251
+ // distance mouse moved between events
252
+ pos.distX = pos.nowX - pos.lastX;
253
+ pos.distY = pos.nowY - pos.lastY;
254
+
255
+ // direction mouse was moving
256
+ pos.lastDirX = pos.dirX;
257
+ pos.lastDirY = pos.dirY;
258
+
259
+ // direction mouse is now moving (on both axis)
260
+ pos.dirX = pos.distX === 0 ? 0 : pos.distX > 0 ? 1 : -1;
261
+ pos.dirY = pos.distY === 0 ? 0 : pos.distY > 0 ? 1 : -1;
262
+
263
+ // axis mouse is now moving on
264
+ var newAx = Math.abs(pos.distX) > Math.abs(pos.distY) ? 1 : 0;
265
+
266
+ // do nothing on first move
267
+ if (firstMoving) {
268
+ pos.dirAx = newAx;
269
+ pos.moving = true;
270
+ return;
271
+ }
272
+
273
+ // calc distance moved on this axis (and direction)
274
+ if (pos.dirAx !== newAx) {
275
+ pos.distAxX = 0;
276
+ pos.distAxY = 0;
277
+ } else {
278
+ pos.distAxX += Math.abs(pos.distX);
279
+ if (pos.dirX !== 0 && pos.dirX !== pos.lastDirX) {
280
+ pos.distAxX = 0;
281
+ }
282
+
283
+ pos.distAxY += Math.abs(pos.distY);
284
+ if (pos.dirY !== 0 && pos.dirY !== pos.lastDirY) {
285
+ pos.distAxY = 0;
286
+ }
287
+ }
288
+
289
+ pos.dirAx = newAx;
290
+ }
291
+ };
292
+ }
293
+ ]);
294
+
295
+ })();
296
+ (function () {
297
+ 'use strict';
298
+
299
+ angular.module('ui.tree')
300
+
301
+ .controller('TreeController', ['$scope', '$element', '$attrs', 'treeConfig',
302
+ function ($scope, $element, $attrs, treeConfig) {
303
+ this.scope = $scope;
304
+
305
+ $scope.$element = $element;
306
+ $scope.$nodesScope = null; // root nodes
307
+ $scope.$type = 'uiTree';
308
+ $scope.$emptyElm = null;
309
+ $scope.$callbacks = null;
310
+
311
+ $scope.dragEnabled = true;
312
+ $scope.emptyPlaceHolderEnabled = true;
313
+ $scope.maxDepth = 0;
314
+ $scope.dragDelay = 0;
315
+
316
+ // Check if it's a empty tree
317
+ $scope.isEmpty = function() {
318
+ return ($scope.$nodesScope && $scope.$nodesScope.$modelValue
319
+ && $scope.$nodesScope.$modelValue.length === 0);
320
+ };
321
+
322
+ // add placeholder to empty tree
323
+ $scope.place = function(placeElm) {
324
+ $scope.$nodesScope.$element.append(placeElm);
325
+ $scope.$emptyElm.remove();
326
+ };
327
+
328
+ $scope.resetEmptyElement = function() {
329
+ if ($scope.$nodesScope.$modelValue.length === 0 &&
330
+ $scope.emptyPlaceHolderEnabled) {
331
+ $element.append($scope.$emptyElm);
332
+ } else {
333
+ $scope.$emptyElm.remove();
334
+ }
335
+ };
336
+
337
+ var collapseOrExpand = function(scope, collapsed) {
338
+ var nodes = scope.childNodes();
339
+ for (var i = 0; i < nodes.length; i++) {
340
+ collapsed ? nodes[i].collapse() : nodes[i].expand();
341
+ var subScope = nodes[i].$childNodesScope;
342
+ if (subScope) {
343
+ collapseOrExpand(subScope, collapsed);
344
+ }
345
+ }
346
+ };
347
+
348
+ $scope.collapseAll = function() {
349
+ collapseOrExpand($scope.$nodesScope, true);
350
+ };
351
+
352
+ $scope.expandAll = function() {
353
+ collapseOrExpand($scope.$nodesScope, false);
354
+ };
355
+
356
+ }
357
+ ]);
358
+ })();
359
+
360
+ (function () {
361
+ 'use strict';
362
+
363
+ angular.module('ui.tree')
364
+
365
+ .controller('TreeNodesController', ['$scope', '$element', 'treeConfig',
366
+ function ($scope, $element, treeConfig) {
367
+ this.scope = $scope;
368
+
369
+ $scope.$element = $element;
370
+ $scope.$modelValue = null;
371
+ $scope.$nodeScope = null; // the scope of node which the nodes belongs to
372
+ $scope.$treeScope = null;
373
+ $scope.$type = 'uiTreeNodes';
374
+ $scope.$nodesMap = {};
375
+
376
+ $scope.nodrop = false;
377
+ $scope.maxDepth = 0;
378
+
379
+ $scope.initSubNode = function(subNode) {
380
+ if(!subNode.$modelValue) {
381
+ return null;
382
+ }
383
+ $scope.$nodesMap[subNode.$modelValue.$$hashKey] = subNode;
384
+ };
385
+
386
+ $scope.destroySubNode = function(subNode) {
387
+ if(!subNode.$modelValue) {
388
+ return null;
389
+ }
390
+ $scope.$nodesMap[subNode.$modelValue.$$hashKey] = null;
391
+ };
392
+
393
+ $scope.accept = function(sourceNode, destIndex) {
394
+ return $scope.$treeScope.$callbacks.accept(sourceNode, $scope, destIndex);
395
+ };
396
+
397
+ $scope.beforeDrag = function(sourceNode) {
398
+ return $scope.$treeScope.$callbacks.beforeDrag(sourceNode);
399
+ };
400
+
401
+ $scope.isParent = function(node) {
402
+ return node.$parentNodesScope == $scope;
403
+ };
404
+
405
+ $scope.hasChild = function() {
406
+ return $scope.$modelValue.length > 0;
407
+ };
408
+
409
+ $scope.safeApply = function(fn) {
410
+ var phase = this.$root.$$phase;
411
+ if(phase == '$apply' || phase == '$digest') {
412
+ if(fn && (typeof(fn) === 'function')) {
413
+ fn();
414
+ }
415
+ } else {
416
+ this.$apply(fn);
417
+ }
418
+ };
419
+
420
+ $scope.removeNode = function(node) {
421
+ var index = $scope.$modelValue.indexOf(node.$modelValue);
422
+ if (index > -1) {
423
+ $scope.safeApply(function() {
424
+ $scope.$modelValue.splice(index, 1)[0];
425
+ });
426
+ return node;
427
+ }
428
+ return null;
429
+ };
430
+
431
+ $scope.insertNode = function(index, nodeData) {
432
+ $scope.safeApply(function() {
433
+ $scope.$modelValue.splice(index, 0, nodeData);
434
+ });
435
+ };
436
+
437
+ $scope.childNodes = function() {
438
+ var nodes = [];
439
+ if ($scope.$modelValue) {
440
+ for (var i = 0; i < $scope.$modelValue.length; i++) {
441
+ nodes.push($scope.$nodesMap[$scope.$modelValue[i].$$hashKey]);
442
+ }
443
+ }
444
+ return nodes;
445
+ };
446
+
447
+ $scope.depth = function() {
448
+ if ($scope.$nodeScope) {
449
+ return $scope.$nodeScope.depth();
450
+ }
451
+ return 0; // if it has no $nodeScope, it's root
452
+ };
453
+
454
+ // check if depth limit has reached
455
+ $scope.outOfDepth = function(sourceNode) {
456
+ var maxDepth = $scope.maxDepth || $scope.$treeScope.maxDepth;
457
+ if (maxDepth > 0) {
458
+ return $scope.depth() + sourceNode.maxSubDepth() + 1 > maxDepth;
459
+ }
460
+ return false;
461
+ };
462
+
463
+ }
464
+ ]);
465
+ })();
466
+ (function () {
467
+ 'use strict';
468
+
469
+ angular.module('ui.tree')
470
+
471
+ .controller('TreeNodeController', ['$scope', '$element', '$attrs', 'treeConfig',
472
+ function ($scope, $element, $attrs, treeConfig) {
473
+ this.scope = $scope;
474
+
475
+ $scope.$element = $element;
476
+ $scope.$modelValue = null; // Model value for node;
477
+ $scope.$parentNodeScope = null; // uiTreeNode Scope of parent node;
478
+ $scope.$childNodesScope = null; // uiTreeNodes Scope of child nodes.
479
+ $scope.$parentNodesScope = null; // uiTreeNodes Scope of parent nodes.
480
+ $scope.$treeScope = null; // uiTree scope
481
+ $scope.$handleScope = null; // it's handle scope
482
+ $scope.$type = 'uiTreeNode';
483
+ $scope.$$apply = false; //
484
+
485
+ $scope.collapsed = false;
486
+
487
+ $scope.init = function(controllersArr) {
488
+ var treeNodesCtrl = controllersArr[0];
489
+ $scope.$treeScope = controllersArr[1] ? controllersArr[1].scope : null;
490
+
491
+ // find the scope of it's parent node
492
+ $scope.$parentNodeScope = treeNodesCtrl.scope.$nodeScope;
493
+ // modelValue for current node
494
+ $scope.$modelValue = treeNodesCtrl.scope.$modelValue[$scope.$index];
495
+ $scope.$parentNodesScope = treeNodesCtrl.scope;
496
+ treeNodesCtrl.scope.initSubNode($scope); // init sub nodes
497
+
498
+ $element.on('$destroy', function() {
499
+ treeNodesCtrl.scope.destroySubNode($scope); // destroy sub nodes
500
+ });
501
+ };
502
+
503
+ $scope.index = function() {
504
+ return $scope.$parentNodesScope.$modelValue.indexOf($scope.$modelValue);
505
+ };
506
+
507
+ $scope.dragEnabled = function() {
508
+ return !($scope.$treeScope && !$scope.$treeScope.dragEnabled);
509
+ };
510
+
511
+ $scope.isSibling = function(targetNode) {
512
+ return $scope.$parentNodesScope == targetNode.$parentNodesScope;
513
+ };
514
+
515
+ $scope.isChild = function(targetNode) {
516
+ var nodes = $scope.childNodes();
517
+ return nodes && nodes.indexOf(targetNode) > -1;
518
+ };
519
+
520
+ $scope.prev = function() {
521
+ var index = $scope.index();
522
+ if (index > 0) {
523
+ return $scope.siblings()[index - 1];
524
+ }
525
+ return null;
526
+ };
527
+
528
+ $scope.siblings = function() {
529
+ return $scope.$parentNodesScope.childNodes();
530
+ };
531
+
532
+ $scope.childNodesCount = function() {
533
+ return $scope.childNodes() ? $scope.childNodes().length : 0;
534
+ };
535
+
536
+ $scope.hasChild = function() {
537
+ return $scope.childNodesCount() > 0;
538
+ };
539
+
540
+ $scope.childNodes = function() {
541
+ return $scope.$childNodesScope && $scope.$childNodesScope.$modelValue ?
542
+ $scope.$childNodesScope.childNodes() :
543
+ null;
544
+ };
545
+
546
+ $scope.accept = function(sourceNode, destIndex) {
547
+ return $scope.$childNodesScope &&
548
+ $scope.$childNodesScope.$modelValue &&
549
+ $scope.$childNodesScope.accept(sourceNode, destIndex);
550
+ };
551
+
552
+ $scope.removeNode = function(){
553
+ var node = $scope.remove();
554
+ $scope.$callbacks.removed(node);
555
+ return node;
556
+ };
557
+
558
+ $scope.remove = function() {
559
+ return $scope.$parentNodesScope.removeNode($scope);
560
+ };
561
+
562
+ $scope.toggle = function() {
563
+ $scope.collapsed = !$scope.collapsed;
564
+ };
565
+
566
+ $scope.collapse = function() {
567
+ $scope.collapsed = true;
568
+ };
569
+
570
+ $scope.expand = function() {
571
+ $scope.collapsed = false;
572
+ };
573
+
574
+ $scope.depth = function() {
575
+ var parentNode = $scope.$parentNodeScope;
576
+ if (parentNode) {
577
+ return parentNode.depth() + 1;
578
+ }
579
+ return 1;
580
+ };
581
+
582
+ var subDepth = 0;
583
+ var countSubDepth = function(scope) {
584
+ var count = 0;
585
+ var nodes = scope.childNodes();
586
+ for (var i = 0; i < nodes.length; i++) {
587
+ var childNodes = nodes[i].$childNodesScope;
588
+ if (childNodes) {
589
+ count = 1;
590
+ countSubDepth(childNodes);
591
+ }
592
+ }
593
+ subDepth += count;
594
+ };
595
+
596
+ $scope.maxSubDepth = function() {
597
+ subDepth = 0;
598
+ if ($scope.$childNodesScope) {
599
+ countSubDepth($scope.$childNodesScope);
600
+ }
601
+ return subDepth;
602
+ };
603
+
604
+ }
605
+ ]);
606
+ })();
607
+
608
+ (function () {
609
+ 'use strict';
610
+
611
+ angular.module('ui.tree')
612
+
613
+ .controller('TreeHandleController', ['$scope', '$element', '$attrs', 'treeConfig',
614
+ function ($scope, $element, $attrs, treeConfig) {
615
+ this.scope = $scope;
616
+
617
+ $scope.$element = $element;
618
+ $scope.$nodeScope = null;
619
+ $scope.$type = 'uiTreeHandle';
620
+
621
+ }
622
+ ]);
623
+ })();
624
+
625
+ (function () {
626
+ 'use strict';
627
+
628
+ angular.module('ui.tree')
629
+ .directive('uiTree', [ 'treeConfig', '$window',
630
+ function(treeConfig, $window) {
631
+ return {
632
+ restrict: 'A',
633
+ scope: true,
634
+ controller: 'TreeController',
635
+ link: function(scope, element, attrs) {
636
+ var callbacks = {
637
+ accept: null,
638
+ beforeDrag: null
639
+ };
640
+
641
+ var config = {};
642
+ angular.extend(config, treeConfig);
643
+ if (config.treeClass) {
644
+ element.addClass(config.treeClass);
645
+ }
646
+
647
+ scope.$emptyElm = angular.element($window.document.createElement('div'));
648
+ if (config.emptyTreeClass) {
649
+ scope.$emptyElm.addClass(config.emptyTreeClass);
650
+ }
651
+
652
+ scope.$watch('$nodesScope.$modelValue.length', function() {
653
+ if (scope.$nodesScope.$modelValue) {
654
+ scope.resetEmptyElement();
655
+ }
656
+ }, true);
657
+
658
+ scope.$watch(attrs.dragEnabled, function(val) {
659
+ if((typeof val) == "boolean") {
660
+ scope.dragEnabled = val;
661
+ }
662
+ });
663
+
664
+ scope.$watch(attrs.emptyPlaceHolderEnabled, function(val) {
665
+ if((typeof val) == "boolean") {
666
+ scope.emptyPlaceHolderEnabled = val;
667
+ }
668
+ });
669
+
670
+ scope.$watch(attrs.maxDepth, function(val) {
671
+ if((typeof val) == "number") {
672
+ scope.maxDepth = val;
673
+ }
674
+ });
675
+
676
+ scope.$watch(attrs.dragDelay, function(val) {
677
+ if((typeof val) == "number") {
678
+ scope.dragDelay = val;
679
+ }
680
+ });
681
+
682
+ // check if the dest node can accept the dragging node
683
+ // by default, we check the 'data-nodrop' attribute in `ui-tree-nodes`
684
+ // and the 'max-depth' attribute in `ui-tree` or `ui-tree-nodes`.
685
+ // the method can be overrided
686
+ callbacks.accept = function(sourceNodeScope, destNodesScope, destIndex) {
687
+ if (destNodesScope.nodrop || destNodesScope.outOfDepth(sourceNodeScope)) {
688
+ return false;
689
+ }
690
+ return true;
691
+ };
692
+
693
+ callbacks.beforeDrag = function(sourceNodeScope) {
694
+ return true;
695
+ };
696
+
697
+ callbacks.removed = function(node){
698
+
699
+ };
700
+
701
+ callbacks.dropped = function(event) {
702
+
703
+ };
704
+
705
+ //
706
+ callbacks.dragStart = function(event) {
707
+
708
+ };
709
+
710
+ callbacks.dragMove = function(event) {
711
+
712
+ };
713
+
714
+ callbacks.dragStop = function(event) {
715
+
716
+ };
717
+
718
+ callbacks.beforeDrop = function(event) {
719
+
720
+ };
721
+
722
+ scope.$watch(attrs.uiTree, function(newVal, oldVal){
723
+ angular.forEach(newVal, function(value, key){
724
+ if (callbacks[key]) {
725
+ if (typeof value === "function") {
726
+ callbacks[key] = value;
727
+ }
728
+ }
729
+ });
730
+
731
+ scope.$callbacks = callbacks;
732
+ }, true);
733
+
734
+
735
+ }
736
+ };
737
+ }
738
+ ]);
739
+ })();
740
+
741
+ (function () {
742
+ 'use strict';
743
+
744
+ angular.module('ui.tree')
745
+ .directive('uiTreeNodes', [ 'treeConfig', '$window',
746
+ function(treeConfig) {
747
+ return {
748
+ require: ['ngModel', '?^uiTreeNode', '^uiTree'],
749
+ restrict: 'A',
750
+ scope: true,
751
+ controller: 'TreeNodesController',
752
+ link: function(scope, element, attrs, controllersArr) {
753
+
754
+ var config = {};
755
+ angular.extend(config, treeConfig);
756
+ if (config.nodesClass) {
757
+ element.addClass(config.nodesClass);
758
+ }
759
+
760
+ var ngModel = controllersArr[0];
761
+ var treeNodeCtrl = controllersArr[1];
762
+ var treeCtrl = controllersArr[2];
763
+ if (treeNodeCtrl) {
764
+ treeNodeCtrl.scope.$childNodesScope = scope;
765
+ scope.$nodeScope = treeNodeCtrl.scope;
766
+ }
767
+ else { // find the root nodes if there is no parent node and have a parent ui-tree
768
+ treeCtrl.scope.$nodesScope = scope;
769
+ }
770
+ scope.$treeScope = treeCtrl.scope;
771
+
772
+ if (ngModel) {
773
+ ngModel.$render = function() {
774
+ if (!ngModel.$modelValue || !angular.isArray(ngModel.$modelValue)) {
775
+ scope.$modelValue = [];
776
+ }
777
+ scope.$modelValue = ngModel.$modelValue;
778
+ };
779
+ }
780
+
781
+ scope.$watch(attrs.maxDepth, function(val) {
782
+ if((typeof val) == "number") {
783
+ scope.maxDepth = val;
784
+ }
785
+ });
786
+
787
+ scope.$watch(function () {
788
+ return attrs.nodrop;
789
+ }, function (newVal) {
790
+ if((typeof newVal) != "undefined") {
791
+ scope.nodrop = true;
792
+ }
793
+ }, true);
794
+
795
+ attrs.$observe('horizontal', function(val) {
796
+ scope.horizontal = ((typeof val) != "undefined");
797
+ });
798
+
799
+ }
800
+ };
801
+ }
802
+ ]);
803
+ })();
804
+
805
+ (function () {
806
+ 'use strict';
807
+
808
+ angular.module('ui.tree')
809
+
810
+ .directive('uiTreeNode', ['treeConfig', '$uiTreeHelper', '$window', '$document','$timeout',
811
+ function (treeConfig, $uiTreeHelper, $window, $document, $timeout) {
812
+ return {
813
+ require: ['^uiTreeNodes', '^uiTree'],
814
+ restrict: 'A',
815
+ controller: 'TreeNodeController',
816
+ link: function(scope, element, attrs, controllersArr) {
817
+ var config = {};
818
+ angular.extend(config, treeConfig);
819
+ if (config.nodeClass) {
820
+ element.addClass(config.nodeClass);
821
+ }
822
+ scope.init(controllersArr);
823
+
824
+ scope.collapsed = !!$uiTreeHelper.getNodeAttribute(scope, 'collapsed');
825
+
826
+ scope.$watch(attrs.collapsed, function(val) {
827
+ if((typeof val) == "boolean") {
828
+ scope.collapsed = val;
829
+ }
830
+ });
831
+
832
+ scope.$watch('collapsed', function(val) {
833
+ $uiTreeHelper.setNodeAttribute(scope, 'collapsed', val);
834
+ attrs.$set('collapsed', val);
835
+ });
836
+
837
+ var hasTouch = 'ontouchstart' in window;
838
+ // todo startPos is unused
839
+ var startPos, firstMoving, dragInfo, pos;
840
+ var placeElm, hiddenPlaceElm, dragElm;
841
+ var treeScope = null;
842
+ var elements; // As a parameter for callbacks
843
+ var dragDelaying = true;
844
+ var dragStarted = false;
845
+ var dragTimer = null;
846
+ var body = document.body,
847
+ html = document.documentElement,
848
+ document_height,
849
+ document_width;
850
+
851
+ var dragStart = function(e) {
852
+ if (!hasTouch && (e.button == 2 || e.which == 3)) {
853
+ // disable right click
854
+ return;
855
+ }
856
+ if (e.uiTreeDragging || (e.originalEvent && e.originalEvent.uiTreeDragging)) { // event has already fired in other scope.
857
+ return;
858
+ }
859
+
860
+ // the element which is clicked.
861
+ var eventElm = angular.element(e.target);
862
+ var eventScope = eventElm.scope();
863
+ if (!eventScope || !eventScope.$type) {
864
+ return;
865
+ }
866
+ if (eventScope.$type != 'uiTreeNode'
867
+ && eventScope.$type != 'uiTreeHandle') { // Check if it is a node or a handle
868
+ return;
869
+ }
870
+ if (eventScope.$type == 'uiTreeNode'
871
+ && eventScope.$handleScope) { // If the node has a handle, then it should be clicked by the handle
872
+ return;
873
+ }
874
+
875
+ var eventElmTagName = eventElm.prop('tagName').toLowerCase();
876
+ if (eventElmTagName == 'input' ||
877
+ eventElmTagName == 'textarea' ||
878
+ eventElmTagName == 'button' ||
879
+ eventElmTagName == 'select') { // if it's a input or button, ignore it
880
+ return;
881
+ }
882
+
883
+ // check if it or it's parents has a 'data-nodrag' attribute
884
+ while (eventElm && eventElm[0] && eventElm[0] != element) {
885
+ if ($uiTreeHelper.nodrag(eventElm)) { // if the node mark as `nodrag`, DONOT drag it.
886
+ return;
887
+ }
888
+ eventElm = eventElm.parent();
889
+ }
890
+
891
+ if (!scope.beforeDrag(scope)){
892
+ return;
893
+ }
894
+
895
+ e.uiTreeDragging = true; // stop event bubbling
896
+ if (e.originalEvent) {
897
+ e.originalEvent.uiTreeDragging = true;
898
+ }
899
+ e.preventDefault();
900
+ var eventObj = $uiTreeHelper.eventObj(e);
901
+
902
+ firstMoving = true;
903
+ dragInfo = $uiTreeHelper.dragInfo(scope);
904
+
905
+ var tagName = scope.$element.prop('tagName');
906
+ if (tagName.toLowerCase() === 'tr') {
907
+ placeElm = angular.element($window.document.createElement(tagName));
908
+ var tdElm = angular.element($window.document.createElement('td'))
909
+ .addClass(config.placeHolderClass);
910
+ placeElm.append(tdElm);
911
+ } else {
912
+ placeElm = angular.element($window.document.createElement(tagName))
913
+ .addClass(config.placeHolderClass);
914
+ }
915
+ hiddenPlaceElm = angular.element($window.document.createElement(tagName));
916
+ if (config.hiddenClass) {
917
+ hiddenPlaceElm.addClass(config.hiddenClass);
918
+ }
919
+ pos = $uiTreeHelper.positionStarted(eventObj, scope.$element);
920
+ placeElm.css('height', $uiTreeHelper.height(scope.$element) + 'px');
921
+ placeElm.css('width', $uiTreeHelper.width(scope.$element) + 'px');
922
+ dragElm = angular.element($window.document.createElement(scope.$parentNodesScope.$element.prop('tagName')))
923
+ .addClass(scope.$parentNodesScope.$element.attr('class')).addClass(config.dragClass);
924
+ dragElm.css('width', $uiTreeHelper.width(scope.$element) + 'px');
925
+ dragElm.css('z-index', 9999);
926
+
927
+ // Prevents cursor to change rapidly in Opera 12.16 and IE when dragging an element
928
+ var hStyle = (scope.$element[0].querySelector('.angular-ui-tree-handle') || scope.$element[0]).currentStyle;
929
+ if (hStyle) {
930
+ document.body.setAttribute('ui-tree-cursor', $document.find('body').css('cursor') || '');
931
+ $document.find('body').css({'cursor': hStyle.cursor + '!important'});
932
+ }
933
+
934
+ scope.$element.after(placeElm);
935
+ scope.$element.after(hiddenPlaceElm);
936
+ dragElm.append(scope.$element);
937
+ $document.find('body').append(dragElm);
938
+ dragElm.css({
939
+ 'left' : eventObj.pageX - pos.offsetX + 'px',
940
+ 'top' : eventObj.pageY - pos.offsetY + 'px'
941
+ });
942
+ elements = {
943
+ placeholder: placeElm,
944
+ dragging: dragElm
945
+ };
946
+
947
+ angular.element($document).bind('touchend', dragEndEvent);
948
+ angular.element($document).bind('touchcancel', dragEndEvent);
949
+ angular.element($document).bind('touchmove', dragMoveEvent);
950
+ angular.element($document).bind('mouseup', dragEndEvent);
951
+ angular.element($document).bind('mousemove', dragMoveEvent);
952
+ angular.element($document).bind('mouseleave', dragCancelEvent);
953
+
954
+ document_height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
955
+ document_width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
956
+ };
957
+
958
+ var dragMove = function(e) {
959
+ if (!dragStarted) {
960
+ if (!dragDelaying) {
961
+ dragStarted = true;
962
+ scope.$apply(function() {
963
+ scope.$callbacks.dragStart(dragInfo.eventArgs(elements, pos));
964
+ });
965
+ }
966
+ return;
967
+ }
968
+
969
+ var eventObj = $uiTreeHelper.eventObj(e);
970
+ var prev, leftElmPos, topElmPos;
971
+
972
+ if (dragElm) {
973
+ e.preventDefault();
974
+
975
+ if ($window.getSelection) {
976
+ $window.getSelection().removeAllRanges();
977
+ } else if ($window.document.selection) {
978
+ $window.document.selection.empty();
979
+ }
980
+
981
+ leftElmPos = eventObj.pageX - pos.offsetX;
982
+ topElmPos = eventObj.pageY - pos.offsetY;
983
+
984
+ //dragElm can't leave the screen on the left
985
+ if(leftElmPos < 0){
986
+ leftElmPos = 0;
987
+ }
988
+
989
+ //dragElm can't leave the screen on the top
990
+ if(topElmPos < 0){
991
+ topElmPos = 0;
992
+ }
993
+
994
+ //dragElm can't leave the screen on the bottom
995
+ if ((topElmPos + 10) > document_height){
996
+ topElmPos = document_height - 10;
997
+ }
998
+
999
+ //dragElm can't leave the screen on the right
1000
+ if((leftElmPos + 10) > document_width) {
1001
+ leftElmPos = document_width - 10;
1002
+ }
1003
+
1004
+ dragElm.css({
1005
+ 'left': leftElmPos + 'px',
1006
+ 'top': topElmPos + 'px'
1007
+ });
1008
+
1009
+ var top_scroll = window.pageYOffset || $window.document.documentElement.scrollTop;
1010
+ var bottom_scroll = top_scroll + (window.innerHeight || $window.document.clientHeight || $window.document.clientHeight);
1011
+
1012
+ // to scroll down if cursor y-position is greater than the bottom position the vertical scroll
1013
+ if (bottom_scroll < eventObj.pageY && bottom_scroll <= document_height) {
1014
+ window.scrollBy(0, 10);
1015
+ }
1016
+
1017
+ // to scroll top if cursor y-position is less than the top position the vertical scroll
1018
+ if (top_scroll > eventObj.pageY) {
1019
+ window.scrollBy(0, -10);
1020
+ }
1021
+
1022
+ $uiTreeHelper.positionMoved(e, pos, firstMoving);
1023
+ if (firstMoving) {
1024
+ firstMoving = false;
1025
+ return;
1026
+ }
1027
+
1028
+ // move horizontal
1029
+ if (pos.dirAx && pos.distAxX >= config.levelThreshold) {
1030
+ pos.distAxX = 0;
1031
+
1032
+ // increase horizontal level if previous sibling exists and is not collapsed
1033
+ if (pos.distX > 0) {
1034
+ prev = dragInfo.prev();
1035
+ if (prev && !prev.collapsed
1036
+ && prev.accept(scope, prev.childNodesCount())) {
1037
+ prev.$childNodesScope.$element.append(placeElm);
1038
+ dragInfo.moveTo(prev.$childNodesScope, prev.childNodes(), prev.childNodesCount());
1039
+ }
1040
+ }
1041
+
1042
+ // decrease horizontal level
1043
+ if (pos.distX < 0) {
1044
+ // we can't decrease a level if an item preceeds the current one
1045
+ var next = dragInfo.next();
1046
+ if (!next) {
1047
+ var target = dragInfo.parentNode(); // As a sibling of it's parent node
1048
+ if (target
1049
+ && target.$parentNodesScope.accept(scope, target.index() + 1)) {
1050
+ target.$element.after(placeElm);
1051
+ dragInfo.moveTo(target.$parentNodesScope, target.siblings(), target.index() + 1);
1052
+ }
1053
+ }
1054
+ }
1055
+ }
1056
+
1057
+ // check if add it as a child node first
1058
+ // todo decrease is unused
1059
+ var decrease = ($uiTreeHelper.offset(dragElm).left - $uiTreeHelper.offset(placeElm).left) >= config.threshold;
1060
+ var targetX = eventObj.pageX - $window.document.body.scrollLeft;
1061
+ var targetY = eventObj.pageY - (window.pageYOffset || $window.document.documentElement.scrollTop);
1062
+
1063
+ // Select the drag target. Because IE does not support CSS 'pointer-events: none', it will always
1064
+ // pick the drag element itself as the target. To prevent this, we hide the drag element while
1065
+ // selecting the target.
1066
+ var displayElm;
1067
+ if (angular.isFunction(dragElm.hide)) {
1068
+ dragElm.hide();
1069
+ }else{
1070
+ displayElm = dragElm[0].style.display;
1071
+ dragElm[0].style.display = "none";
1072
+ }
1073
+
1074
+ // when using elementFromPoint() inside an iframe, you have to call
1075
+ // elementFromPoint() twice to make sure IE8 returns the correct value
1076
+ $window.document.elementFromPoint(targetX, targetY);
1077
+
1078
+ var targetElm = angular.element($window.document.elementFromPoint(targetX, targetY));
1079
+ if (angular.isFunction(dragElm.show)) {
1080
+ dragElm.show();
1081
+ }else{
1082
+ dragElm[0].style.display = displayElm;
1083
+ }
1084
+
1085
+ // move vertical
1086
+ if (!pos.dirAx) {
1087
+ var targetBefore, targetNode;
1088
+ // check it's new position
1089
+ targetNode = targetElm.scope();
1090
+ var isEmpty = false;
1091
+ if (!targetNode) {
1092
+ return;
1093
+ }
1094
+ if (targetNode.$type == 'uiTree' && targetNode.dragEnabled) {
1095
+ isEmpty = targetNode.isEmpty(); // Check if it's empty tree
1096
+ }
1097
+ if (targetNode.$type == 'uiTreeHandle') {
1098
+ targetNode = targetNode.$nodeScope;
1099
+ }
1100
+ if (targetNode.$type != 'uiTreeNode'
1101
+ && !isEmpty) { // Check if it is a uiTreeNode or it's an empty tree
1102
+ return;
1103
+ }
1104
+
1105
+ // if placeholder move from empty tree, reset it.
1106
+ if (treeScope && placeElm.parent()[0] != treeScope.$element[0]) {
1107
+ treeScope.resetEmptyElement();
1108
+ treeScope = null;
1109
+ }
1110
+
1111
+ if (isEmpty) { // it's an empty tree
1112
+ treeScope = targetNode;
1113
+ if (targetNode.$nodesScope.accept(scope, 0)) {
1114
+ targetNode.place(placeElm);
1115
+ dragInfo.moveTo(targetNode.$nodesScope, targetNode.$nodesScope.childNodes(), 0);
1116
+ }
1117
+ } else if (targetNode.dragEnabled()){ // drag enabled
1118
+ targetElm = targetNode.$element; // Get the element of ui-tree-node
1119
+ var targetOffset = $uiTreeHelper.offset(targetElm);
1120
+ targetBefore = targetNode.horizontal ? eventObj.pageX < (targetOffset.left + $uiTreeHelper.width(targetElm) / 2)
1121
+ : eventObj.pageY < (targetOffset.top + $uiTreeHelper.height(targetElm) / 2);
1122
+
1123
+ if (targetNode.$parentNodesScope.accept(scope, targetNode.index())) {
1124
+ if (targetBefore) {
1125
+ targetElm[0].parentNode.insertBefore(placeElm[0], targetElm[0]);
1126
+ dragInfo.moveTo(targetNode.$parentNodesScope, targetNode.siblings(), targetNode.index());
1127
+ } else {
1128
+ targetElm.after(placeElm);
1129
+ dragInfo.moveTo(targetNode.$parentNodesScope, targetNode.siblings(), targetNode.index() + 1);
1130
+ }
1131
+ }
1132
+ else if (!targetBefore && targetNode.accept(scope, targetNode.childNodesCount())) { // we have to check if it can add the dragging node as a child
1133
+ targetNode.$childNodesScope.$element.append(placeElm);
1134
+ dragInfo.moveTo(targetNode.$childNodesScope, targetNode.childNodes(), targetNode.childNodesCount());
1135
+ }
1136
+ }
1137
+
1138
+ }
1139
+
1140
+ scope.$apply(function() {
1141
+ scope.$callbacks.dragMove(dragInfo.eventArgs(elements, pos));
1142
+ });
1143
+ }
1144
+ };
1145
+
1146
+ var dragEnd = function(e) {
1147
+ e.preventDefault();
1148
+
1149
+ if (dragElm) {
1150
+ scope.$treeScope.$apply(function() {
1151
+ scope.$callbacks.beforeDrop(dragInfo.eventArgs(elements, pos));
1152
+ });
1153
+ // roll back elements changed
1154
+ hiddenPlaceElm.replaceWith(scope.$element);
1155
+ placeElm.remove();
1156
+
1157
+ dragElm.remove();
1158
+ dragElm = null;
1159
+ if (scope.$$apply) {
1160
+ dragInfo.apply();
1161
+ scope.$treeScope.$apply(function() {
1162
+ scope.$callbacks.dropped(dragInfo.eventArgs(elements, pos));
1163
+ });
1164
+ } else {
1165
+ bindDrag();
1166
+ }
1167
+ scope.$treeScope.$apply(function() {
1168
+ scope.$callbacks.dragStop(dragInfo.eventArgs(elements, pos));
1169
+ });
1170
+ scope.$$apply = false;
1171
+ dragInfo = null;
1172
+
1173
+ }
1174
+
1175
+ // Restore cursor in Opera 12.16 and IE
1176
+ var oldCur = document.body.getAttribute('ui-tree-cursor');
1177
+ if (oldCur !== null) {
1178
+ $document.find('body').css({'cursor': oldCur});
1179
+ document.body.removeAttribute('ui-tree-cursor');
1180
+ }
1181
+
1182
+ angular.element($document).unbind('touchend', dragEndEvent); // Mobile
1183
+ angular.element($document).unbind('touchcancel', dragEndEvent); // Mobile
1184
+ angular.element($document).unbind('touchmove', dragMoveEvent); // Mobile
1185
+ angular.element($document).unbind('mouseup', dragEndEvent);
1186
+ angular.element($document).unbind('mousemove', dragMoveEvent);
1187
+ angular.element($window.document.body).unbind('mouseleave', dragCancelEvent);
1188
+ };
1189
+
1190
+ var dragStartEvent = function(e) {
1191
+ if (scope.dragEnabled()) {
1192
+ dragStart(e);
1193
+ }
1194
+ };
1195
+
1196
+ var dragMoveEvent = function(e) {
1197
+ dragMove(e);
1198
+ };
1199
+
1200
+ var dragEndEvent = function(e) {
1201
+ scope.$$apply = true;
1202
+ dragEnd(e);
1203
+ };
1204
+
1205
+ var dragCancelEvent = function(e) {
1206
+ dragEnd(e);
1207
+ };
1208
+
1209
+ var bindDrag = function() {
1210
+ element.bind('touchstart mousedown', function (e) {
1211
+ dragDelaying = true;
1212
+ dragStarted = false;
1213
+ dragStartEvent(e);
1214
+ dragTimer = $timeout(function(){dragDelaying = false;}, scope.dragDelay);
1215
+ });
1216
+ element.bind('touchend touchcancel mouseup',function(){$timeout.cancel(dragTimer);});
1217
+ };
1218
+ bindDrag();
1219
+
1220
+ angular.element($window.document.body).bind("keydown", function(e) {
1221
+ if (e.keyCode == 27) {
1222
+ scope.$$apply = false;
1223
+ dragEnd(e);
1224
+ }
1225
+ });
1226
+ }
1227
+ };
1228
+ }
1229
+ ]);
1230
+
1231
+ })();
1232
+
1233
+ (function () {
1234
+ 'use strict';
1235
+
1236
+ angular.module('ui.tree')
1237
+ .directive('uiTreeHandle', [ 'treeConfig', '$window',
1238
+ function(treeConfig) {
1239
+ return {
1240
+ require: '^uiTreeNode',
1241
+ restrict: 'A',
1242
+ scope: true,
1243
+ controller: 'TreeHandleController',
1244
+ link: function(scope, element, attrs, treeNodeCtrl) {
1245
+ var config = {};
1246
+ angular.extend(config, treeConfig);
1247
+ if (config.handleClass) {
1248
+ element.addClass(config.handleClass);
1249
+ }
1250
+ // connect with the tree node.
1251
+ if (scope != treeNodeCtrl.scope) {
1252
+ scope.$nodeScope = treeNodeCtrl.scope;
1253
+ treeNodeCtrl.scope.$handleScope = scope;
1254
+ }
1255
+ }
1256
+ };
1257
+ }
1258
+ ]);
1259
+ })();