the_sortable_tree 2.3.3 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -4
- data/app/assets/javascripts/expandable_tree/hashchange.js.coffee +33 -0
- data/app/assets/javascripts/expandable_tree/initializer.js.coffee +76 -22
- data/app/assets/javascripts/expandable_tree/jquery.cookie.coffee +68 -0
- data/app/assets/javascripts/expandable_tree/restorable.js.coffee +125 -0
- data/app/assets/javascripts/jquery.ui.nestedSortable.js +2 -0
- data/app/assets/javascripts/sortable_tree/initializer.js.coffee +40 -34
- data/app/assets/stylesheets/expandable_tree.css.scss +8 -2
- data/app/assets/stylesheets/sortable_tree.css.scss +11 -9
- data/app/controllers/the_sortable_tree_controller.rb +12 -11
- data/app/helpers/render_expandable_tree_helper.rb +1 -3
- data/app/helpers/render_sortable_tree_helper.rb +1 -2
- data/lib/the_sortable_tree/version.rb +1 -1
- data/spec/{the_sortable_tree_app → dummy_app}/Gemfile +1 -1
- data/spec/dummy_app/Gemfile.lock +134 -0
- data/spec/dummy_app/README.md +33 -0
- data/spec/{the_sortable_tree_app → dummy_app}/Rakefile +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/assets/images/rails.png +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/assets/javascripts/application.js +5 -1
- data/spec/{the_sortable_tree_app → dummy_app}/app/assets/stylesheets/application.css +1 -1
- data/spec/{the_sortable_tree_app → dummy_app}/app/controllers/admin/pages_controller.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/controllers/application_controller.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/controllers/article_categories_controller.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/controllers/inventory/categories_controller.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/controllers/pages_controller.rb +1 -1
- data/spec/{the_sortable_tree_app → dummy_app}/app/controllers/welcome_controller.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/models/admin/page.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/models/admin.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/models/article_category.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/models/inventory/category.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/models/inventory.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/models/page.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/admin/pages/index.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/admin/pages/manage.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/admin/pages/namespaced_link.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/admin/pages/nested_options.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/admin/pages/node_manage.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/article_categories/index.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/article_categories/manage.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/inventory/categories/index.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/inventory/categories/manage.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/layouts/application.html.erb +0 -0
- data/spec/dummy_app/app/views/pages/expand.html.haml +8 -0
- data/spec/{the_sortable_tree_app/app/views/pages/expand_children.html.haml → dummy_app/app/views/pages/expand_node.html.haml} +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/pages/index.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/pages/manage.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/pages/nested_options.html.haml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/app/views/welcome/index.html.haml +1 -1
- data/spec/{the_sortable_tree_app → dummy_app}/config/application.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/boot.rb +0 -0
- data/spec/dummy_app/config/database.yml +3 -0
- data/spec/dummy_app/config/database.yml.example +3 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/environment.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/environments/development.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/environments/production.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/environments/test.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/initializers/inflections.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/initializers/mime_types.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/initializers/secret_token.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/initializers/session_store.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/initializers/wrap_parameters.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/locales/en.yml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/config/routes.rb +7 -2
- data/spec/{the_sortable_tree_app → dummy_app}/config.ru +0 -0
- data/spec/dummy_app/db/development.db +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/db/migrate/20120211053457_create_pages.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/db/migrate/20120503173258_create_article_categories.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/db/migrate/20120508093823_create_inventory_categories.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/db/migrate/20130128160328_create_admin_pages.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/db/schema.rb +14 -14
- data/spec/{the_sortable_tree_app → dummy_app}/db/seeds.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/doc/README_FOR_APP +0 -0
- data/spec/dummy_app/log/development.log +32859 -0
- data/spec/{the_sortable_tree_app → dummy_app}/public/404.html +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/public/422.html +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/public/500.html +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/public/favicon.ico +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/public/robots.txt +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/script/rails +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/fixtures/admin/pages.yml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/fixtures/article_categories.yml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/fixtures/comments.yml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/fixtures/inventory/categories.yml +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/functional/inventory/category_controller_test.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/performance/browsing_test.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/test_helper.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/unit/admin/page_test.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/unit/article_category_test.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/unit/comment_test.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/unit/helpers/inventory/category_helper_test.rb +0 -0
- data/spec/{the_sortable_tree_app → dummy_app}/test/unit/inventory/category_test.rb +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sass/7078a6e7d50d4f9d68fa0d4816aa48e19cc24fe5/expandable_tree.css.scssc +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/sass/2255c97fc63f030a9ce238cccb311b4b1e966328 → dummy_app/tmp/cache/assets/development/sass/7078a6e7d50d4f9d68fa0d4816aa48e19cc24fe5}/nested_options.css.scssc +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sass/7078a6e7d50d4f9d68fa0d4816aa48e19cc24fe5/sortable_tree.css.scssc +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/sass/2255c97fc63f030a9ce238cccb311b4b1e966328 → dummy_app/tmp/cache/assets/development/sass/7078a6e7d50d4f9d68fa0d4816aa48e19cc24fe5}/tree.css.scssc +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/05efd66e23c98c77afeb4a7bcb45f8bf +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/C6B/530/sprockets%2F54e7598ead46f414a5474993750992a6 → dummy_app/tmp/cache/assets/development/sprockets/075f155915b68deac9b84d36e9e78e12} +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/1142f73fad150a752112a732b733591b +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/D48/300/sprockets%2F392aba9fd44f378041913c9f0edef429 → dummy_app/tmp/cache/assets/development/sprockets/17329c76961a36ab755c53272d334b99} +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/1c62fe9e8cce00645d6440af4ac61ce0 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/1d6831069f2ba3e6b5a700231417128f +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/D0F/540/sprockets%2Ffdff04173da67c582219de85c136320f → dummy_app/tmp/cache/assets/development/sprockets/206ce2975a6d174ac740cab27481be7c} +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/D07/110/sprockets%2F4a6961a0c735dbbba76f35e606f34027 → dummy_app/tmp/cache/assets/development/sprockets/22e25b35a790c2b5fabc74f93b74078d} +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/DF1/8B0/sprockets%2F2f0d2d00353acefe637b5338a9abfdfb → dummy_app/tmp/cache/assets/development/sprockets/2d9f90ebaaf77755df5bce7315fbab07} +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 → dummy_app/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af} +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/33a50ea83c8c0b953c9462be9ac2e5ae +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/34efe139b4a7055695595585160a0903 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/351a8f38490961801e253ef169b6298e +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/3f8d6db1d41d5620f91eb915cb1212c5 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/41055928923856ad1bf8548fc57b65b0 +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/CB1/D00/sprockets%2F90a69052f559169cc0338bb9e7b2071c → dummy_app/tmp/cache/assets/development/sprockets/45202fa0f913fbdccbf35341f8dd7b36} +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/4b4bd169c4e69a64a4a2741e174cf578 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/4d0c7146cf04552f8b598a3e111d7997 +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/CDC/B70/sprockets%2Fb8655a3e58029cd981112a7ce421db65 → dummy_app/tmp/cache/assets/development/sprockets/4fa563d2736e57350e947f3c45446a31} +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/C3B/4B0/sprockets%2F4143dd2388a3252adb1804945871a002 → dummy_app/tmp/cache/assets/development/sprockets/589dc20ca8832fd1e57cee612a33470d} +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/592f5283e9aaf10abfabe06adb90dd24 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/5f57b8f9ade7989a4ad4910dbc14e4b5 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/61de97016b38506f89e31b4614e3ada2 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/65203852a8bf7f4dd76a8ff5fd20d8e5 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/66facc18f7ab080c8a8e3186cddb39aa +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/68f3f70d3556b5c8039f76c18c9520a0 +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/D14/F00/sprockets%2Fb0d459b10f17bcc3955798772c7bac18 → dummy_app/tmp/cache/assets/development/sprockets/6ffb1af77ca6f262aec891f176a4d5a2} +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/7210b4d08933fddd9c8bf1d8e7b9dcb1 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/77b67e5a493f0abd66712e2cfdccfbf7 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/79e26ff62a5184d59f12cbaae40e0bf0 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/80cb309fcd056cda2563f749bc0fedae +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/8223a88c26fdebbe77f2189f253c84d2 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/82e61fb673d352eed69e219594c9d13d +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/DAE/A40/sprockets%2F78e36ff8ef2fc355f82b30e0bfb397b5 → dummy_app/tmp/cache/assets/development/sprockets/8505bd144271a52deb9ced0582114f3d} +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/DA2/800/sprockets%2F21a7cffa498af4bfb7a0849616b41dd8 → dummy_app/tmp/cache/assets/development/sprockets/8625ec6aecaca3766f0df3d7a6236594} +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/87521f5a93bf531f819abebebd4c2aa4 +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/D5F/560/sprockets%2Fa07f8d3d20c8ad7093220eb04c67a6cd → dummy_app/tmp/cache/assets/development/sprockets/8979439153b5a4760f1b278fdd0e9a5c} +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/8f2995d8912687da614ff3b98b6e24ed +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/93d8d86bb80be6fb6a366b13800b4942 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/99359f7a098eb16495189cf6d728f7b3 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/99deda2445e2710cc890a25f205c51a6 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/9ac815a1e6ab54e57f903054f878db1c +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/9f3643f6af4c46696ba0eab98830a7d8 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/b55d5f8b7ac32c8022256909a8139dfe +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/bc0aca73f9504eb4d1a1d68755eedadb +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/bcd93e383d1f771b5a289b74ec7fb4bb +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/bd13d384c236f2e3cf25c76ece28ce24 +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/D38/E20/sprockets%2F0e50ead9c50e79817fc32184e900ba5a → dummy_app/tmp/cache/assets/development/sprockets/bfde58c0dd8b76566ab23cc887e93a50} +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/bfe30d1ba2625e651981933ffe03ce20 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/c1320f0226f27d7f547663a7deba9644 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/c4432eee045f7b58525ed694662f6e12 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/c7748b5f3eb8c8fea2e080c3dccaeae7 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/cc6925acc7747a5cbe6e54df08217dbd +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/cd2cfd2ecacdf768c8a4b41c1070fbcf +0 -0
- data/spec/{the_sortable_tree_app/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af → dummy_app/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994} +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/d47a5f0466fc7f582750aa20a0182dbd +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/daf14199207e9836228590d5efe3dcf3 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/e2c92d620a13bc05f71b3405ec753edb +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/ea90d043aa01ed3e8e0b6cd49ea4c2a6 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/eb9be27c994815f00a4c4c630c775c54 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/eca8bd0ac188e23c00a4f531569d1d1e +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/ed396f8ec81394d660b1d6d6aab7b289 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/f664eb5cbdc07ddaea6383c623fe0bac +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/f6f10c5b2a6282dca22b82b11b25ec12 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/f83592d6f5ee1f5eaaf7192d73dd5cb0 +0 -0
- data/spec/dummy_app/tmp/cache/assets/development/sprockets/fe2d1a86e5d6de106fa359f8c4028d77 +0 -0
- metadata +376 -317
- data/spec/the_sortable_tree_app/Gemfile.lock +0 -138
- data/spec/the_sortable_tree_app/README.md +0 -9
- data/spec/the_sortable_tree_app/app/views/pages/expand.html.haml +0 -7
- data/spec/the_sortable_tree_app/config/database.yml +0 -11
- data/spec/the_sortable_tree_app/db/development.db +0 -0
- data/spec/the_sortable_tree_app/db/production.db +0 -0
- data/spec/the_sortable_tree_app/db/test.db +0 -0
- data/spec/the_sortable_tree_app/log/development.log +0 -18672
- data/spec/the_sortable_tree_app/log/production.log +0 -5
- data/spec/the_sortable_tree_app/tmp/cache/assets/C50/BE0/sprockets%2Fa139ccc37272f09e8337565114558a42 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/C77/560/sprockets%2F813f25e4a0780001a1f80f83ea522987 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/C81/090/sprockets%2F5338822ad86a0a0079f990225ed9037d +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/C9A/730/sprockets%2F12ff81fe7a0c213d511536b1a9712613 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/C9B/370/sprockets%2F4b19719024eb862bb0b40c2903b2444f +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/CC9/ED0/sprockets%2Fa98594ed698bb2f25c32497158b7346f +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/CD5/540/sprockets%2Fa2e03c2a79820a23e494e3b8459c32f0 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/CE9/BD0/sprockets%2F22287637edb361485c371efd7817acc7 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/CEA/2D0/sprockets%2F77e58093f6053b9964ca2b36bd34a94d +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/CEE/3C0/sprockets%2Ff078d8a33d271e8bf062dfd978343537 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/CF0/590/sprockets%2F66914ec5c90e7fa7285377a17c4b94e3 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/CF8/C70/sprockets%2Fb086216a7cea4b05f2d10a54a1508c86 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/D0A/840/sprockets%2F38149c503a4865c81cef8cc0226b6a3d +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/D0E/CE0/sprockets%2F54005c20e9fd12f1d6d7bf9f7080f822 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/D14/170/sprockets%2F2a860136457d8b8f4fedb7bcb3962136 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/D42/760/sprockets%2Fa26ac9237d11ffa65fca30c861979e36 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/D47/BE0/sprockets%2F544a4972c2f7438e092ab50cbc8c9de9 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/D51/420/sprockets%2F8497f4db9b07de37eee54184fd031e93 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/D59/D90/sprockets%2Ff09bd16e880b660cbf49848bc97f29e7 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/D7C/D70/sprockets%2F8c4e6f6fc945e97cae12d8218a21f8b3 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/DD3/4C0/sprockets%2Fb4b73a83da8ea301f18e578dc3d9dde6 +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/assets/E03/A20/sprockets%2F74f7c02ea34e1ecfcb83bff7c167c75d +0 -0
- data/spec/the_sortable_tree_app/tmp/cache/sass/2255c97fc63f030a9ce238cccb311b4b1e966328/sortable_tree.css.scssc +0 -0
data/README.md
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
# TheSortableTree v2.3.3
|
2
2
|
|
3
|
+
[![Code Climate](https://codeclimate.com/github/the-teacher/the_sortable_tree.png)](https://codeclimate.com/github/the-teacher/the_sortable_tree)
|
4
|
+
|
3
5
|
> tested with rails 3.2.13 + haml 4
|
4
6
|
|
5
7
|
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
8
|
|
7
|
-
###
|
9
|
+
### Dummy Application
|
8
10
|
|
9
|
-
* [spec/
|
10
|
-
* [spec/
|
11
|
+
* [spec/dummy_app](https://github.com/the-teacher/the_sortable_tree/tree/master/spec/dummy_app)
|
12
|
+
* [spec/dummy_app/README.md](https://github.com/the-teacher/the_sortable_tree/blob/master/spec/dummy_app/README.md)
|
11
13
|
|
12
14
|
## Sortable tree. Drag&Drop GUI
|
13
15
|
|
@@ -19,7 +21,11 @@ Nested Set + Drag&Drop GUI. Very fast! Best render helper! **2000 nodes/sec**. R
|
|
19
21
|
|
20
22
|
## Render Nested Options
|
21
23
|
|
22
|
-
![
|
24
|
+
![Nested options](https://raw.github.com/the-teacher/the_sortable_tree/master/docs/nested_options.jpg)
|
25
|
+
|
26
|
+
## Expandable tree
|
27
|
+
|
28
|
+
![Expandable](https://raw.github.com/the-teacher/the_sortable_tree/master/docs/expandable.jpg)
|
23
29
|
|
24
30
|
## Keywords
|
25
31
|
|
@@ -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)
|
@@ -1,3 +1,29 @@
|
|
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('–')
|
26
|
+
|
1
27
|
@append_children_to_node = (node, html) ->
|
2
28
|
html = html.trim()
|
3
29
|
item = node.children('.item')
|
@@ -8,43 +34,71 @@
|
|
8
34
|
button.addClass 'empty'
|
9
35
|
|
10
36
|
if html.length > 0
|
11
|
-
button.removeClass('plus').addClass('minus').html('–')
|
12
37
|
item.after html
|
13
|
-
|
38
|
+
nested_tree_toggle(button)
|
39
|
+
add_to_restorable_path(node)
|
14
40
|
|
15
|
-
@upload_nodes_children = (node, expand_node_url
|
16
|
-
node_id
|
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)
|
17
45
|
|
18
46
|
$.ajax
|
19
47
|
type: 'POST'
|
20
48
|
dataType: 'html'
|
49
|
+
data: { id: node_id }
|
21
50
|
url: expand_node_url
|
22
|
-
data:
|
23
|
-
id: node_id
|
24
|
-
tree_type: tree_type
|
25
51
|
|
26
52
|
beforeSend: (xhr) ->
|
27
|
-
|
28
|
-
|
53
|
+
ctrl_items.hide()
|
54
|
+
window.skip_expandable_tree_hashchange = true
|
29
55
|
|
30
56
|
success: (data, status, xhr) ->
|
31
|
-
|
32
|
-
$('.sortable_tree b.expand').show()
|
57
|
+
ctrl_items.show()
|
33
58
|
append_children_to_node(node, data)
|
34
59
|
|
35
60
|
error: (xhr, status, error) ->
|
36
|
-
|
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
|
37
67
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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)
|
43
99
|
|
44
|
-
|
100
|
+
false
|
45
101
|
|
46
|
-
|
47
|
-
node = $(@).parent().parent()
|
48
|
-
upload_nodes_children(node, expand_node_url, tree_type)
|
102
|
+
true
|
49
103
|
|
50
|
-
|
104
|
+
$ -> init_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
|
@@ -0,0 +1,125 @@
|
|
1
|
+
window.is_restorable_tree = true
|
2
|
+
|
3
|
+
class @TSTconst
|
4
|
+
@_name = 'TST'
|
5
|
+
@delimiter = ';'
|
6
|
+
@separator = '|'
|
7
|
+
@re = -> new RegExp(@cookie_name() + '\\' + @separator)
|
8
|
+
@hash_prefix = -> @cookie_name() + @separator
|
9
|
+
@cookie_scope = -> $('.sortable_tree').data('cookie_scope') || $('.sortable_tree').data('cookie-scope')
|
10
|
+
@cookie_name = ->
|
11
|
+
return @_name unless @cookie_scope()
|
12
|
+
@_name + '_' + @cookie_scope()
|
13
|
+
|
14
|
+
# ====================================
|
15
|
+
# Helpers
|
16
|
+
# ====================================
|
17
|
+
@_get_hash = -> document.location.hash
|
18
|
+
@_set_hash = (str) ->
|
19
|
+
window.skip_expandable_tree_hashchange = true
|
20
|
+
document.location.hash = str
|
21
|
+
|
22
|
+
@_uniqueArray = (arr = []) ->
|
23
|
+
output = {}
|
24
|
+
output[item] = item for item in arr
|
25
|
+
val for key, val of output
|
26
|
+
|
27
|
+
@_compactArray = (array) -> array.filter (e) -> return e
|
28
|
+
|
29
|
+
@_nested_set_hash_arr = (hash) ->
|
30
|
+
return [] unless hash
|
31
|
+
[prefix, arr] = hash.split(TSTconst.separator)
|
32
|
+
_compactArray _uniqueArray arr.split(TSTconst.delimiter)
|
33
|
+
|
34
|
+
# ====================================
|
35
|
+
# Helpers Fn
|
36
|
+
# ====================================
|
37
|
+
@nested_tree_get_path = ->
|
38
|
+
hash = _get_hash()
|
39
|
+
return false unless hash.match(TSTconst.re())
|
40
|
+
_nested_set_hash_arr(hash)
|
41
|
+
|
42
|
+
@hash_and_cookie_accordance = ->
|
43
|
+
if window.is_cookie_restoreable_tree
|
44
|
+
hash = _get_hash()
|
45
|
+
if hash.length is 0
|
46
|
+
$.removeCookie( TSTconst.cookie_name() )
|
47
|
+
else
|
48
|
+
return false unless hash.match(TSTconst.re())
|
49
|
+
str = hash.split(TSTconst.separator)[1]
|
50
|
+
$.cookie(TSTconst.cookie_name(), str, { expires: 14 })
|
51
|
+
|
52
|
+
false
|
53
|
+
|
54
|
+
@nested_tree_path_remove = (id) ->
|
55
|
+
hash = _get_hash()
|
56
|
+
return false unless hash.match(TSTconst.re())
|
57
|
+
|
58
|
+
arr = _nested_set_hash_arr(hash)
|
59
|
+
index = arr.indexOf(id+'')
|
60
|
+
return hash_and_cookie_accordance() if index is -1
|
61
|
+
|
62
|
+
arr.splice(index, 1)
|
63
|
+
str = _uniqueArray(arr).join(TSTconst.delimiter)
|
64
|
+
|
65
|
+
if str.length is 0
|
66
|
+
_set_hash('')
|
67
|
+
else
|
68
|
+
_set_hash(TSTconst.hash_prefix() + str)
|
69
|
+
|
70
|
+
hash_and_cookie_accordance()
|
71
|
+
|
72
|
+
true
|
73
|
+
|
74
|
+
@nested_tree_path_add = (id) ->
|
75
|
+
str = id
|
76
|
+
hash = _get_hash()
|
77
|
+
|
78
|
+
if hash.match(TSTconst.re())
|
79
|
+
arr = _nested_set_hash_arr(hash)
|
80
|
+
arr.push(id)
|
81
|
+
arr = _uniqueArray arr
|
82
|
+
str = arr.join(TSTconst.delimiter)
|
83
|
+
|
84
|
+
_set_hash(TSTconst.hash_prefix() + str)
|
85
|
+
hash_and_cookie_accordance()
|
86
|
+
|
87
|
+
# ====================================
|
88
|
+
# Restore Fn
|
89
|
+
# ====================================
|
90
|
+
@load_nested_nodes = (arr, expand_node_url) ->
|
91
|
+
if arr.length is 0
|
92
|
+
window.skip_expandable_tree_hashchange = false
|
93
|
+
return false
|
94
|
+
|
95
|
+
id = arr.shift()
|
96
|
+
tree = $('.sortable_tree')
|
97
|
+
node = $("[data-node-id=#{id}]")
|
98
|
+
ctrl_items = $('i.handle, b.expand', tree)
|
99
|
+
|
100
|
+
if node.length is 0
|
101
|
+
load_nested_nodes(arr, expand_node_url)
|
102
|
+
else
|
103
|
+
$.ajax
|
104
|
+
type: 'POST'
|
105
|
+
dataType: 'html'
|
106
|
+
data: { id: id }
|
107
|
+
url: expand_node_url
|
108
|
+
|
109
|
+
beforeSend: (xhr) ->
|
110
|
+
ctrl_items.hide()
|
111
|
+
window.skip_expandable_tree_hashchange = true
|
112
|
+
|
113
|
+
success: (data, status, xhr) ->
|
114
|
+
ctrl_items.show()
|
115
|
+
append_children_to_node(node, data)
|
116
|
+
load_nested_nodes(arr, expand_node_url)
|
117
|
+
|
118
|
+
error: (xhr, status, error) ->
|
119
|
+
try
|
120
|
+
console.log error
|
121
|
+
|
122
|
+
@restore_nested_tree = (sortable_tree, expand_node_url) ->
|
123
|
+
arr = nested_tree_get_path()
|
124
|
+
return false unless arr
|
125
|
+
load_nested_nodes(arr, expand_node_url)
|
@@ -19,6 +19,7 @@
|
|
19
19
|
disableNesting: 'ui-nestedSortable-no-nesting',
|
20
20
|
errorClass: 'ui-nestedSortable-error',
|
21
21
|
listType: 'ol',
|
22
|
+
listClass: 'nested_set',
|
22
23
|
maxLevels: 0,
|
23
24
|
noJumpFix: 0
|
24
25
|
},
|
@@ -128,6 +129,7 @@
|
|
128
129
|
}
|
129
130
|
|
130
131
|
newList = document.createElement(o.listType);
|
132
|
+
$(newList).addClass(o.listClass)
|
131
133
|
|
132
134
|
this.beyondMaxLevels = 0;
|
133
135
|
|
@@ -18,37 +18,43 @@
|
|
18
18
|
error: (xhr, status, error) ->
|
19
19
|
console.log error
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
21
|
+
@init_sortable_tree = ->
|
22
|
+
sortable_tree = $('ol.sortable_tree')
|
23
|
+
return false if sortable_tree.length is 0
|
24
|
+
|
25
|
+
rebuild_url = sortable_tree.data('rebuild_url') || sortable_tree.data('rebuild-url')
|
26
|
+
max_levels = sortable_tree.data('max_levels') || sortable_tree.data('max-levels')
|
27
|
+
|
28
|
+
############################################
|
29
|
+
# Initialize Sortable Tree
|
30
|
+
############################################
|
31
|
+
sortable_tree.nestedSortable
|
32
|
+
items: 'li'
|
33
|
+
helper: 'clone'
|
34
|
+
handle: 'i.handle'
|
35
|
+
tolerance: 'pointer'
|
36
|
+
maxLevels: max_levels
|
37
|
+
revert: 250
|
38
|
+
tabSize: 25
|
39
|
+
opacity: 0.6
|
40
|
+
placeholder: 'placeholder'
|
41
|
+
disableNesting: 'no-nest'
|
42
|
+
toleranceElement: '> div'
|
43
|
+
forcePlaceholderSize: true
|
44
|
+
|
45
|
+
############################################
|
46
|
+
# Sortable Update Event
|
47
|
+
############################################
|
48
|
+
sortable_tree.on "sortupdate", (event, ui) =>
|
49
|
+
item = ui.item
|
50
|
+
attr_name = 'node-id'
|
51
|
+
item_id = item.data(attr_name)
|
52
|
+
prev_id = item.prev().data(attr_name)
|
53
|
+
next_id = item.next().data(attr_name)
|
54
|
+
parent_id = item.parent().parent().data(attr_name)
|
55
|
+
|
56
|
+
rebuild_sortable_tree(rebuild_url, item_id, parent_id, prev_id, next_id)
|
57
|
+
|
58
|
+
true
|
59
|
+
|
60
|
+
$ -> init_sortable_tree()
|
@@ -1,10 +1,16 @@
|
|
1
1
|
.sortable_tree{
|
2
|
+
&.expandable{
|
3
|
+
h4{
|
4
|
+
margin-left: 50px;
|
5
|
+
}
|
6
|
+
}
|
7
|
+
|
2
8
|
.expand{
|
3
9
|
float: left;
|
4
10
|
cursor: pointer;
|
5
11
|
|
6
|
-
border: 1px solid
|
7
|
-
color:
|
12
|
+
border: 1px solid lightgray;
|
13
|
+
color: lightgray;
|
8
14
|
|
9
15
|
font-size: 13px;
|
10
16
|
font-weight: normal;
|
@@ -28,10 +28,12 @@
|
|
28
28
|
}
|
29
29
|
|
30
30
|
h4{
|
31
|
-
margin:
|
31
|
+
margin-left: 30px;
|
32
|
+
|
32
33
|
a{
|
33
34
|
color: #333;
|
34
35
|
font-size: 14px;
|
36
|
+
margin-left: 0;
|
35
37
|
&:hover{ background: #eee; }
|
36
38
|
}
|
37
39
|
}
|
@@ -42,7 +44,7 @@
|
|
42
44
|
}
|
43
45
|
|
44
46
|
.handle{
|
45
|
-
background: transparent url(
|
47
|
+
background: transparent image-url("iconza/icons/move.png");
|
46
48
|
background-position: center center;
|
47
49
|
|
48
50
|
width: 16px;
|
@@ -51,7 +53,7 @@
|
|
51
53
|
float: left;
|
52
54
|
cursor: move;
|
53
55
|
|
54
|
-
&:hover{ background: transparent url(
|
56
|
+
&:hover{ background: transparent image-url("iconza/icons/red_move.png"); }
|
55
57
|
}
|
56
58
|
|
57
59
|
.item{
|
@@ -90,16 +92,16 @@
|
|
90
92
|
overflow: hidden; zoom: 1;
|
91
93
|
|
92
94
|
&.new{
|
93
|
-
background: transparent url(
|
94
|
-
&:hover{ background: transparent url(
|
95
|
+
background: transparent image-url("iconza/icons/add.png") no-repeat scroll center center;
|
96
|
+
&:hover{ background: transparent image-url("iconza/icons/red_add.png") no-repeat scroll center center; }
|
95
97
|
}
|
96
98
|
&.edit{
|
97
|
-
background: transparent url(
|
98
|
-
&:hover{ background: transparent url(
|
99
|
+
background: transparent image-url("iconza/icons/edit.png") no-repeat scroll center center;
|
100
|
+
&:hover{ background: transparent image-url("iconza/icons/red_edit.png") no-repeat scroll center center; }
|
99
101
|
}
|
100
102
|
&.delete{
|
101
|
-
background: transparent url(
|
102
|
-
&:hover{ background: transparent url(
|
103
|
+
background: transparent image-url("iconza/icons/delete.png") no-repeat scroll center center;
|
104
|
+
&:hover{ background: transparent image-url("iconza/icons/red_delete.png") no-repeat scroll center center; }
|
103
105
|
}
|
104
106
|
}
|
105
107
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module TheSortableTreeController
|
2
|
-
# include TheSortableTreeController::ReversedRebuild
|
3
2
|
# include TheSortableTreeController::Rebuild
|
4
3
|
# include TheSortableTreeController::ExpandNode
|
4
|
+
# include TheSortableTreeController::ReversedRebuild
|
5
5
|
|
6
6
|
module DefineVariablesMethod
|
7
7
|
public
|
@@ -18,15 +18,16 @@ module TheSortableTreeController
|
|
18
18
|
module ExpandNode
|
19
19
|
include DefineVariablesMethod
|
20
20
|
def expand_node
|
21
|
-
id
|
22
|
-
render
|
21
|
+
id = params[:id].to_i
|
22
|
+
return render(nothing: true) unless id
|
23
|
+
sort = (params[:tree_sort] == 'reversed') ? 'reversed_' : nil
|
23
24
|
|
24
25
|
variable, collection, klass = self.the_define_common_variables
|
25
|
-
variable
|
26
|
-
@children = variable.children
|
26
|
+
variable = self.instance_variable_set(variable, klass.find(id))
|
27
|
+
@children = variable.children.send("#{sort}nested_set")
|
27
28
|
|
28
|
-
render :
|
29
|
-
render :
|
29
|
+
return render(nothing: :true) if @children.count.zero?
|
30
|
+
render layout: false, template: "#{collection}/expand_node"
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
@@ -39,7 +40,7 @@ module TheSortableTreeController
|
|
39
40
|
prev_id = params[:prev_id].to_i
|
40
41
|
next_id = params[:next_id].to_i
|
41
42
|
|
42
|
-
render
|
43
|
+
return render(nothing: true, status: :no_content) if parent_id.zero? && prev_id.zero? && next_id.zero?
|
43
44
|
|
44
45
|
variable, collection, klass = self.the_define_common_variables
|
45
46
|
variable = self.instance_variable_set(variable, klass.find(id))
|
@@ -52,7 +53,7 @@ module TheSortableTreeController
|
|
52
53
|
variable.move_to_left_of klass.find(next_id)
|
53
54
|
end
|
54
55
|
|
55
|
-
render(:
|
56
|
+
render(nothing: true, status: :ok)
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
@@ -65,7 +66,7 @@ module TheSortableTreeController
|
|
65
66
|
prev_id = params[:prev_id].to_i
|
66
67
|
next_id = params[:next_id].to_i
|
67
68
|
|
68
|
-
render
|
69
|
+
return render(nothing: true, status: :no_content) if parent_id.zero? && prev_id.zero? && next_id.zero?
|
69
70
|
|
70
71
|
variable, collection, klass = self.the_define_common_variables
|
71
72
|
variable = self.instance_variable_set(variable, klass.find(id))
|
@@ -78,7 +79,7 @@ module TheSortableTreeController
|
|
78
79
|
variable.move_to_right_of klass.find(next_id)
|
79
80
|
end
|
80
81
|
|
81
|
-
render(:
|
82
|
+
render(nothing: true, status: :ok)
|
82
83
|
end
|
83
84
|
end
|
84
85
|
end
|
@@ -13,12 +13,10 @@ module RenderExpandableTreeHelper
|
|
13
13
|
|
14
14
|
def render_node(h, options)
|
15
15
|
@h, @options = h, options
|
16
|
-
|
17
16
|
node = options[:node]
|
18
|
-
# –
|
19
17
|
|
20
18
|
"
|
21
|
-
<li id='#{ node.id }
|
19
|
+
<li data-node-id='#{ node.id }'>
|
22
20
|
<div class='item'>
|
23
21
|
<i class='handle'></i>
|
24
22
|
<b class='expand plus'>+</b>
|
@@ -13,11 +13,10 @@ module RenderSortableTreeHelper
|
|
13
13
|
|
14
14
|
def render_node(h, options)
|
15
15
|
@h, @options = h, options
|
16
|
-
|
17
16
|
node = options[:node]
|
18
17
|
|
19
18
|
"
|
20
|
-
<li id='#{ node.id }
|
19
|
+
<li data-node-id='#{ node.id }'>
|
21
20
|
<div class='item'>
|
22
21
|
<i class='handle'></i>
|
23
22
|
#{ show_link }
|