the_sortable_tree 2.3.2 → 2.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. data/README.md +6 -1
  2. data/app/helpers/render_nested_options_helper.rb +5 -2
  3. data/lib/the_sortable_tree/version.rb +1 -1
  4. data/spec/{controlllers → old_tests/controlllers}/controller_mixin_spec.rb +1 -1
  5. data/spec/{dummy → old_tests/dummy}/README.rdoc +0 -0
  6. data/spec/{dummy → old_tests/dummy}/Rakefile +0 -0
  7. data/spec/{dummy → old_tests/dummy}/app/assets/javascripts/application.js +0 -0
  8. data/spec/{dummy → old_tests/dummy}/app/assets/stylesheets/application.css +0 -0
  9. data/spec/{dummy → old_tests/dummy}/app/controllers/application_controller.rb +0 -0
  10. data/spec/{dummy → old_tests/dummy}/app/controllers/tests_controller.rb +0 -0
  11. data/spec/{dummy → old_tests/dummy}/app/views/layouts/application.html.erb +0 -0
  12. data/spec/{dummy → old_tests/dummy}/config/application.rb +0 -0
  13. data/spec/{dummy → old_tests/dummy}/config/boot.rb +0 -0
  14. data/spec/{dummy → old_tests/dummy}/config/database.yml +0 -0
  15. data/spec/{dummy → old_tests/dummy}/config/environment.rb +0 -0
  16. data/spec/{dummy → old_tests/dummy}/config/environments/development.rb +0 -0
  17. data/spec/{dummy → old_tests/dummy}/config/environments/production.rb +0 -0
  18. data/spec/{dummy → old_tests/dummy}/config/environments/test.rb +0 -0
  19. data/spec/{dummy → old_tests/dummy}/config/initializers/backtrace_silencers.rb +0 -0
  20. data/spec/{dummy → old_tests/dummy}/config/initializers/inflections.rb +0 -0
  21. data/spec/{dummy → old_tests/dummy}/config/initializers/mime_types.rb +0 -0
  22. data/spec/{dummy → old_tests/dummy}/config/initializers/secret_token.rb +0 -0
  23. data/spec/{dummy → old_tests/dummy}/config/initializers/session_store.rb +0 -0
  24. data/spec/{dummy → old_tests/dummy}/config/initializers/wrap_parameters.rb +0 -0
  25. data/spec/{dummy → old_tests/dummy}/config/locales/en.yml +0 -0
  26. data/spec/{dummy → old_tests/dummy}/config/routes.rb +0 -0
  27. data/spec/{dummy → old_tests/dummy}/config.ru +0 -0
  28. data/spec/{dummy → old_tests/dummy}/db/test.sqlite3 +0 -0
  29. data/spec/{dummy → old_tests/dummy}/log/test.log +0 -0
  30. data/spec/{dummy → old_tests/dummy}/public/404.html +0 -0
  31. data/spec/{dummy → old_tests/dummy}/public/422.html +0 -0
  32. data/spec/{dummy → old_tests/dummy}/public/500.html +0 -0
  33. data/spec/{dummy → old_tests/dummy}/public/favicon.ico +0 -0
  34. data/spec/{dummy → old_tests/dummy}/script/rails +0 -0
  35. data/spec/{spec_helper.rb → old_tests/spec_helper.rb} +0 -0
  36. data/spec/the_sortable_tree_app/Gemfile +20 -0
  37. data/spec/the_sortable_tree_app/Gemfile.lock +138 -0
  38. data/spec/the_sortable_tree_app/README.md +9 -0
  39. data/spec/the_sortable_tree_app/Rakefile +7 -0
  40. data/spec/the_sortable_tree_app/app/assets/images/rails.png +0 -0
  41. data/spec/the_sortable_tree_app/app/assets/javascripts/application.js +16 -0
  42. data/spec/the_sortable_tree_app/app/assets/stylesheets/application.css +11 -0
  43. data/spec/the_sortable_tree_app/app/controllers/admin/pages_controller.rb +31 -0
  44. data/spec/the_sortable_tree_app/app/controllers/application_controller.rb +3 -0
  45. data/spec/the_sortable_tree_app/app/controllers/article_categories_controller.rb +11 -0
  46. data/spec/the_sortable_tree_app/app/controllers/inventory/categories_controller.rb +15 -0
  47. data/spec/the_sortable_tree_app/app/controllers/pages_controller.rb +26 -0
  48. data/spec/the_sortable_tree_app/app/controllers/welcome_controller.rb +3 -0
  49. data/spec/the_sortable_tree_app/app/models/admin/page.rb +4 -0
  50. data/spec/the_sortable_tree_app/app/models/admin.rb +5 -0
  51. data/spec/the_sortable_tree_app/app/models/article_category.rb +4 -0
  52. data/spec/the_sortable_tree_app/app/models/inventory/category.rb +4 -0
  53. data/spec/the_sortable_tree_app/app/models/inventory.rb +5 -0
  54. data/spec/the_sortable_tree_app/app/models/page.rb +5 -0
  55. data/spec/the_sortable_tree_app/app/views/admin/pages/index.html.haml +8 -0
  56. data/spec/the_sortable_tree_app/app/views/admin/pages/manage.html.haml +3 -0
  57. data/spec/the_sortable_tree_app/app/views/admin/pages/namespaced_link.html.haml +3 -0
  58. data/spec/the_sortable_tree_app/app/views/admin/pages/nested_options.html.haml +3 -0
  59. data/spec/the_sortable_tree_app/app/views/admin/pages/node_manage.html.haml +12 -0
  60. data/spec/the_sortable_tree_app/app/views/article_categories/index.html.haml +3 -0
  61. data/spec/the_sortable_tree_app/app/views/article_categories/manage.html.haml +4 -0
  62. data/spec/the_sortable_tree_app/app/views/inventory/categories/index.html.haml +3 -0
  63. data/spec/the_sortable_tree_app/app/views/inventory/categories/manage.html.haml +4 -0
  64. data/spec/the_sortable_tree_app/app/views/layouts/application.html.erb +18 -0
  65. data/spec/the_sortable_tree_app/app/views/pages/expand.html.haml +7 -0
  66. data/spec/the_sortable_tree_app/app/views/pages/expand_children.html.haml +1 -0
  67. data/spec/the_sortable_tree_app/app/views/pages/index.html.haml +3 -0
  68. data/spec/the_sortable_tree_app/app/views/pages/manage.html.haml +8 -0
  69. data/spec/the_sortable_tree_app/app/views/pages/nested_options.html.haml +3 -0
  70. data/spec/the_sortable_tree_app/app/views/welcome/index.html.haml +40 -0
  71. data/spec/the_sortable_tree_app/config/application.rb +48 -0
  72. data/spec/the_sortable_tree_app/config/boot.rb +6 -0
  73. data/spec/the_sortable_tree_app/config/database.yml +11 -0
  74. data/spec/the_sortable_tree_app/config/environment.rb +5 -0
  75. data/spec/the_sortable_tree_app/config/environments/development.rb +30 -0
  76. data/spec/the_sortable_tree_app/config/environments/production.rb +60 -0
  77. data/spec/the_sortable_tree_app/config/environments/test.rb +42 -0
  78. data/spec/the_sortable_tree_app/config/initializers/backtrace_silencers.rb +7 -0
  79. data/spec/the_sortable_tree_app/config/initializers/inflections.rb +10 -0
  80. data/spec/the_sortable_tree_app/config/initializers/mime_types.rb +5 -0
  81. data/spec/the_sortable_tree_app/config/initializers/secret_token.rb +7 -0
  82. data/spec/the_sortable_tree_app/config/initializers/session_store.rb +8 -0
  83. data/spec/the_sortable_tree_app/config/initializers/wrap_parameters.rb +14 -0
  84. data/spec/the_sortable_tree_app/config/locales/en.yml +28 -0
  85. data/spec/the_sortable_tree_app/config/routes.rb +47 -0
  86. data/spec/the_sortable_tree_app/config.ru +4 -0
  87. data/spec/the_sortable_tree_app/db/development.db +0 -0
  88. data/spec/the_sortable_tree_app/db/migrate/20120211053457_create_pages.rb +16 -0
  89. data/spec/the_sortable_tree_app/db/migrate/20120503173258_create_article_categories.rb +16 -0
  90. data/spec/the_sortable_tree_app/db/migrate/20120508093823_create_inventory_categories.rb +16 -0
  91. data/spec/the_sortable_tree_app/db/migrate/20130128160328_create_admin_pages.rb +16 -0
  92. data/spec/the_sortable_tree_app/db/production.db +0 -0
  93. data/spec/the_sortable_tree_app/db/schema.rb +64 -0
  94. data/spec/the_sortable_tree_app/db/seeds.rb +96 -0
  95. data/spec/the_sortable_tree_app/db/test.db +0 -0
  96. data/spec/the_sortable_tree_app/doc/README_FOR_APP +2 -0
  97. data/spec/the_sortable_tree_app/log/development.log +18672 -0
  98. data/spec/the_sortable_tree_app/log/production.log +5 -0
  99. data/spec/the_sortable_tree_app/public/404.html +26 -0
  100. data/spec/the_sortable_tree_app/public/422.html +26 -0
  101. data/spec/the_sortable_tree_app/public/500.html +26 -0
  102. data/spec/the_sortable_tree_app/public/favicon.ico +0 -0
  103. data/spec/the_sortable_tree_app/public/robots.txt +5 -0
  104. data/spec/the_sortable_tree_app/script/rails +6 -0
  105. data/spec/the_sortable_tree_app/test/fixtures/admin/pages.yml +7 -0
  106. data/spec/the_sortable_tree_app/test/fixtures/article_categories.yml +9 -0
  107. data/spec/the_sortable_tree_app/test/fixtures/comments.yml +13 -0
  108. data/spec/the_sortable_tree_app/test/fixtures/inventory/categories.yml +9 -0
  109. data/spec/the_sortable_tree_app/test/functional/inventory/category_controller_test.rb +14 -0
  110. data/spec/the_sortable_tree_app/test/performance/browsing_test.rb +12 -0
  111. data/spec/the_sortable_tree_app/test/test_helper.rb +13 -0
  112. data/spec/the_sortable_tree_app/test/unit/admin/page_test.rb +7 -0
  113. data/spec/the_sortable_tree_app/test/unit/article_category_test.rb +7 -0
  114. data/spec/the_sortable_tree_app/test/unit/comment_test.rb +7 -0
  115. data/spec/the_sortable_tree_app/test/unit/helpers/inventory/category_helper_test.rb +4 -0
  116. data/spec/the_sortable_tree_app/test/unit/inventory/category_test.rb +7 -0
  117. data/spec/the_sortable_tree_app/tmp/cache/assets/C3B/4B0/sprockets%2F4143dd2388a3252adb1804945871a002 +0 -0
  118. data/spec/the_sortable_tree_app/tmp/cache/assets/C50/BE0/sprockets%2Fa139ccc37272f09e8337565114558a42 +0 -0
  119. data/spec/the_sortable_tree_app/tmp/cache/assets/C6B/530/sprockets%2F54e7598ead46f414a5474993750992a6 +0 -0
  120. data/spec/the_sortable_tree_app/tmp/cache/assets/C77/560/sprockets%2F813f25e4a0780001a1f80f83ea522987 +0 -0
  121. data/spec/the_sortable_tree_app/tmp/cache/assets/C81/090/sprockets%2F5338822ad86a0a0079f990225ed9037d +0 -0
  122. data/spec/the_sortable_tree_app/tmp/cache/assets/C9A/730/sprockets%2F12ff81fe7a0c213d511536b1a9712613 +0 -0
  123. data/spec/the_sortable_tree_app/tmp/cache/assets/C9B/370/sprockets%2F4b19719024eb862bb0b40c2903b2444f +0 -0
  124. data/spec/the_sortable_tree_app/tmp/cache/assets/CB1/D00/sprockets%2F90a69052f559169cc0338bb9e7b2071c +0 -0
  125. data/spec/the_sortable_tree_app/tmp/cache/assets/CC9/ED0/sprockets%2Fa98594ed698bb2f25c32497158b7346f +0 -0
  126. data/spec/the_sortable_tree_app/tmp/cache/assets/CD5/540/sprockets%2Fa2e03c2a79820a23e494e3b8459c32f0 +0 -0
  127. data/spec/the_sortable_tree_app/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  128. data/spec/the_sortable_tree_app/tmp/cache/assets/CDC/B70/sprockets%2Fb8655a3e58029cd981112a7ce421db65 +0 -0
  129. data/spec/the_sortable_tree_app/tmp/cache/assets/CE9/BD0/sprockets%2F22287637edb361485c371efd7817acc7 +0 -0
  130. data/spec/the_sortable_tree_app/tmp/cache/assets/CEA/2D0/sprockets%2F77e58093f6053b9964ca2b36bd34a94d +0 -0
  131. data/spec/the_sortable_tree_app/tmp/cache/assets/CEE/3C0/sprockets%2Ff078d8a33d271e8bf062dfd978343537 +0 -0
  132. data/spec/the_sortable_tree_app/tmp/cache/assets/CF0/590/sprockets%2F66914ec5c90e7fa7285377a17c4b94e3 +0 -0
  133. data/spec/the_sortable_tree_app/tmp/cache/assets/CF8/C70/sprockets%2Fb086216a7cea4b05f2d10a54a1508c86 +0 -0
  134. data/spec/the_sortable_tree_app/tmp/cache/assets/D07/110/sprockets%2F4a6961a0c735dbbba76f35e606f34027 +0 -0
  135. data/spec/the_sortable_tree_app/tmp/cache/assets/D0A/840/sprockets%2F38149c503a4865c81cef8cc0226b6a3d +0 -0
  136. data/spec/the_sortable_tree_app/tmp/cache/assets/D0E/CE0/sprockets%2F54005c20e9fd12f1d6d7bf9f7080f822 +0 -0
  137. data/spec/the_sortable_tree_app/tmp/cache/assets/D0F/540/sprockets%2Ffdff04173da67c582219de85c136320f +0 -0
  138. data/spec/the_sortable_tree_app/tmp/cache/assets/D14/170/sprockets%2F2a860136457d8b8f4fedb7bcb3962136 +0 -0
  139. data/spec/the_sortable_tree_app/tmp/cache/assets/D14/F00/sprockets%2Fb0d459b10f17bcc3955798772c7bac18 +0 -0
  140. data/spec/the_sortable_tree_app/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  141. data/spec/the_sortable_tree_app/tmp/cache/assets/D38/E20/sprockets%2F0e50ead9c50e79817fc32184e900ba5a +0 -0
  142. data/spec/the_sortable_tree_app/tmp/cache/assets/D42/760/sprockets%2Fa26ac9237d11ffa65fca30c861979e36 +0 -0
  143. data/spec/the_sortable_tree_app/tmp/cache/assets/D47/BE0/sprockets%2F544a4972c2f7438e092ab50cbc8c9de9 +0 -0
  144. data/spec/the_sortable_tree_app/tmp/cache/assets/D48/300/sprockets%2F392aba9fd44f378041913c9f0edef429 +0 -0
  145. data/spec/the_sortable_tree_app/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  146. data/spec/the_sortable_tree_app/tmp/cache/assets/D51/420/sprockets%2F8497f4db9b07de37eee54184fd031e93 +0 -0
  147. data/spec/the_sortable_tree_app/tmp/cache/assets/D59/D90/sprockets%2Ff09bd16e880b660cbf49848bc97f29e7 +0 -0
  148. data/spec/the_sortable_tree_app/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  149. data/spec/the_sortable_tree_app/tmp/cache/assets/D5F/560/sprockets%2Fa07f8d3d20c8ad7093220eb04c67a6cd +0 -0
  150. data/spec/the_sortable_tree_app/tmp/cache/assets/D7C/D70/sprockets%2F8c4e6f6fc945e97cae12d8218a21f8b3 +0 -0
  151. data/spec/the_sortable_tree_app/tmp/cache/assets/DA2/800/sprockets%2F21a7cffa498af4bfb7a0849616b41dd8 +0 -0
  152. data/spec/the_sortable_tree_app/tmp/cache/assets/DAE/A40/sprockets%2F78e36ff8ef2fc355f82b30e0bfb397b5 +0 -0
  153. data/spec/the_sortable_tree_app/tmp/cache/assets/DD3/4C0/sprockets%2Fb4b73a83da8ea301f18e578dc3d9dde6 +0 -0
  154. data/spec/the_sortable_tree_app/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  155. data/spec/the_sortable_tree_app/tmp/cache/assets/DF1/8B0/sprockets%2F2f0d2d00353acefe637b5338a9abfdfb +0 -0
  156. data/spec/the_sortable_tree_app/tmp/cache/assets/E03/A20/sprockets%2F74f7c02ea34e1ecfcb83bff7c167c75d +0 -0
  157. data/spec/the_sortable_tree_app/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  158. data/spec/the_sortable_tree_app/tmp/cache/sass/2255c97fc63f030a9ce238cccb311b4b1e966328/nested_options.css.scssc +0 -0
  159. data/spec/the_sortable_tree_app/tmp/cache/sass/2255c97fc63f030a9ce238cccb311b4b1e966328/sortable_tree.css.scssc +0 -0
  160. data/spec/the_sortable_tree_app/tmp/cache/sass/2255c97fc63f030a9ce238cccb311b4b1e966328/tree.css.scssc +0 -0
  161. metadata +340 -110
data/README.md CHANGED
@@ -1,9 +1,14 @@
1
- # TheSortableTree v2.3.2
1
+ # TheSortableTree v2.3.3
2
2
 
3
3
  > tested with rails 3.2.13 + haml 4
4
4
 
5
5
  Nested Set + Drag&Drop GUI. Very fast! Best render helper! **2000 nodes/sec**. Ready for rails 4 ([RubyGems](http://rubygems.org/gems/the_sortable_tree))
6
6
 
7
+ ### Test Application
8
+
9
+ * [spec/the_sortable_tree_app](https://github.com/the-teacher/the_sortable_tree/tree/master/spec/the_sortable_tree_app)
10
+ * [spec/the_sortable_tree_app/README.md](https://github.com/the-teacher/the_sortable_tree/blob/master/spec/the_sortable_tree_app/README.md)
11
+
7
12
  ## Sortable tree. Drag&Drop GUI
8
13
 
9
14
  ![Drag&Drop GUI. Sotrable tree](https://raw.github.com/the-teacher/the_sortable_tree/master/docs/sortable.jpg)
@@ -7,10 +7,13 @@ module RenderNestedOptionsHelper
7
7
  @h, @options = h, options
8
8
 
9
9
  node = options[:node]
10
- selected = (options[:selected] == node) ? ' selected' : nil
10
+
11
+ this_node = options[:selected] == node
12
+ selected_class = this_node ? ' selected' : nil
13
+ selected = this_node ? " selected='selected'" : nil
11
14
 
12
15
  "
13
- <option value='#{node[:id]}' class='l_#{ options[:level] }#{selected}'>#{ node.send(options[:title]) }</option>
16
+ <option value='#{node[:id]}' class='l_#{ options[:level] }#{selected_class}' #{selected}>#{ node.send(options[:title]) }</option>
14
17
  #{ options[:children] }
15
18
  "
16
19
  end
@@ -1,3 +1,3 @@
1
1
  module TheSortableTree
2
- VERSION = "2.3.2"
2
+ VERSION = "2.3.3"
3
3
  end
@@ -46,4 +46,4 @@ describe TheSortableTreeController do
46
46
  end
47
47
  end
48
48
  end
49
- end
49
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,20 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails'
4
+ gem 'sqlite3'
5
+
6
+ gem 'json'
7
+ gem 'haml'
8
+ gem 'haml-rails'
9
+ gem 'jquery-rails'
10
+ gem 'jquery-ui-rails'
11
+
12
+ gem 'awesome_nested_set'
13
+ gem 'the_sortable_tree', path: '../../'
14
+
15
+ group :assets do
16
+ gem 'sass-rails'
17
+ gem 'coffee-rails'
18
+ gem 'uglifier'
19
+ gem 'faker'
20
+ end
@@ -0,0 +1,138 @@
1
+ PATH
2
+ remote: ../../
3
+ specs:
4
+ the_sortable_tree (2.3.2)
5
+ rails (>= 3.1)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.13)
11
+ actionpack (= 3.2.13)
12
+ mail (~> 2.5.3)
13
+ actionpack (3.2.13)
14
+ activemodel (= 3.2.13)
15
+ activesupport (= 3.2.13)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.5)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.2.1)
23
+ activemodel (3.2.13)
24
+ activesupport (= 3.2.13)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.13)
27
+ activemodel (= 3.2.13)
28
+ activesupport (= 3.2.13)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.13)
32
+ activemodel (= 3.2.13)
33
+ activesupport (= 3.2.13)
34
+ activesupport (3.2.13)
35
+ i18n (= 0.6.1)
36
+ multi_json (~> 1.0)
37
+ arel (3.0.2)
38
+ awesome_nested_set (2.1.6)
39
+ activerecord (>= 3.0.0)
40
+ builder (3.0.4)
41
+ coffee-rails (3.2.2)
42
+ coffee-script (>= 2.2.0)
43
+ railties (~> 3.2.0)
44
+ coffee-script (2.2.0)
45
+ coffee-script-source
46
+ execjs
47
+ coffee-script-source (1.6.2)
48
+ erubis (2.7.0)
49
+ execjs (1.4.0)
50
+ multi_json (~> 1.0)
51
+ faker (1.1.2)
52
+ i18n (~> 0.5)
53
+ haml (4.0.3)
54
+ tilt
55
+ haml-rails (0.4)
56
+ actionpack (>= 3.1, < 4.1)
57
+ activesupport (>= 3.1, < 4.1)
58
+ haml (>= 3.1, < 4.1)
59
+ railties (>= 3.1, < 4.1)
60
+ hike (1.2.3)
61
+ i18n (0.6.1)
62
+ journey (1.0.4)
63
+ jquery-rails (3.0.1)
64
+ railties (>= 3.0, < 5.0)
65
+ thor (>= 0.14, < 2.0)
66
+ jquery-ui-rails (4.0.3)
67
+ jquery-rails
68
+ railties (>= 3.1.0)
69
+ json (1.8.0)
70
+ mail (2.5.4)
71
+ mime-types (~> 1.16)
72
+ treetop (~> 1.4.8)
73
+ mime-types (1.23)
74
+ multi_json (1.7.6)
75
+ polyglot (0.3.3)
76
+ rack (1.4.5)
77
+ rack-cache (1.2)
78
+ rack (>= 0.4)
79
+ rack-ssl (1.3.3)
80
+ rack
81
+ rack-test (0.6.2)
82
+ rack (>= 1.0)
83
+ rails (3.2.13)
84
+ actionmailer (= 3.2.13)
85
+ actionpack (= 3.2.13)
86
+ activerecord (= 3.2.13)
87
+ activeresource (= 3.2.13)
88
+ activesupport (= 3.2.13)
89
+ bundler (~> 1.0)
90
+ railties (= 3.2.13)
91
+ railties (3.2.13)
92
+ actionpack (= 3.2.13)
93
+ activesupport (= 3.2.13)
94
+ rack-ssl (~> 1.3.2)
95
+ rake (>= 0.8.7)
96
+ rdoc (~> 3.4)
97
+ thor (>= 0.14.6, < 2.0)
98
+ rake (10.0.4)
99
+ rdoc (3.12.2)
100
+ json (~> 1.4)
101
+ sass (3.2.9)
102
+ sass-rails (3.2.6)
103
+ railties (~> 3.2.0)
104
+ sass (>= 3.1.10)
105
+ tilt (~> 1.3)
106
+ sprockets (2.2.2)
107
+ hike (~> 1.2)
108
+ multi_json (~> 1.0)
109
+ rack (~> 1.0)
110
+ tilt (~> 1.1, != 1.3.0)
111
+ sqlite3 (1.3.7)
112
+ thor (0.18.1)
113
+ tilt (1.4.1)
114
+ treetop (1.4.14)
115
+ polyglot
116
+ polyglot (>= 0.3.1)
117
+ tzinfo (0.3.37)
118
+ uglifier (2.1.1)
119
+ execjs (>= 0.3.0)
120
+ multi_json (~> 1.0, >= 1.0.2)
121
+
122
+ PLATFORMS
123
+ ruby
124
+
125
+ DEPENDENCIES
126
+ awesome_nested_set
127
+ coffee-rails
128
+ faker
129
+ haml
130
+ haml-rails
131
+ jquery-rails
132
+ jquery-ui-rails
133
+ json
134
+ rails
135
+ sass-rails
136
+ sqlite3
137
+ the_sortable_tree!
138
+ uglifier
@@ -0,0 +1,9 @@
1
+ ## TheSortableTree Test Application
2
+
3
+ #### Ruby 1.9.3 + Rails 3.2.13 + Haml 4 + the_sortable_tree (2.3.0)
4
+
5
+ rake db:create && rake db:migrate && rake db:seed
6
+
7
+ bin/rails s
8
+
9
+ localhost:3000
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ TheSortableTreeTest::Application.load_tasks
@@ -0,0 +1,16 @@
1
+ /*
2
+ // This is a manifest file that'll be compiled into including all the files listed below.
3
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
4
+ // be included in the compiled file accessible from http://example.com/assets/application.js
5
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
6
+ // the compiled file.
7
+
8
+ //= require jquery
9
+ //= require jquery_ujs
10
+ //= require jquery.ui.core
11
+ //= require jquery.ui.sortable
12
+
13
+ //= require jquery.ui.nestedSortable
14
+ //= require sortable_tree/initializer
15
+ // require expandable_tree/initializer
16
+ */
@@ -0,0 +1,11 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+
7
+ *= require tree
8
+ *= require sortable_tree
9
+ *= require nested_options
10
+ * require expandable_tree
11
+ */
@@ -0,0 +1,31 @@
1
+ class Admin::PagesController < ApplicationController
2
+ include TheSortableTreeController::Rebuild
3
+
4
+ def index
5
+ @pages = Admin::Page.nested_set.select('id, title, content, parent_id').limit(15)
6
+ end
7
+
8
+ def manage
9
+ @pages = Admin::Page.nested_set.select('id, title, content, parent_id').limit(15)
10
+ end
11
+
12
+ def nested_options
13
+ @pages = Admin::Page.nested_set.select('id, title, content, parent_id').limit(15)
14
+ end
15
+
16
+ def node_manage
17
+ @root = Admin::Page.root
18
+ @pages = @root.self_and_descendants.nested_set.select('id, title, content, parent_id').limit(15)
19
+ render template: 'admin/pages/manage'
20
+ end
21
+
22
+ protected
23
+
24
+ def sortable_model
25
+ Admin::Page
26
+ end
27
+
28
+ def sortable_collection
29
+ 'admin_pages'
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,11 @@
1
+ class ArticleCategoriesController < ApplicationController
2
+ include TheSortableTreeController::Rebuild
3
+
4
+ def index
5
+ @article_categories = ArticleCategory.nested_set.all
6
+ end
7
+
8
+ def manage
9
+ @article_categories = ArticleCategory.nested_set.all
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ class Inventory::CategoriesController < ApplicationController
2
+ include TheSortableTreeController::Rebuild
3
+
4
+ def index
5
+ @inventory_categories = Inventory::Category.nested_set.all
6
+ end
7
+
8
+ def manage
9
+ @inventory_categories = Inventory::Category.nested_set.all
10
+ end
11
+
12
+ def sortable_model
13
+ Inventory::Category
14
+ end
15
+ end
@@ -0,0 +1,26 @@
1
+ class PagesController < ApplicationController
2
+ include TheSortableTreeController::Rebuild
3
+ # include TheSortableTreeController::ExpandNode
4
+
5
+ def index
6
+ @pages = Page.nested_set.select('id, title, content, parent_id').limit(15)
7
+ end
8
+
9
+ def nested_options
10
+ @pages = Page.nested_set.select('id, title, content, parent_id').limit(15)
11
+ end
12
+
13
+ def manage
14
+ @pages = Page.nested_set.select('id, title, content, parent_id')
15
+ end
16
+
17
+ def node_manage
18
+ @root = Page.root
19
+ @pages = @root.self_and_descendants.nested_set.select('id, title, content, parent_id').limit(15)
20
+ render template: 'pages/manage'
21
+ end
22
+
23
+ def expand
24
+ @pages = Page.nested_set.roots.select('id, title, content, parent_id')
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ class WelcomeController < ApplicationController
2
+ def index; end
3
+ end
@@ -0,0 +1,4 @@
1
+ class Admin::Page < ActiveRecord::Base
2
+ acts_as_nested_set
3
+ include TheSortableTree::Scopes
4
+ end
@@ -0,0 +1,5 @@
1
+ module Admin
2
+ def self.table_name_prefix
3
+ 'admin_'
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ class ArticleCategory < ActiveRecord::Base
2
+ acts_as_nested_set
3
+ include TheSortableTree::Scopes
4
+ end
@@ -0,0 +1,4 @@
1
+ class Inventory::Category < ActiveRecord::Base
2
+ acts_as_nested_set
3
+ include TheSortableTree::Scopes
4
+ end
@@ -0,0 +1,5 @@
1
+ module Inventory
2
+ def self.table_name_prefix
3
+ 'inventory_'
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class Page < ActiveRecord::Base
2
+ acts_as_nested_set
3
+ include TheSortableTree::Scopes
4
+ # attr_accessible :name, :parent_id
5
+ end
@@ -0,0 +1,8 @@
1
+ - content_for :css do
2
+ = stylesheet_link_tag :tree
3
+
4
+ %h1 Admin::Pages#index
5
+
6
+ %p= link_to raw('&larr; back'), '/'
7
+
8
+ %ol.tree= build_server_tree @pages
@@ -0,0 +1,3 @@
1
+ %p= link_to raw('&larr; back'), '/'
2
+ %ol.sortable_tree{ data: { rebuild_url: rebuild_admin_pages_url } }
3
+ = build_server_tree @pages, type: :sortable
@@ -0,0 +1,3 @@
1
+ %p= link_to raw('&larr; back'), '/'
2
+ %ol.sortable_tree{ data: { rebuild_url: rebuild_admin_pages_url } }
3
+ = build_server_tree @pages, type: :sortable
@@ -0,0 +1,3 @@
1
+ %p= link_to raw('&larr; back'), '/'
2
+
3
+ = select_tag :pages, nested_options(@pages, selected: @pages.last), class: :nested_options
@@ -0,0 +1,12 @@
1
+ %h1 Admin::Pages#manage
2
+
3
+ %p= link_to raw('&larr; back'), '/'
4
+
5
+ %ol.sortable_tree{ :data => { :rebuild_url => rebuild_pages_url } }
6
+ = build_server_tree @pages, :type => :sortable
7
+
8
+ %h2 Root:
9
+ %div= @root.inspect
10
+
11
+ %h2 Root's children:
12
+ %div= @pages.inspect
@@ -0,0 +1,3 @@
1
+ %p= link_to raw('&larr; back'), '/'
2
+
3
+ %ol.tree= build_server_tree @article_categories
@@ -0,0 +1,4 @@
1
+ %p= link_to raw('&larr; back'), '/'
2
+
3
+ %ol.sortable_tree{ :data => { :max_levels => 3, :rebuild_url => rebuild_article_categories_url } }
4
+ = build_server_tree @article_categories, :type => :sortable
@@ -0,0 +1,3 @@
1
+ %p= link_to raw('&larr; back'), '/'
2
+
3
+ %ol.tree= build_server_tree @inventory_categories
@@ -0,0 +1,4 @@
1
+ %p= link_to raw('&larr; back'), '/'
2
+
3
+ %ol.sortable_tree{ data: { max_levels: 3, rebuild_url: rebuild_inventory_categories_url } }
4
+ = build_server_tree @inventory_categories, type: :sortable
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TheSortableTreeTest</title>
5
+ <%= stylesheet_link_tag :application %>
6
+ <%= javascript_include_tag :application %>
7
+ <%= csrf_meta_tags %>
8
+
9
+ <%= yield :css %>
10
+ <%= yield :js %>
11
+
12
+ </head>
13
+ <body>
14
+
15
+ <%= yield %>
16
+
17
+ </body>
18
+ </html>
@@ -0,0 +1,7 @@
1
+ %p= link_to raw('&larr; back'), '/'
2
+
3
+ %p= link_to 'Create New Page', new_page_path
4
+
5
+ Count: #{ @pages.count }
6
+ %ol.sortable_tree{ :data => { :rebuild_url => rebuild_pages_url, :expand_node_url => expand_node_pages_url, :tree_type => :expandable } }
7
+ = expandable_tree @pages
@@ -0,0 +1 @@
1
+ %ol.nested_set= expandable_tree @children
@@ -0,0 +1,3 @@
1
+ %p= link_to raw('&larr; back'), '/'
2
+
3
+ %ol.tree= just_tree @pages
@@ -0,0 +1,8 @@
1
+ %p= link_to raw('&larr; back'), '/'
2
+
3
+ %p= link_to 'Create New Page', new_page_path
4
+
5
+ Count: #{ @pages.count }
6
+
7
+ %ol.sortable_tree{ data: { rebuild_url: rebuild_pages_url } }
8
+ = sortable_tree @pages, namespace: :admin
@@ -0,0 +1,3 @@
1
+ %p= link_to raw('&larr; back'), '/'
2
+
3
+ = select_tag :pages, nested_options(@pages, selected: @pages.last), class: :nested_options
@@ -0,0 +1,40 @@
1
+ %h1 Welcome to TheSortableTree test application!
2
+
3
+ %h4 Default views
4
+
5
+ %h5 Pages (model Pages)
6
+
7
+ %ul
8
+ %li= link_to 'pages/index (just tree)', pages_path
9
+ %li= link_to 'pages/nested_options', nested_options_pages_path
10
+ %li= link_to 'pages/manage (sortable tree)', manage_pages_path
11
+ %li= link_to 'pages/node_manage (sortable tree)', node_manage_pages_path
12
+ -#%li= link_to 'pages/expand (expandable tree)', expand_pages_path
13
+
14
+ %h5 Admin::Pages (model Admin::Pages + namespace :admin)
15
+
16
+ %ul
17
+ %li= link_to '/admin/pages/index (just tree)', admin_pages_path
18
+ %li= link_to '/admin/pages/nested_options', nested_options_admin_pages_path
19
+ %li= link_to '/admin/pages/manage (sortable tree)', manage_admin_pages_path
20
+ %li= link_to '/admin/pages/node_manage (sortable tree)', node_manage_admin_pages_path
21
+
22
+ %h5 Сompound model name (Inventory::Category)
23
+
24
+ %ul
25
+ %li= link_to 'inventory/categories/index', inventory_categories_path
26
+ %li= link_to 'inventory/categories/manage (sortable tree)', manage_inventory_categories_path
27
+
28
+ %h5 Сompound model name (ArticleCategory)
29
+
30
+ %ul
31
+ %li= link_to 'article_categories/index', article_categories_path
32
+ %li= link_to 'article_categories/manage (sortable tree)', manage_article_categories_path
33
+
34
+ %h4 Customized views
35
+
36
+ -#
37
+ %ul
38
+ %li= link_to 'comments/index (min)', comments_path
39
+ %li= link_to 'comments/manage (sortable tree)', manage_comments_path
40
+ %li= link_to 'comments/manage (Tree of Comments)', comments_comments_path