jquery_sortable_tree 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (328) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +22 -0
  3. data/README.md +319 -0
  4. data/Rakefile +36 -0
  5. data/app/assets/images/iconza/icons/add.png +0 -0
  6. data/app/assets/images/iconza/icons/delete.png +0 -0
  7. data/app/assets/images/iconza/icons/edit.png +0 -0
  8. data/app/assets/images/iconza/icons/move.png +0 -0
  9. data/app/assets/images/iconza/icons/red_add.png +0 -0
  10. data/app/assets/images/iconza/icons/red_delete.png +0 -0
  11. data/app/assets/images/iconza/icons/red_edit.png +0 -0
  12. data/app/assets/images/iconza/icons/red_move.png +0 -0
  13. data/app/assets/javascripts/expandable_tree/expandable_tree.js.coffee +104 -0
  14. data/app/assets/javascripts/expandable_tree/hashchange.js.coffee +33 -0
  15. data/app/assets/javascripts/expandable_tree/initializer.js +6 -0
  16. data/app/assets/javascripts/expandable_tree/jquery.cookie.coffee +68 -0
  17. data/app/assets/javascripts/expandable_tree/restorable.js.coffee +125 -0
  18. data/app/assets/javascripts/nested_sortable/inline_operations.js.coffee +56 -0
  19. data/app/assets/javascripts/nested_sortable/jquery.ui.nestedSortable.js +358 -0
  20. data/app/assets/javascripts/render_tree_helper.js.coffee +82 -0
  21. data/app/assets/javascripts/sortable_tree/initializer.js +3 -0
  22. data/app/assets/javascripts/sortable_tree/sortable_tree.js.coffee +60 -0
  23. data/app/assets/stylesheets/expandable_tree.css.scss +26 -0
  24. data/app/assets/stylesheets/nested_options.css.scss +25 -0
  25. data/app/assets/stylesheets/sortable_tree.css.scss +108 -0
  26. data/app/assets/stylesheets/tree.css.scss +35 -0
  27. data/app/controllers/jquery_sortable_tree_controller.rb +93 -0
  28. data/app/helpers/jquery_sortable_tree_helper/render_expandable_tree_helper.rb +27 -0
  29. data/app/helpers/jquery_sortable_tree_helper/render_indented_options_helper.rb +37 -0
  30. data/app/helpers/jquery_sortable_tree_helper/render_nested_options_helper.rb +29 -0
  31. data/app/helpers/jquery_sortable_tree_helper/render_sortable_tree_helper.rb +65 -0
  32. data/app/helpers/jquery_sortable_tree_helper/render_tree_helper.rb +23 -0
  33. data/app/helpers/jquery_sortable_tree_helper.rb +142 -0
  34. data/app/inputs/indented_collection_select_input.rb +12 -0
  35. data/lib/fake.example +44 -0
  36. data/lib/generators/jquery_sortable_tree/views_generator.rb +56 -0
  37. data/lib/jquery_sortable_tree/engine.rb +6 -0
  38. data/lib/jquery_sortable_tree/version.rb +3 -0
  39. data/lib/jquery_sortable_tree.rb +13 -0
  40. data/spec/dummy_app/Gemfile +38 -0
  41. data/spec/dummy_app/Gemfile.lock +206 -0
  42. data/spec/dummy_app/README.md +48 -0
  43. data/spec/dummy_app/Rakefile +7 -0
  44. data/spec/dummy_app/_test/fixtures/admin/pages.yml +7 -0
  45. data/spec/dummy_app/_test/fixtures/article_categories.yml +9 -0
  46. data/spec/dummy_app/_test/fixtures/comments.yml +13 -0
  47. data/spec/dummy_app/_test/fixtures/inventory/categories.yml +9 -0
  48. data/spec/dummy_app/_test/functional/inventory/category_controller_test.rb +14 -0
  49. data/spec/dummy_app/_test/performance/browsing_test.rb +12 -0
  50. data/spec/dummy_app/_test/test_helper.rb +13 -0
  51. data/spec/dummy_app/_test/unit/admin/page_test.rb +7 -0
  52. data/spec/dummy_app/_test/unit/article_category_test.rb +7 -0
  53. data/spec/dummy_app/_test/unit/comment_test.rb +7 -0
  54. data/spec/dummy_app/_test/unit/helpers/inventory/category_helper_test.rb +4 -0
  55. data/spec/dummy_app/_test/unit/inventory/category_test.rb +7 -0
  56. data/spec/dummy_app/app/assets/images/rails.png +0 -0
  57. data/spec/dummy_app/app/assets/javascripts/application.js +11 -0
  58. data/spec/dummy_app/app/assets/stylesheets/application.css +11 -0
  59. data/spec/dummy_app/app/controllers/admin/pages_controller.rb +35 -0
  60. data/spec/dummy_app/app/controllers/application_controller.rb +3 -0
  61. data/spec/dummy_app/app/controllers/article_categories_controller.rb +11 -0
  62. data/spec/dummy_app/app/controllers/inventory/categories_controller.rb +15 -0
  63. data/spec/dummy_app/app/controllers/pages_controller.rb +30 -0
  64. data/spec/dummy_app/app/controllers/welcome_controller.rb +3 -0
  65. data/spec/dummy_app/app/models/admin/page.rb +4 -0
  66. data/spec/dummy_app/app/models/admin.rb +5 -0
  67. data/spec/dummy_app/app/models/article_category.rb +4 -0
  68. data/spec/dummy_app/app/models/inventory/category.rb +4 -0
  69. data/spec/dummy_app/app/models/inventory.rb +5 -0
  70. data/spec/dummy_app/app/models/page.rb +4 -0
  71. data/spec/dummy_app/app/views/admin/pages/indented_options.html.haml +3 -0
  72. data/spec/dummy_app/app/views/admin/pages/index.html.haml +8 -0
  73. data/spec/dummy_app/app/views/admin/pages/manage.html.haml +3 -0
  74. data/spec/dummy_app/app/views/admin/pages/namespaced_link.html.haml +3 -0
  75. data/spec/dummy_app/app/views/admin/pages/nested_options.html.haml +3 -0
  76. data/spec/dummy_app/app/views/admin/pages/node_manage.html.haml +12 -0
  77. data/spec/dummy_app/app/views/article_categories/index.html.haml +3 -0
  78. data/spec/dummy_app/app/views/article_categories/manage.html.haml +4 -0
  79. data/spec/dummy_app/app/views/inventory/categories/index.html.haml +3 -0
  80. data/spec/dummy_app/app/views/inventory/categories/manage.html.haml +4 -0
  81. data/spec/dummy_app/app/views/layouts/application.html.erb +18 -0
  82. data/spec/dummy_app/app/views/pages/expand.html.haml +8 -0
  83. data/spec/dummy_app/app/views/pages/expand_node.html.haml +1 -0
  84. data/spec/dummy_app/app/views/pages/indented_options.html.haml +3 -0
  85. data/spec/dummy_app/app/views/pages/index.html.haml +3 -0
  86. data/spec/dummy_app/app/views/pages/manage.html.haml +7 -0
  87. data/spec/dummy_app/app/views/pages/nested_options.html.haml +3 -0
  88. data/spec/dummy_app/app/views/welcome/index.html.haml +42 -0
  89. data/spec/dummy_app/config/application.rb +48 -0
  90. data/spec/dummy_app/config/boot.rb +6 -0
  91. data/spec/dummy_app/config/database.yml +7 -0
  92. data/spec/dummy_app/config/database.yml.example +7 -0
  93. data/spec/dummy_app/config/environment.rb +5 -0
  94. data/spec/dummy_app/config/environments/development.rb +30 -0
  95. data/spec/dummy_app/config/environments/production.rb +61 -0
  96. data/spec/dummy_app/config/environments/test.rb +42 -0
  97. data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
  98. data/spec/dummy_app/config/initializers/inflections.rb +10 -0
  99. data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
  100. data/spec/dummy_app/config/initializers/secret_token.rb +7 -0
  101. data/spec/dummy_app/config/initializers/session_store.rb +8 -0
  102. data/spec/dummy_app/config/initializers/wrap_parameters.rb +14 -0
  103. data/spec/dummy_app/config/locales/en.yml +28 -0
  104. data/spec/dummy_app/config/routes.rb +53 -0
  105. data/spec/dummy_app/config.ru +4 -0
  106. data/spec/dummy_app/db/development.db +0 -0
  107. data/spec/dummy_app/db/migrate/20120211053457_create_pages.rb +16 -0
  108. data/spec/dummy_app/db/migrate/20120503173258_create_article_categories.rb +16 -0
  109. data/spec/dummy_app/db/migrate/20120508093823_create_inventory_categories.rb +16 -0
  110. data/spec/dummy_app/db/migrate/20130128160328_create_admin_pages.rb +16 -0
  111. data/spec/dummy_app/db/schema.rb +64 -0
  112. data/spec/dummy_app/db/seeds.rb +97 -0
  113. data/spec/dummy_app/db/test.db +0 -0
  114. data/spec/dummy_app/doc/README_FOR_APP +2 -0
  115. data/spec/dummy_app/lib/tasks/db_bootstrap.rake +16 -0
  116. data/spec/dummy_app/log/development.log +22714 -0
  117. data/spec/dummy_app/public/404.html +26 -0
  118. data/spec/dummy_app/public/422.html +26 -0
  119. data/spec/dummy_app/public/500.html +26 -0
  120. data/spec/dummy_app/public/favicon.ico +0 -0
  121. data/spec/dummy_app/public/robots.txt +5 -0
  122. data/spec/dummy_app/script/rails +6 -0
  123. data/spec/dummy_app/spec/build_tree_helper.rb +39 -0
  124. data/spec/dummy_app/spec/spec_helper.rb +52 -0
  125. data/spec/dummy_app/spec/views/pages/index.html.haml_spec.rb +48 -0
  126. data/spec/dummy_app/tmp/cache/assets/development/sass/8ecb1409c36a90649b49ac975da6493b50db6d95/expandable_tree.css.scssc +0 -0
  127. data/spec/dummy_app/tmp/cache/assets/development/sass/8ecb1409c36a90649b49ac975da6493b50db6d95/nested_options.css.scssc +0 -0
  128. data/spec/dummy_app/tmp/cache/assets/development/sass/8ecb1409c36a90649b49ac975da6493b50db6d95/sortable_tree.css.scssc +0 -0
  129. data/spec/dummy_app/tmp/cache/assets/development/sass/8ecb1409c36a90649b49ac975da6493b50db6d95/tree.css.scssc +0 -0
  130. data/spec/dummy_app/tmp/cache/assets/development/sprockets/058d9080443081a540c61e79945ebf47 +0 -0
  131. data/spec/dummy_app/tmp/cache/assets/development/sprockets/06512a74da586fbbce22e1cd023f5f9b +0 -0
  132. data/spec/dummy_app/tmp/cache/assets/development/sprockets/06f9ffc86fda6ef4279cabf09f68e631 +0 -0
  133. data/spec/dummy_app/tmp/cache/assets/development/sprockets/0702872e43cbcc4c2b6d097f7fe035e7 +0 -0
  134. data/spec/dummy_app/tmp/cache/assets/development/sprockets/07400ad691b6b3bbcf10ee74e64d72b7 +0 -0
  135. data/spec/dummy_app/tmp/cache/assets/development/sprockets/0a382d7e102e254c52006bed6975001d +0 -0
  136. data/spec/dummy_app/tmp/cache/assets/development/sprockets/0a8a33aec09977105c0190f6b8c2ca49 +0 -0
  137. data/spec/dummy_app/tmp/cache/assets/development/sprockets/0b2e7c9a5645a67e6af72feeaa70b633 +0 -0
  138. data/spec/dummy_app/tmp/cache/assets/development/sprockets/0c5e7aa7ad8e39ced2e25d911b060c3a +0 -0
  139. data/spec/dummy_app/tmp/cache/assets/development/sprockets/0fc4a5842f45f40d2e1283df0025ac7e +0 -0
  140. data/spec/dummy_app/tmp/cache/assets/development/sprockets/12eb4832c22cd32076db3d3eddcd941b +0 -0
  141. data/spec/dummy_app/tmp/cache/assets/development/sprockets/13d999d14a434a925372c43c3633f355 +0 -0
  142. data/spec/dummy_app/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  143. data/spec/dummy_app/tmp/cache/assets/development/sprockets/14805e3ed08782f4b821fe6cfd03d911 +0 -0
  144. data/spec/dummy_app/tmp/cache/assets/development/sprockets/15cc819db1fd73a5d6ccd95fba030668 +0 -0
  145. data/spec/dummy_app/tmp/cache/assets/development/sprockets/1607bba44953c4434330d20d0cd747f4 +0 -0
  146. data/spec/dummy_app/tmp/cache/assets/development/sprockets/16b9e0f8dc1fdd8bea7b606f065d205d +0 -0
  147. data/spec/dummy_app/tmp/cache/assets/development/sprockets/1a780b90bf4d532e88e6943e93f18320 +0 -0
  148. data/spec/dummy_app/tmp/cache/assets/development/sprockets/1e445aefca5bc750ef4f584ec1dc0849 +0 -0
  149. data/spec/dummy_app/tmp/cache/assets/development/sprockets/1e9c5d8fa6de36416732b4eb490ceb6f +0 -0
  150. data/spec/dummy_app/tmp/cache/assets/development/sprockets/1ea633756c6cc95716a7887e44f88da7 +0 -0
  151. data/spec/dummy_app/tmp/cache/assets/development/sprockets/1ece2c45f188a29a36b208442154f8a2 +0 -0
  152. data/spec/dummy_app/tmp/cache/assets/development/sprockets/2172c90088dc36adff9ec10b3384286e +0 -0
  153. data/spec/dummy_app/tmp/cache/assets/development/sprockets/2489731b3ac988935fe92593f0f2edbf +0 -0
  154. data/spec/dummy_app/tmp/cache/assets/development/sprockets/27c712c397ece8a28de4ff2044a3f722 +0 -0
  155. data/spec/dummy_app/tmp/cache/assets/development/sprockets/28eefd9e9c7ea2e1414cd10a6d184ae5 +0 -0
  156. data/spec/dummy_app/tmp/cache/assets/development/sprockets/2a013e71f11699ea897968c03d3f4355 +0 -0
  157. data/spec/dummy_app/tmp/cache/assets/development/sprockets/2c4f283baa7b297e503fe2d75f959b06 +0 -0
  158. data/spec/dummy_app/tmp/cache/assets/development/sprockets/2cf86cf22c1bd9a69271904cb4a1c131 +0 -0
  159. data/spec/dummy_app/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  160. data/spec/dummy_app/tmp/cache/assets/development/sprockets/2fa38257718e8b4641d97f10b43d1ac7 +0 -0
  161. data/spec/dummy_app/tmp/cache/assets/development/sprockets/2fd038eaf9bbdb2d1f4fe4afd3aeb654 +0 -0
  162. data/spec/dummy_app/tmp/cache/assets/development/sprockets/303d5268aec48d5bd29ea616e15ea1cd +0 -0
  163. data/spec/dummy_app/tmp/cache/assets/development/sprockets/309e5bc3a9891c7dfcb01887b7c973a5 +0 -0
  164. data/spec/dummy_app/tmp/cache/assets/development/sprockets/30f138394dc8bad04a7ad6c19f3ee922 +0 -0
  165. data/spec/dummy_app/tmp/cache/assets/development/sprockets/31036ef469da85883b40b6b4ee37e61e +0 -0
  166. data/spec/dummy_app/tmp/cache/assets/development/sprockets/31a9b7e7b828d0633af58b75c59273de +0 -0
  167. data/spec/dummy_app/tmp/cache/assets/development/sprockets/332ad2cb8debd7079dda31bd72d43806 +0 -0
  168. data/spec/dummy_app/tmp/cache/assets/development/sprockets/344185411a898184d8eaa3f96536e50f +0 -0
  169. data/spec/dummy_app/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  170. data/spec/dummy_app/tmp/cache/assets/development/sprockets/364e7109a425ab206d5f8881b5d37cfc +0 -0
  171. data/spec/dummy_app/tmp/cache/assets/development/sprockets/37dd73a179070963cb766a24703a58a1 +0 -0
  172. data/spec/dummy_app/tmp/cache/assets/development/sprockets/39c9026282a865c56fac8e234419eb61 +0 -0
  173. data/spec/dummy_app/tmp/cache/assets/development/sprockets/3a592f975983e33afd63283ecac1de80 +0 -0
  174. data/spec/dummy_app/tmp/cache/assets/development/sprockets/3a7a7c1950ba3ca0968d0c8ffc9b8635 +0 -0
  175. data/spec/dummy_app/tmp/cache/assets/development/sprockets/3ab09536f24f9fbe56a56a012bf266d7 +0 -0
  176. data/spec/dummy_app/tmp/cache/assets/development/sprockets/3b22caac59de2c2af20c0e8bf86cf015 +0 -0
  177. data/spec/dummy_app/tmp/cache/assets/development/sprockets/3dbf5c413607e86fa3ff1f931887217e +0 -0
  178. data/spec/dummy_app/tmp/cache/assets/development/sprockets/4063ac4ee22e83471de121940c9a9689 +0 -0
  179. data/spec/dummy_app/tmp/cache/assets/development/sprockets/425aa438199f939cf930519e27539355 +0 -0
  180. data/spec/dummy_app/tmp/cache/assets/development/sprockets/43485146d4435be69b94512f4871b48a +0 -0
  181. data/spec/dummy_app/tmp/cache/assets/development/sprockets/43c3c0bfd40d48fa470d6369b70c4ed5 +0 -0
  182. data/spec/dummy_app/tmp/cache/assets/development/sprockets/44290e987cc9e134606381c2ed4c3e19 +0 -0
  183. data/spec/dummy_app/tmp/cache/assets/development/sprockets/450d1a68e0d88f6f859522ccf0e7fa75 +0 -0
  184. data/spec/dummy_app/tmp/cache/assets/development/sprockets/46ff8eb0f50fc17b55b2e65a1a9a1832 +0 -0
  185. data/spec/dummy_app/tmp/cache/assets/development/sprockets/498d1a8d06e7b8bd347f41609dfe7dbc +0 -0
  186. data/spec/dummy_app/tmp/cache/assets/development/sprockets/4da7d8ac21ee8ee7cbdde2edd894cc4e +0 -0
  187. data/spec/dummy_app/tmp/cache/assets/development/sprockets/505027f29aa1c70c5425d19ea9fb77ce +0 -0
  188. data/spec/dummy_app/tmp/cache/assets/development/sprockets/5073b1f44a8a2ee95c4368fb2610360d +0 -0
  189. data/spec/dummy_app/tmp/cache/assets/development/sprockets/50b1ef23635589d50f9b31642903f67c +0 -0
  190. data/spec/dummy_app/tmp/cache/assets/development/sprockets/51663175018a723eb6432251c4ff2e2a +0 -0
  191. data/spec/dummy_app/tmp/cache/assets/development/sprockets/5287e92c354e3bafe071e5853eb65ced +0 -0
  192. data/spec/dummy_app/tmp/cache/assets/development/sprockets/52955fb6b1313a736917570386d038f7 +0 -0
  193. data/spec/dummy_app/tmp/cache/assets/development/sprockets/54603322364591c06b6250b0584ab27e +0 -0
  194. data/spec/dummy_app/tmp/cache/assets/development/sprockets/55d364519e6304a1d512d881ced67211 +0 -0
  195. data/spec/dummy_app/tmp/cache/assets/development/sprockets/56d487b917bb9ff84706849c66fee0c7 +0 -0
  196. data/spec/dummy_app/tmp/cache/assets/development/sprockets/59f72211dfd90317c1bc78a481ae189d +0 -0
  197. data/spec/dummy_app/tmp/cache/assets/development/sprockets/5c6b037458b3843da5366697c858985e +0 -0
  198. data/spec/dummy_app/tmp/cache/assets/development/sprockets/5e8f4ca85fe26be682d2e563f23f1f9e +0 -0
  199. data/spec/dummy_app/tmp/cache/assets/development/sprockets/5f6cb8d54ddfd855f5fbfb72a4aac107 +0 -0
  200. data/spec/dummy_app/tmp/cache/assets/development/sprockets/6016aac84581a1ff8e9503adf790f0eb +0 -0
  201. data/spec/dummy_app/tmp/cache/assets/development/sprockets/604f08938cbe197b663267d4ac623b3c +0 -0
  202. data/spec/dummy_app/tmp/cache/assets/development/sprockets/63703decf049effbdea24cb40c7d8feb +0 -0
  203. data/spec/dummy_app/tmp/cache/assets/development/sprockets/65a64732023d6edc64645f6d67ab6376 +0 -0
  204. data/spec/dummy_app/tmp/cache/assets/development/sprockets/67e64bdc647ff62357f616466875cc05 +0 -0
  205. data/spec/dummy_app/tmp/cache/assets/development/sprockets/685130c66086333bc60a3e13426e637d +0 -0
  206. data/spec/dummy_app/tmp/cache/assets/development/sprockets/68bc948f8a4f37f1b96c1ccef3501603 +0 -0
  207. data/spec/dummy_app/tmp/cache/assets/development/sprockets/68df326b958b409f9811f1aa1ae3df75 +0 -0
  208. data/spec/dummy_app/tmp/cache/assets/development/sprockets/693bc2b458236fe0f3db96348cb0d0dc +0 -0
  209. data/spec/dummy_app/tmp/cache/assets/development/sprockets/699daefc627fb5fde880b9a0791933b6 +0 -0
  210. data/spec/dummy_app/tmp/cache/assets/development/sprockets/6aba4f56935b86463d039d0849f8a4b4 +0 -0
  211. data/spec/dummy_app/tmp/cache/assets/development/sprockets/6ff566ad21a9b0caa51f55b63848d1d5 +0 -0
  212. data/spec/dummy_app/tmp/cache/assets/development/sprockets/729d2237d10c9e2170d23785478ca63f +0 -0
  213. data/spec/dummy_app/tmp/cache/assets/development/sprockets/76a8cd7f52d42a76574338632a5356d6 +0 -0
  214. data/spec/dummy_app/tmp/cache/assets/development/sprockets/779d045bffa46a9da91572f71bb4f33a +0 -0
  215. data/spec/dummy_app/tmp/cache/assets/development/sprockets/78762c001b9b200fa9963eee922b41d0 +0 -0
  216. data/spec/dummy_app/tmp/cache/assets/development/sprockets/7991e04eb66b191a868dbb38c761d2da +0 -0
  217. data/spec/dummy_app/tmp/cache/assets/development/sprockets/7af26b28f05d60534b847b073340b9d0 +0 -0
  218. data/spec/dummy_app/tmp/cache/assets/development/sprockets/7c3ec870c8e901cb6ca171c7345618c2 +0 -0
  219. data/spec/dummy_app/tmp/cache/assets/development/sprockets/7d5d91f945b7415354d7f6d3653e7d80 +0 -0
  220. data/spec/dummy_app/tmp/cache/assets/development/sprockets/7eecec59a10631fead107d7e8c265910 +0 -0
  221. data/spec/dummy_app/tmp/cache/assets/development/sprockets/8497b02b98b9d3a6e78388d6c1bab1f1 +0 -0
  222. data/spec/dummy_app/tmp/cache/assets/development/sprockets/858868dacf187de97fe2580f31d09dbe +0 -0
  223. data/spec/dummy_app/tmp/cache/assets/development/sprockets/859c3817c6f5b6d64e457ccd9a33d5a2 +0 -0
  224. data/spec/dummy_app/tmp/cache/assets/development/sprockets/86f13c507e9e995021b05371d252c33c +0 -0
  225. data/spec/dummy_app/tmp/cache/assets/development/sprockets/8717579ef5b551df9b2635f59120a0e1 +0 -0
  226. data/spec/dummy_app/tmp/cache/assets/development/sprockets/888dd6c485e0655b1ca9bfde716acdda +0 -0
  227. data/spec/dummy_app/tmp/cache/assets/development/sprockets/88b7acf651a9d0e1c9b3c8e6db719467 +0 -0
  228. data/spec/dummy_app/tmp/cache/assets/development/sprockets/88f65fc30613c8283f186e248253c020 +0 -0
  229. data/spec/dummy_app/tmp/cache/assets/development/sprockets/8a6aebb20a64dd2680834fa0d28bf832 +0 -0
  230. data/spec/dummy_app/tmp/cache/assets/development/sprockets/8a7d0e83eaa7cfb2826796e2c1a81a65 +0 -0
  231. data/spec/dummy_app/tmp/cache/assets/development/sprockets/902a894fafabac558abf12953428d975 +0 -0
  232. data/spec/dummy_app/tmp/cache/assets/development/sprockets/90c19158b0d4f03b467216c6f9b61af2 +0 -0
  233. data/spec/dummy_app/tmp/cache/assets/development/sprockets/91da1a8fa92fc4acdb6f8fb1658eff85 +0 -0
  234. data/spec/dummy_app/tmp/cache/assets/development/sprockets/958c546e8b56eecbfd2357ee9984f986 +0 -0
  235. data/spec/dummy_app/tmp/cache/assets/development/sprockets/977fe9c1da3ce7cbef3ec54cd7681b57 +0 -0
  236. data/spec/dummy_app/tmp/cache/assets/development/sprockets/98048e0cb396b79d4352a7d10737bc22 +0 -0
  237. data/spec/dummy_app/tmp/cache/assets/development/sprockets/9828e6214ad484fda452904b4591a6ba +0 -0
  238. data/spec/dummy_app/tmp/cache/assets/development/sprockets/9915a7d7fc327736e2852c02cf683916 +0 -0
  239. data/spec/dummy_app/tmp/cache/assets/development/sprockets/99dd18a65861aff71f60940f3f904dc4 +0 -0
  240. data/spec/dummy_app/tmp/cache/assets/development/sprockets/9b8b02558a49e17f6230fd1a84af03ac +0 -0
  241. data/spec/dummy_app/tmp/cache/assets/development/sprockets/9daf110b844179988cda473c3702cd36 +0 -0
  242. data/spec/dummy_app/tmp/cache/assets/development/sprockets/9e98d3ede9a4ae58ad176c09aac8784c +0 -0
  243. data/spec/dummy_app/tmp/cache/assets/development/sprockets/9f2acc37eeea8b15228a38ecbcfe12ec +0 -0
  244. data/spec/dummy_app/tmp/cache/assets/development/sprockets/9f304eccc018ffb73d8dbdea67ff4c45 +0 -0
  245. data/spec/dummy_app/tmp/cache/assets/development/sprockets/a0ac3dab292e1eb99d5e8a524e6dfded +0 -0
  246. data/spec/dummy_app/tmp/cache/assets/development/sprockets/a19531c0b551d0e8aaa386a2cba28621 +0 -0
  247. data/spec/dummy_app/tmp/cache/assets/development/sprockets/a1b5928996636a64ed28d5c815722fc0 +0 -0
  248. data/spec/dummy_app/tmp/cache/assets/development/sprockets/a2c39932df9ec8c9bcd8e1f4a84240dd +0 -0
  249. data/spec/dummy_app/tmp/cache/assets/development/sprockets/a2e4e33192daa77f118bde803b5f469e +0 -0
  250. data/spec/dummy_app/tmp/cache/assets/development/sprockets/a43272bdd86ec2506b047bc1e4ce8876 +0 -0
  251. data/spec/dummy_app/tmp/cache/assets/development/sprockets/a7e1c04200e6e4bda31455a74405ff27 +0 -0
  252. data/spec/dummy_app/tmp/cache/assets/development/sprockets/a971e4dcd80c8771557c6770de027db9 +0 -0
  253. data/spec/dummy_app/tmp/cache/assets/development/sprockets/aa295fd96f916013ffee63976fc76a95 +0 -0
  254. data/spec/dummy_app/tmp/cache/assets/development/sprockets/aa5ab09e4efff43a501273bba49aff5a +0 -0
  255. data/spec/dummy_app/tmp/cache/assets/development/sprockets/ab7de79e9f45ea0210ca722448a61ee6 +0 -0
  256. data/spec/dummy_app/tmp/cache/assets/development/sprockets/abc033045fbf49313622395790a41449 +0 -0
  257. data/spec/dummy_app/tmp/cache/assets/development/sprockets/ac5ba64ea91a44c78d859322e8007b51 +0 -0
  258. data/spec/dummy_app/tmp/cache/assets/development/sprockets/ae56fc628b3fcbc09e9d6bc9cfcfa47f +0 -0
  259. data/spec/dummy_app/tmp/cache/assets/development/sprockets/af312b037fcda8a7c4d4314bbb1294d6 +0 -0
  260. data/spec/dummy_app/tmp/cache/assets/development/sprockets/b0a443220285aa4214c99886f304be36 +0 -0
  261. data/spec/dummy_app/tmp/cache/assets/development/sprockets/b12fd4d4c75c5d4ecedeb33e9015d240 +0 -0
  262. data/spec/dummy_app/tmp/cache/assets/development/sprockets/b24f7fb90e26a052f58af7aec2887f99 +0 -0
  263. data/spec/dummy_app/tmp/cache/assets/development/sprockets/b31281285c049738a71f17d3bce0cb07 +0 -0
  264. data/spec/dummy_app/tmp/cache/assets/development/sprockets/b3ebffc5d529a910f098e186052959ec +0 -0
  265. data/spec/dummy_app/tmp/cache/assets/development/sprockets/b6767aa65b283214e52c1b488053348a +0 -0
  266. data/spec/dummy_app/tmp/cache/assets/development/sprockets/b76e4c022c5b8441b34d7fd884f01591 +0 -0
  267. data/spec/dummy_app/tmp/cache/assets/development/sprockets/b7832ccf4cb727dbb1db2fa906ba58ce +0 -0
  268. data/spec/dummy_app/tmp/cache/assets/development/sprockets/b7fda322633dec2bac36ebd075fca86b +0 -0
  269. data/spec/dummy_app/tmp/cache/assets/development/sprockets/b993ae256cdd45c1f983da2d611049a3 +0 -0
  270. data/spec/dummy_app/tmp/cache/assets/development/sprockets/badb668711397918483b38b6452a19ce +0 -0
  271. data/spec/dummy_app/tmp/cache/assets/development/sprockets/bc96c4fb801c05f926e1bc3fa935418b +0 -0
  272. data/spec/dummy_app/tmp/cache/assets/development/sprockets/bd574a8c5be676a00338f53b536d16c7 +0 -0
  273. data/spec/dummy_app/tmp/cache/assets/development/sprockets/bdff1b5babecc1dd5f99a5878c240298 +0 -0
  274. data/spec/dummy_app/tmp/cache/assets/development/sprockets/beebf50fccb9786a6b9c15060939e196 +0 -0
  275. data/spec/dummy_app/tmp/cache/assets/development/sprockets/c0ecb07d07862572d3e52a8b48245757 +0 -0
  276. data/spec/dummy_app/tmp/cache/assets/development/sprockets/c1d57e1af37bb3d7fec10b83b501c561 +0 -0
  277. data/spec/dummy_app/tmp/cache/assets/development/sprockets/c32f36794c5f61e47ff16beed6cd32ee +0 -0
  278. data/spec/dummy_app/tmp/cache/assets/development/sprockets/c546515632c00eb37eb345e92d604abc +0 -0
  279. data/spec/dummy_app/tmp/cache/assets/development/sprockets/c7383cde7ee415f0a343bfe658885afc +0 -0
  280. data/spec/dummy_app/tmp/cache/assets/development/sprockets/c93eebdbd34ccde24867d33a75ba23bb +0 -0
  281. data/spec/dummy_app/tmp/cache/assets/development/sprockets/cc343c6575f3d88e77e5d0c54208f131 +0 -0
  282. data/spec/dummy_app/tmp/cache/assets/development/sprockets/cc66ba8f2c55f0e0201e9c5d3fb9756a +0 -0
  283. data/spec/dummy_app/tmp/cache/assets/development/sprockets/cd0ab14140d01fee32d8cd011f558895 +0 -0
  284. data/spec/dummy_app/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  285. data/spec/dummy_app/tmp/cache/assets/development/sprockets/d0182afb2a6b3793c9b793d174a32c52 +0 -0
  286. data/spec/dummy_app/tmp/cache/assets/development/sprockets/d0ff728fdab90faf6864895c4388b9a3 +0 -0
  287. data/spec/dummy_app/tmp/cache/assets/development/sprockets/d22147d54feb1d5083b1858b3f0ca9d4 +0 -0
  288. data/spec/dummy_app/tmp/cache/assets/development/sprockets/d281f19fc3b6a6755f669021ba1f1e6c +0 -0
  289. data/spec/dummy_app/tmp/cache/assets/development/sprockets/d383bce808d440db9243b6a766172489 +0 -0
  290. data/spec/dummy_app/tmp/cache/assets/development/sprockets/d3bc3752c772eeb2e0b3c2918cc863a6 +0 -0
  291. data/spec/dummy_app/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  292. data/spec/dummy_app/tmp/cache/assets/development/sprockets/d7fb14951075b1ec677cc130302a26b2 +0 -0
  293. data/spec/dummy_app/tmp/cache/assets/development/sprockets/d893535a31ef07ab97ed6965cb3f0fb5 +0 -0
  294. data/spec/dummy_app/tmp/cache/assets/development/sprockets/d8e009b8040122f415eeab5ea2b48e58 +0 -0
  295. data/spec/dummy_app/tmp/cache/assets/development/sprockets/d99ca00bff5f10b356270d8c956f4012 +0 -0
  296. data/spec/dummy_app/tmp/cache/assets/development/sprockets/db193f817e5de1268f9e9397829aa188 +0 -0
  297. data/spec/dummy_app/tmp/cache/assets/development/sprockets/dd22a990e8e9fc359a59039954abc0c3 +0 -0
  298. data/spec/dummy_app/tmp/cache/assets/development/sprockets/dddcb7f44b3421803102a90cef903b2a +0 -0
  299. data/spec/dummy_app/tmp/cache/assets/development/sprockets/de89d996da9e70756b13c808c1db5251 +0 -0
  300. data/spec/dummy_app/tmp/cache/assets/development/sprockets/dea7e9cb07d7e5890a38c24eba35e55e +0 -0
  301. data/spec/dummy_app/tmp/cache/assets/development/sprockets/df2e404f81bab3f3b50423d7aa652844 +0 -0
  302. data/spec/dummy_app/tmp/cache/assets/development/sprockets/e076be05d795e33011e9165ce3565719 +0 -0
  303. data/spec/dummy_app/tmp/cache/assets/development/sprockets/e16add15b2c7174bd21c0d70d318f4fc +0 -0
  304. data/spec/dummy_app/tmp/cache/assets/development/sprockets/e2158064cf90553ca96435e06073bb60 +0 -0
  305. data/spec/dummy_app/tmp/cache/assets/development/sprockets/e4cef9cfcc9f94843f54b52b318f593c +0 -0
  306. data/spec/dummy_app/tmp/cache/assets/development/sprockets/e54d18d8cbe7b6ab25445a607c15674c +0 -0
  307. data/spec/dummy_app/tmp/cache/assets/development/sprockets/e5f6b1c85d1d4ec5a26284694ab8d660 +0 -0
  308. data/spec/dummy_app/tmp/cache/assets/development/sprockets/e7cc7fb019fd86a28d82c7f63d749ebe +0 -0
  309. data/spec/dummy_app/tmp/cache/assets/development/sprockets/e8b94e5699ca066cbff81d9ed6727dbf +0 -0
  310. data/spec/dummy_app/tmp/cache/assets/development/sprockets/e901ea625274dfd094b70154e09d58b2 +0 -0
  311. data/spec/dummy_app/tmp/cache/assets/development/sprockets/eb794751bdec36ee921a2fbebfb6c7e6 +0 -0
  312. data/spec/dummy_app/tmp/cache/assets/development/sprockets/eccc72c3ec8522b88d235892cd8f45f2 +0 -0
  313. data/spec/dummy_app/tmp/cache/assets/development/sprockets/f1365895382790389d013528129a140a +0 -0
  314. data/spec/dummy_app/tmp/cache/assets/development/sprockets/f27b5dad4fdaec1c4ede5f174b64de32 +0 -0
  315. data/spec/dummy_app/tmp/cache/assets/development/sprockets/f2c23c8157dd64d926ee77c4b955f6b6 +0 -0
  316. data/spec/dummy_app/tmp/cache/assets/development/sprockets/f3e483f413d3151c5849cbd83476ce0a +0 -0
  317. data/spec/dummy_app/tmp/cache/assets/development/sprockets/f76fdcf47a0b7ee91ca690326d152bee +0 -0
  318. data/spec/dummy_app/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  319. data/spec/dummy_app/tmp/cache/assets/development/sprockets/f903a7ee38dcd742dca81df64e11733e +0 -0
  320. data/spec/dummy_app/tmp/cache/assets/development/sprockets/f9295b3b0f4d6dc11fdffaa7e0d02f72 +0 -0
  321. data/spec/dummy_app/tmp/cache/assets/development/sprockets/fa12d1dad434ff516a64628a635c07c8 +0 -0
  322. data/spec/dummy_app/tmp/cache/assets/development/sprockets/fae07930e81fdd4084871f66e4634e8a +0 -0
  323. data/spec/dummy_app/tmp/cache/assets/development/sprockets/fc182fc9375dd4ba9b0e0039d71f0944 +0 -0
  324. data/spec/dummy_app/tmp/cache/assets/development/sprockets/fd5d00a09369cb7c59b53d72ca896828 +0 -0
  325. data/spec/dummy_app/tmp/cache/assets/development/sprockets/fdf1d8b5d1d7b6c5fe5e2f5b467812a3 +0 -0
  326. data/spec/dummy_app/tmp/cache/assets/development/sprockets/fef1622202b16661f9ae083c25eaa0cd +0 -0
  327. data/spec/dummy_app/tmp/cache/assets/development/sprockets/ff5a0e8ee643dae44f31640f626ce94a +0 -0
  328. metadata +726 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a62aa61ef9e134d4b425834fc6f508bc1d30e538
4
+ data.tar.gz: 0675adaa8d49fb232f0cf77b4f58e6b526b09344
5
+ SHA512:
6
+ metadata.gz: 044754fe59ffc39b8912576c7192c797e771083bbc212173fad48f5fd2924debb26291b73d5f571847c86d0ed0154929a7f6d03925d95f17a3210c444aa7d5ca
7
+ data.tar.gz: 42afb0b6db170c62051ab908ace517c751e0dabb670359da81a6818e3a99c5b5be06c2fb775fd7315aba43d86772894be2703e7000136be9af3c515e6e362004
data/MIT-LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License (MIT)
2
+
3
+ Copyright 2009-2013 Ilya N. Zykin (the-teacher), Mikhail Dieterle (Mik-die), Matthew Clark
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,319 @@
1
+ # JquerySortableTree
2
+
3
+ This gem is totally based on [the_sortable_tree](https://github.com/the-teacher/the_sortable_tree) gem.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/jquery_sortable_tree.png)](http://badge.fury.io/rb/jquery_sortable_tree) [![Code Climate](https://codeclimate.com/github/maximalink/jquery_sortable_tree.png)](https://codeclimate.com/github/maximalink/jquery_sortable_tree)
6
+
7
+ > tested with rails 4.1.0rc2 + haml 4
8
+
9
+ Nested Set + Drag&Drop GUI. Very fast! Best render helper! **2000 nodes/sec**. Ready for rails 4 ([RubyGems](http://rubygems.org/gems/jquery_sortable_tree))
10
+
11
+ ### Dummy Application
12
+
13
+ * [spec/dummy_app](spec/dummy_app)
14
+ * [spec/dummy_app/README.md](dummy_app/README.md)
15
+
16
+ ## Sortable tree. Drag&Drop GUI
17
+
18
+ ![Drag&Drop GUI. Sotrable tree](docs/sortable.jpg)
19
+
20
+ ## Render tree
21
+
22
+ ![Render tree](docs/tree.jpg)
23
+
24
+ ## Render Nested Options
25
+
26
+ ![Nested options](docs/nested_options.jpg)
27
+
28
+ ## Render Indented Options
29
+
30
+ ![Indented options](docs/indented_options.jpg)
31
+
32
+ ## Expandable tree
33
+
34
+ ![Expandable](docs/expandable.jpg)
35
+
36
+ ## Keywords
37
+
38
+ Awesome nested set, Nested set, Ruby, Rails, Nested set view helper, Sortable nested set, Drag&Drop GUI for nested set, View helper for nested set, render tree
39
+
40
+ ## Install
41
+
42
+ **Gemfile** (Rails 3, Rails 4)
43
+
44
+ ```ruby
45
+ gem 'awesome_nested_set' # or any similar gem (gem 'nested_set')
46
+ gem 'jquery_sortable_tree', '~> 3.0.0'
47
+ ```
48
+
49
+ Console
50
+
51
+ ```ruby
52
+ bundle
53
+ ```
54
+
55
+ ## Using
56
+
57
+ #### JQuery and JavaScripts
58
+
59
+ **app/assets/javascripts/application.js**
60
+
61
+ Sortable GUI require JQuery libs
62
+
63
+ ```ruby
64
+ //= require jquery
65
+ //= require jquery-ui
66
+ //= require jquery_ujs
67
+ ```
68
+
69
+ Add next JS only for Sortable GUI
70
+
71
+ ```ruby
72
+ //= require sortable_tree/initializer
73
+ ```
74
+
75
+ or Extendable GUI:
76
+
77
+ ```ruby
78
+ //= require expandable_tree/initializer
79
+
80
+ #### Stylesheets
81
+
82
+ **app/assets/stylesheets/application.css**
83
+
84
+ ```ruby
85
+ *= require tree
86
+ *= require sortable_tree
87
+ *= require expandable_tree
88
+ *= require nested_options
89
+ ```
90
+
91
+ ### Extend your Routes for Sortable GUI
92
+
93
+ ```ruby
94
+ resources :pages do
95
+ collection do
96
+ get :manage
97
+
98
+ # required for Sortable GUI server side actions
99
+ post :rebuild
100
+ end
101
+ end
102
+ ```
103
+
104
+ **manage** - just page, where you want render Sortable tree.
105
+
106
+ ### Extend your Model
107
+
108
+ ```ruby
109
+ class Page < ActiveRecord::Base
110
+ include JquerySortableTree::Scopes
111
+
112
+ # any code here
113
+ end
114
+ ```
115
+
116
+ ### Extend your controller and find your tree
117
+
118
+ ```ruby
119
+ class PagesController < ApplicationController
120
+ include JquerySortableTreeController::Rebuild
121
+
122
+ def manage
123
+ @pages = Page.nested_set.select('id, title, content, parent_id').all
124
+ end
125
+
126
+ # any code here
127
+ end
128
+ ```
129
+
130
+ ## Basic Render Method
131
+
132
+ ```ruby
133
+ build_server_tree(tree, options)
134
+ ```
135
+
136
+ ## Render Tree
137
+
138
+ **app/views/pages/manage.html.haml**
139
+
140
+ ```haml
141
+ %ol.tree= just_tree @pages
142
+ ```
143
+
144
+ **just_tree** is just alias of **build_server_tree(tree, type: :tree)**
145
+
146
+ ## Render Sortable Tree
147
+
148
+ ```haml
149
+ %ol.sortable_tree{ data: { max_levels: 5, rebuild_url: rebuild_pages_url } }
150
+ = sortable_tree @pages
151
+ ```
152
+ **sortable_tree** is just alias of **build_server_tree(tree, type: :sortable)**
153
+
154
+ ## Render Nested Options Tree
155
+
156
+ ```haml
157
+ = select_tag :page_id, nested_options(@pages, :selected => Page.last), class: :nested_options
158
+ ```
159
+
160
+ **nested_options** is just alias of **build_server_tree(tree, type: :nested_options)**
161
+
162
+ This uses CSS styling, for indenting with spaces, use **indented_options** instead.
163
+
164
+
165
+ ## build_server_tree options
166
+
167
+ **Client side:**
168
+
169
+ Required params for sortable GUI! Must be defined at root element of tree.
170
+
171
+ 1. **max_levels** - maximum depth of nesting
172
+ 2. **rebuild_url** - URL to rebuild method on server side
173
+
174
+
175
+ ```ruby
176
+ %ol.sortable_tree{ data: { max_levels: 3, rebuild_url: rebuild_pages_url } }
177
+ ```
178
+
179
+ **Server side:**
180
+
181
+
182
+ define
183
+
184
+ ```ruby
185
+ build_server_tree(pages, {:option_1 => :value_1, :option_2 => :value_2})
186
+ ```
187
+
188
+ use
189
+
190
+ ```ruby
191
+ options[:NAME]
192
+ ```
193
+
194
+ Options list:
195
+
196
+ 1. **id** - id field of node
197
+ 2. **title** - title field of node
198
+ 3. **type** - type of tree [tree|sortable|nested_options|indented_options]
199
+ 4. **namespace** - for example: **:admin**. **[]** - by default
200
+ 5. **render_module** - your own Render Tree Helper
201
+ 6. **spacing** - number of spaces per level (indented_options only)
202
+
203
+ **Rendering runtime params (see code of render helpers):**
204
+
205
+ You can use next options, when rendering run:
206
+
207
+ 1. **level** - level number
208
+ 2. **root** - root flag [true|false]
209
+ 3. **klass** - class name
210
+ 4. **has_children** - has children flag [true|false]
211
+ 5. **children** - array of children
212
+
213
+ ## Simple\_form input
214
+
215
+ Using indented options with [simple\_form](https://github.com/plataformatec/simple_form)
216
+ is easy:
217
+
218
+ ```ruby
219
+ = simple_form_for @website do |form|
220
+ = form.association :front_page, as: :indented_collection_select
221
+ ```
222
+
223
+ Additional options can be supplied to the input:
224
+
225
+ 1. **spacing** - number of spaces to use for each level (default 3)
226
+ 2. **depth\_method** - method name to get level from object (default `:depth`)
227
+
228
+ Please note that when you're using awesome\_nested\_set, you need to have the
229
+ optional `depth` column in your table.
230
+
231
+ ## Customization
232
+
233
+ Try to run next view generators:
234
+
235
+ Render helpers for HTML tree generation
236
+
237
+ ```ruby
238
+ bundle exec rails g jquery_sortable_tree:views tree
239
+ bundle exec rails g jquery_sortable_tree:views sortable
240
+ bundle exec rails g jquery_sortable_tree:views nested_options
241
+ bundle exec rails g jquery_sortable_tree:views indented_options
242
+ ```
243
+
244
+ Base Render helper of gem
245
+
246
+ ```ruby
247
+ bundle exec rails g jquery_sortable_tree:views helper
248
+ ```
249
+
250
+ Assets of gem
251
+
252
+ ```ruby
253
+ bundle exec rails g jquery_sortable_tree:views assets
254
+ ```
255
+
256
+ ## I want to know more
257
+
258
+ 1. [How to change HTML code of tree?](https://github.com/maximalink/jquery_sortable_tree/blob/master/docs/How_to_change_HTML_code_of_tree.md)
259
+ 2. [How to create new tree HTML Builder helper?](https://github.com/maximalink/jquery_sortable_tree/blob/master/docs/How_to_create_new_tree_Render_Helper.md)
260
+ 3. [I need to render reversed tree](https://github.com/maximalink/jquery_sortable_tree/blob/master/docs/I_need_to_render_reversed_tree.md)
261
+ 4. [Gem can't correctly define a Name of your Model](https://github.com/maximalink/jquery_sortable_tree/blob/master/docs/How_to_correctly_define_a_Name_of_your_Model.md)
262
+ 5. [ChangeLog](https://github.com/maximalink/jquery_sortable_tree/blob/master/docs/ChangeLog.md)
263
+
264
+ ## Is it fast? Yes, it is!
265
+
266
+ BANCHMARK:
267
+
268
+ tree params: 16.000 nodes, 3 levels
269
+
270
+ - Views: 7999.6ms | ActiveRecord: 79.2ms
271
+ - WebInspector full time ~ 9.64s
272
+
273
+ total: ~ **2000 nodes/sec**
274
+
275
+ ## Looking for maintainers
276
+
277
+ Do you want to be open source contributor? There are some ideas:
278
+
279
+ Try to create view helpers for:
280
+
281
+ 1. Mongoid NestedSet
282
+ 2. acts_as_ordered_tree
283
+ 5. Expand tree via AJAX
284
+ 4. Comments Tree gem
285
+ 3. gem Ancestry (???)
286
+
287
+ ## I want to try! I need tests!
288
+
289
+ 1. Sorry, but I have not tests for this gem. Gem is so simple. It's easy to test only with test app.
290
+ 2. You can write some tests, if you need. I will be happy certainly.
291
+ 3. No! I know RSpec. I can write tests. But I have not reasons to write tests here.
292
+
293
+ ## Аcknowledgment
294
+
295
+ 1. [mjsarfatti/nestedSortable](https://github.com/mjsarfatti/nestedSortable)
296
+ 2. [iconza](http://iconza.com)
297
+
298
+ ## The MIT License (MIT)
299
+
300
+ Copyright 2009-2013 Ilya N. Zykin (the-teacher), Mikhail Dieterle (Mik-die), Matthew Clark
301
+
302
+ Permission is hereby granted, free of charge, to any person obtaining
303
+ a copy of this software and associated documentation files (the
304
+ "Software"), to deal in the Software without restriction, including
305
+ without limitation the rights to use, copy, modify, merge, publish,
306
+ distribute, sublicense, and/or sell copies of the Software, and to
307
+ permit persons to whom the Software is furnished to do so, subject to
308
+ the following conditions:
309
+
310
+ The above copyright notice and this permission notice shall be
311
+ included in all copies or substantial portions of the Software.
312
+
313
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
314
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
315
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
316
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
317
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
318
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
319
+ W
data/Rakefile ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env rake
2
+
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError
6
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ end
8
+
9
+ begin
10
+ require 'rdoc/task'
11
+ rescue LoadError
12
+ require 'rdoc/rdoc'
13
+ require 'rake/rdoctask'
14
+ RDoc::Task = Rake::RDocTask
15
+ end
16
+
17
+ RDoc::Task.new(:rdoc) do |rdoc|
18
+ rdoc.rdoc_dir = 'rdoc'
19
+ rdoc.title = 'JquerySortableTree'
20
+ rdoc.options << '--line-numbers'
21
+ rdoc.rdoc_files.include('README.rdoc')
22
+ rdoc.rdoc_files.include('lib/**/*.rb')
23
+ end
24
+
25
+ APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
26
+ load 'rails/tasks/engine.rake'
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rspec/rails'
31
+
32
+ RSpec.configure do |config|
33
+ config.use_transactional_fixtures = true
34
+ end
35
+
36
+ task default: :test
@@ -0,0 +1,104 @@
1
+ # ----------------------------------------
2
+ # Restorable Helpers
3
+ # ----------------------------------------
4
+ @add_to_restorable_path = (node) ->
5
+ if window.is_restorable_tree
6
+ id = node.data('node-id')
7
+ nested_tree_path_add(id)
8
+ return true
9
+ false
10
+
11
+ @remove_from_restorable_path = (node) ->
12
+ if window.is_restorable_tree
13
+ id = node.data('node-id')
14
+ nested_tree_path_remove(id)
15
+ return true
16
+ false
17
+
18
+ # ----------------------------------------
19
+ # Main Helpers
20
+ # ----------------------------------------
21
+ @nested_tree_toggle = (button) ->
22
+ if button.hasClass('minus')
23
+ button.removeClass('minus').addClass('plus').html('+')
24
+ else
25
+ button.removeClass('plus').addClass('minus').html('&ndash;')
26
+
27
+ @append_children_to_node = (node, html) ->
28
+ html = html.trim()
29
+ item = node.children('.item')
30
+
31
+ button = node.children('.item').children('.expand')
32
+
33
+ if html.length is 0
34
+ button.addClass 'empty'
35
+
36
+ if html.length > 0
37
+ item.after html
38
+ nested_tree_toggle(button)
39
+ add_to_restorable_path(node)
40
+
41
+ @upload_nodes_children = (node, expand_node_url) ->
42
+ node_id = node.data('node-id')
43
+ tree = $('.sortable_tree')
44
+ ctrl_items = $('i.handle, b.expand', tree)
45
+
46
+ $.ajax
47
+ type: 'POST'
48
+ dataType: 'html'
49
+ data: { id: node_id }
50
+ url: expand_node_url
51
+
52
+ beforeSend: (xhr) ->
53
+ ctrl_items.hide()
54
+ window.skip_expandable_tree_hashchange = true
55
+
56
+ success: (data, status, xhr) ->
57
+ ctrl_items.show()
58
+ append_children_to_node(node, data)
59
+
60
+ error: (xhr, status, error) ->
61
+ try
62
+ console.log error
63
+
64
+ @init_expandable_tree = ->
65
+ sortable_tree = $('ol.sortable_tree')
66
+ return false if sortable_tree.length is 0
67
+
68
+ window.is_restorable_tree ||= false
69
+ window.is_cookie_restoreable_tree = sortable_tree.data('cookie_store') || sortable_tree.data('cookie-store')
70
+
71
+ if window.is_cookie_restoreable_tree
72
+ steps = $.cookie(TSTconst.cookie_name())
73
+ _set_hash(TSTconst.hash_prefix() + steps) if steps
74
+
75
+ expand_node_url = sortable_tree.data('expand_node_url') || sortable_tree.data('expand-node-url')
76
+
77
+ # Now it's designed only for one tree
78
+ restore_nested_tree(sortable_tree, expand_node_url) if window.is_restorable_tree
79
+
80
+ sortable_tree.on 'click', '.expand.minus', (e) ->
81
+ button = $ @
82
+ node = button.parent().parent()
83
+ nested_tree_toggle(button)
84
+ remove_from_restorable_path(node)
85
+ node.children('.nested_set').hide()
86
+ false
87
+
88
+ sortable_tree.on 'click', '.expand.plus', (e) ->
89
+ button = $ @
90
+ node = button.parent().parent()
91
+ nested_set = node.children('.nested_set')
92
+
93
+ if nested_set.length is 0
94
+ upload_nodes_children(node, expand_node_url)
95
+ else
96
+ nested_set.show()
97
+ nested_tree_toggle(button)
98
+ add_to_restorable_path(node)
99
+
100
+ false
101
+
102
+ true
103
+
104
+ $ -> init_expandable_tree()
@@ -0,0 +1,33 @@
1
+ @_arrays_diff = (a, b) -> b.filter (i) -> return !(a.indexOf(i) > -1)
2
+
3
+ @expandable_tree_hashchange = (hash_event) ->
4
+ if window.skip_expandable_tree_hashchange
5
+ window.skip_expandable_tree_hashchange = false
6
+ return true
7
+
8
+ hash_and_cookie_accordance()
9
+
10
+ oEvent = hash_event.originalEvent
11
+ new_url = oEvent.newURL
12
+ old_url = oEvent.oldURL
13
+
14
+ new_hash = new_url.split('#')[1]
15
+ old_hash = old_url.split('#')[1]
16
+
17
+ return false unless ('#'+new_hash).match(TSTconst.re()) or ('#'+old_hash).match(TSTconst.re())
18
+
19
+ new_arr = _nested_set_hash_arr(new_hash)
20
+ old_arr = _nested_set_hash_arr(old_hash)
21
+
22
+ diff_ids = if new_arr.length >= old_arr.length
23
+ _arrays_diff(old_arr, new_arr)
24
+ else
25
+ _arrays_diff(new_arr, old_arr)
26
+
27
+ for id in diff_ids
28
+ btn = $("[data-node-id=#{id}] > .item .expand")
29
+ btn.click()
30
+ setTimeout -> window.skip_expandable_tree_hashchange = false
31
+
32
+ $(window).bind 'hashchange', (hash_event) ->
33
+ expandable_tree_hashchange(hash_event)
@@ -0,0 +1,6 @@
1
+ //= require nested_sortable/jquery.ui.nestedSortable
2
+ //= require nested_sortable/inline_operations
3
+ //= require expandable_tree/jquery.cookie
4
+ //= require expandable_tree/restorable
5
+ //= require expandable_tree/hashchange
6
+ //= require expandable_tree/expandable_tree
@@ -0,0 +1,68 @@
1
+ #!
2
+ # * jQuery Cookie Plugin v1.3.1
3
+ # * https://github.com/carhartl/jquery-cookie
4
+ # *
5
+ # * Copyright 2013 Klaus Hartl
6
+ # * Released under the MIT license
7
+ #
8
+ ((factory) ->
9
+ if typeof define is "function" and define.amd
10
+ # AMD. Register as anonymous module.
11
+ define ["jquery"], factory
12
+ else
13
+ # Browser globals.
14
+ factory jQuery
15
+ ) ($) ->
16
+ pluses = /\+/g
17
+
18
+ raw = (s) -> s
19
+ decoded = (s) -> decodeURIComponent s.replace(pluses, " ")
20
+ converted = (s) ->
21
+ # This is a quoted cookie as according to RFC2068, unescape
22
+ s = s.slice(1, -1).replace(/\\"/g, "\"").replace(/\\\\/g, "\\") if s.indexOf("\"") is 0
23
+ try
24
+ return (if config.json then JSON.parse(s) else s)
25
+
26
+
27
+ config = $.cookie = (key, value, options) ->
28
+ # write
29
+ if value isnt `undefined`
30
+ options = $.extend({}, config.defaults, options)
31
+
32
+ if typeof options.expires is "number"
33
+ days = options.expires
34
+ t = options.expires = new Date()
35
+ t.setDate t.getDate() + days
36
+
37
+ value = (if config.json then JSON.stringify(value) else String(value))
38
+
39
+ # use expires attribute, max-age is not supported by IE
40
+ return (document.cookie = [(if config.raw then key else encodeURIComponent(key)), "=", (if config.raw then value else encodeURIComponent(value)), (if options.expires then "; expires=" + options.expires.toUTCString() else ""), (if options.path then "; path=" + options.path else ""), (if options.domain then "; domain=" + options.domain else ""), (if options.secure then "; secure" else "")].join(""))
41
+
42
+ # read
43
+ decode = (if config.raw then raw else decoded)
44
+ cookies = document.cookie.split("; ")
45
+ result = (if key then `undefined` else {})
46
+
47
+ i = 0
48
+ l = cookies.length
49
+
50
+ while i < l
51
+ parts = cookies[i].split("=")
52
+ name = decode parts.shift()
53
+ cookie = decode parts.join("=")
54
+ if key and key is name
55
+ result = converted(cookie)
56
+ break
57
+ result[name] = converted(cookie) unless key
58
+ i++
59
+ result
60
+
61
+ config.defaults = {}
62
+
63
+ $.removeCookie = (key, options) ->
64
+ if $.cookie(key) isnt `undefined`
65
+ # Must not alter options, thus extending a fresh object...
66
+ $.cookie key, '', $.extend({}, options, expires: -1)
67
+ return true
68
+ false