push_type_admin 0.3.3 → 0.4.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/push_type/admin.js.coffee +9 -2
  3. data/app/assets/javascripts/push_type/directives.js.coffee +43 -0
  4. data/app/assets/javascripts/push_type/nodes.js.coffee +8 -3
  5. data/app/assets/javascripts/push_type/taxonomies.js.coffee +103 -0
  6. data/app/assets/stylesheets/push_type/admin.scss +262 -2
  7. data/app/assets/stylesheets/push_type/foundation_and_overrides.scss +1 -1
  8. data/app/controllers/push_type/taxonomies_controller.rb +36 -0
  9. data/app/controllers/push_type/taxonomy_terms_controller.rb +81 -0
  10. data/app/helpers/push_type/taxonomies_helper.rb +6 -0
  11. data/app/views/push_type/nodes/_form_fields.html.haml +34 -33
  12. data/app/views/push_type/nodes/_form_submit.html.haml +1 -1
  13. data/app/views/push_type/nodes/edit.html.haml +1 -2
  14. data/app/views/push_type/nodes/new.html.haml +1 -2
  15. data/app/views/push_type/taxonomies/index.html.haml +16 -0
  16. data/app/views/push_type/taxonomies/show.html.haml +57 -0
  17. data/config/routes.rb +6 -0
  18. data/lib/push_type/admin/engine.rb +9 -0
  19. data/test/controllers/push_type/taxonomies_controller_test.rb +25 -0
  20. data/test/controllers/push_type/taxonomy_terms_controller_test.rb +84 -0
  21. data/test/dummy/app/models/category.rb +6 -0
  22. data/test/dummy/app/views/taxonomies/category.html.erb +3 -0
  23. data/test/dummy/config/initializers/push_type.rb +3 -1
  24. data/test/dummy/config/secrets.yml +2 -2
  25. data/test/dummy/db/migrate/{20150310192202_create_push_type_users.push_type.rb → 20150406131551_create_push_type_users.push_type.rb} +1 -1
  26. data/test/dummy/db/migrate/{20150310192203_create_push_type_nodes.push_type.rb → 20150406131552_create_push_type_nodes.push_type.rb} +1 -1
  27. data/test/dummy/db/migrate/{20150310192204_create_push_type_node_hierarchies.push_type.rb → 20150406131553_create_push_type_node_hierarchies.push_type.rb} +2 -2
  28. data/test/dummy/db/migrate/{20150310192205_create_push_type_assets.push_type.rb → 20150406131554_create_push_type_assets.push_type.rb} +1 -1
  29. data/test/dummy/db/migrate/20150406131555_create_push_type_taxonomies.push_type.rb +19 -0
  30. data/test/dummy/db/migrate/20150406131556_create_push_type_taxonomy_hierarchies.push_type.rb +17 -0
  31. data/test/dummy/db/schema.rb +29 -9
  32. data/test/dummy/log/test.log +4893 -3071
  33. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_accordion.scssc +0 -0
  34. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_alert-boxes.scssc +0 -0
  35. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_block-grid.scssc +0 -0
  36. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_breadcrumbs.scssc +0 -0
  37. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_button-groups.scssc +0 -0
  38. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_buttons.scssc +0 -0
  39. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_clearing.scssc +0 -0
  40. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_dropdown-buttons.scssc +0 -0
  41. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_dropdown.scssc +0 -0
  42. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_flex-video.scssc +0 -0
  43. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_forms.scssc +0 -0
  44. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_global.scssc +0 -0
  45. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_grid.scssc +0 -0
  46. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_icon-bar.scssc +0 -0
  47. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_inline-lists.scssc +0 -0
  48. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_joyride.scssc +0 -0
  49. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_keystrokes.scssc +0 -0
  50. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_labels.scssc +0 -0
  51. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_magellan.scssc +0 -0
  52. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_offcanvas.scssc +0 -0
  53. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_orbit.scssc +0 -0
  54. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_pagination.scssc +0 -0
  55. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_panels.scssc +0 -0
  56. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_pricing-tables.scssc +0 -0
  57. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_progress-bars.scssc +0 -0
  58. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_range-slider.scssc +0 -0
  59. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_reveal.scssc +0 -0
  60. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_side-nav.scssc +0 -0
  61. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_split-buttons.scssc +0 -0
  62. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_sub-nav.scssc +0 -0
  63. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_switches.scssc +0 -0
  64. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_tables.scssc +0 -0
  65. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_tabs.scssc +0 -0
  66. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_thumbs.scssc +0 -0
  67. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_tooltips.scssc +0 -0
  68. data/test/dummy/tmp/cache/assets/test/sass/5330c0fed9105a4e05d9a06b726c443772e12da7/_top-bar.scssc +0 -0
  69. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_type.scssc +0 -0
  70. data/test/dummy/tmp/cache/assets/test/sass/{9df51eb4a9ff930ccfaadb724cc88e9267641d13 → 5330c0fed9105a4e05d9a06b726c443772e12da7}/_visibility.scssc +0 -0
  71. data/test/dummy/tmp/cache/assets/test/sass/{0bf981301b6f8cfa0a13d38a3554eafaa08d4bc1 → 8e964fb9e2b714a9d3faad7ab62f9bb5096b21bf}/foundation.scssc +0 -0
  72. data/test/dummy/tmp/cache/assets/test/sass/{9ffd013d383870261f2263c294cb3119536e8d59 → c67795fea8d999e739d183abcc4d1330e25b5d36}/_functions.scssc +0 -0
  73. data/test/dummy/tmp/cache/assets/test/sass/ddc338bd04efa4c6ae329e9f4f514bc8d0636fb5/admin.scssc +0 -0
  74. data/test/dummy/tmp/cache/assets/test/sass/ddc338bd04efa4c6ae329e9f4f514bc8d0636fb5/admin_assets.scss.erbc +0 -0
  75. data/test/dummy/tmp/cache/assets/test/sass/{2df752541ff0a319141a1cb83ca971d2ffd2d050 → ddc338bd04efa4c6ae329e9f4f514bc8d0636fb5}/foundation_and_overrides.scssc +0 -0
  76. data/test/dummy/tmp/cache/assets/test/sass/{2df752541ff0a319141a1cb83ca971d2ffd2d050 → ddc338bd04efa4c6ae329e9f4f514bc8d0636fb5}/tagsinput.scssc +0 -0
  77. data/test/dummy/tmp/cache/assets/test/sprockets/{aab84c1f5c24fa406a94eac09d22b2a4 → 01a43d14de05969bd75be96787102a8f} +0 -0
  78. data/test/dummy/tmp/cache/assets/test/sprockets/{5eb2ada2e9af19cdbe5cb8750ce801df → 02df7daeaf181d2bf9db0859ace7ac78} +0 -0
  79. data/test/dummy/tmp/cache/assets/test/sprockets/{0ad373f2b4d9f428b6e58e76da4ec0b9 → 052abf5f4f37b5a381d365f1d81a384f} +0 -0
  80. data/test/dummy/tmp/cache/assets/test/sprockets/{ab6e14fb85dc2ad554e941848018ed3f → 0a4219947cd1a8d37dfcf91d3a09d557} +0 -0
  81. data/test/dummy/tmp/cache/assets/test/sprockets/{3508023b6222e6b0876c773e38ec700d → 0dfb030e402960ab0409cd82dee0f77a} +0 -0
  82. data/test/dummy/tmp/cache/assets/test/sprockets/{e6e78e14e8c962d31e6148ca56230af9 → 0f8fb5fc24f5163e89c3120d0db8a55c} +0 -0
  83. data/test/dummy/tmp/cache/assets/test/sprockets/{27d0805c68db0e1ea5335f4ad7273237 → 10edc6da95775c8efb1aeeeccb3861c1} +0 -0
  84. data/test/dummy/tmp/cache/assets/test/sprockets/{5f85da4ac11a64f005e2656b99be44ac → 165305bae06b65fba3b83e6f050e9449} +0 -0
  85. data/test/dummy/tmp/cache/assets/test/sprockets/{a656594778473574f77b201837cc446f → 1bca52bd72c5954d6cec5490cfd19619} +0 -0
  86. data/test/dummy/tmp/cache/assets/test/sprockets/{faa4ce8149d6e520b0a0855bfd8853e0 → 1c148cfaa96fc18dd39206f147e0be89} +0 -0
  87. data/test/dummy/tmp/cache/assets/test/sprockets/{9850ccc5ff77cfe44eef6c931be25fa2 → 1c1650864315928ff30ac15efdbd6a72} +0 -0
  88. data/test/dummy/tmp/cache/assets/test/sprockets/234ab1ed0a06b51e80d3ce1f22eef80f +0 -0
  89. data/test/dummy/tmp/cache/assets/test/sprockets/26a5499486141a1cfbcd492fca683376 +0 -0
  90. data/test/dummy/tmp/cache/assets/test/sprockets/2b9a9bdd2d50fe0617cfd3ac8f3c7535 +0 -0
  91. data/test/dummy/tmp/cache/assets/test/sprockets/{1956e934d0761e89293cf096aef2ad04 → 2c88d5a49fa0567e394c1d802a1143bd} +0 -0
  92. data/test/dummy/tmp/cache/assets/test/sprockets/2cccbe983a0c901f050bbeb7e6560bb2 +0 -0
  93. data/test/dummy/tmp/cache/assets/test/sprockets/{c8e888c4098e2f3e7e08e7aad9233bd9 → 3b4a91ef8ae8c6c733bbf380db4a51b5} +0 -0
  94. data/test/dummy/tmp/cache/assets/test/sprockets/4291f70c0b1b49b8cb37180e005f1ca5 +0 -0
  95. data/test/dummy/tmp/cache/assets/test/sprockets/{ada55ab3ebb32ffd74145d341fbbcb06 → 44c04143276bf3ec3cb625eac0b4eb5f} +0 -0
  96. data/test/dummy/tmp/cache/assets/test/sprockets/45fede24e630a3890ff78603adac3b40 +0 -0
  97. data/test/dummy/tmp/cache/assets/test/sprockets/{fb4793fb33ff5da9202b3b44e1997140 → 4b96e071d5b0bea51754baa3a4fbcd67} +0 -0
  98. data/test/dummy/tmp/cache/assets/test/sprockets/{03fbfd831772639fdac75dfe5fe9cf64 → 4f11fbb0626468698ded19f801463860} +0 -0
  99. data/test/dummy/tmp/cache/assets/test/sprockets/50e721194ac7b2603499066264fe669d +0 -0
  100. data/test/dummy/tmp/cache/assets/test/sprockets/{30f88df6b769522639aee569e18ab005 → 50ef1236c1f68b14a4447176f367df02} +0 -0
  101. data/test/dummy/tmp/cache/assets/test/sprockets/{cf51890ac703ed5a5d704515a4721815 → 6270c8cc9bce4e44a28cb79decd0c682} +0 -0
  102. data/test/dummy/tmp/cache/assets/test/sprockets/{257233cf9d7cbb01dd74d0fefd6a9384 → 66d5f5d6173f5fcb483c033826309fe9} +0 -0
  103. data/test/dummy/tmp/cache/assets/test/sprockets/{e540a9dc1aa001f8c4cba7a6b00f69d2 → 6892513841335338f628eb301e5e46f4} +0 -0
  104. data/test/dummy/tmp/cache/assets/test/sprockets/{6afb6cb0462c9dab19086aa6c02e619a → 69fad8b0193556718134a4be4088511b} +0 -0
  105. data/test/dummy/tmp/cache/assets/test/sprockets/{b78741de2e56d8ac6629bb0dbf1d5c20 → 6aab772e07a59a05ace08e2f0a8e4f6c} +0 -0
  106. data/test/dummy/tmp/cache/assets/test/sprockets/{488d63b20534d2642d48b86b5a267a3b → 6ddd06b6619f4db1c4c72ec71f516a9f} +0 -0
  107. data/test/dummy/tmp/cache/assets/test/sprockets/{9c34afd1737e54e4eb06cc87ddf17b78 → 736f20368870e59baea915c56e465ce4} +0 -0
  108. data/test/dummy/tmp/cache/assets/test/sprockets/{eeb045e353d91335ea6ec8a8869c322f → 74286734f262b9bfdaba269993f75768} +0 -0
  109. data/test/dummy/tmp/cache/assets/test/sprockets/{0e97b69ac6f777e5725c5faa99228b8b → 74ec7f6ddd6cd98a7a197f6d1fdc7bdc} +0 -0
  110. data/test/dummy/tmp/cache/assets/test/sprockets/{0e01ae9de0f3914c8317853aedd9ace4 → 755a8cd3fa84cdf03061014ccc2dd621} +0 -0
  111. data/test/dummy/tmp/cache/assets/test/sprockets/{8b83fd34df285c871e41af1e2c3efda9 → 7dfe1759f6792869148aa1ee5ee25c32} +0 -0
  112. data/test/dummy/tmp/cache/assets/test/sprockets/80c23adecc9454798ddea565b6e2f955 +0 -0
  113. data/test/dummy/tmp/cache/assets/test/sprockets/81aeaaced37b66582a071d5aa54667be +0 -0
  114. data/test/dummy/tmp/cache/assets/test/sprockets/{2929961e63046a72db4e8d82548a8f31 → 84af7f78cb0d1ce3a3fa87718e171f1c} +0 -0
  115. data/test/dummy/tmp/cache/assets/test/sprockets/{0c7d363f5622cc1f9d3584fdea9a45a8 → 86297411722f24c420a876ea9ae18e37} +0 -0
  116. data/test/dummy/tmp/cache/assets/test/sprockets/{b05f3b842ea70a8728bdfc77fe0c3a37 → 8c74b5681ecb45af77b61df5f959d79a} +0 -0
  117. data/test/dummy/tmp/cache/assets/test/sprockets/{bb38dd1514d70d46cc209c23beacf4ae → 8ca58c6921452f516b6d3d1d6c86b4f5} +0 -0
  118. data/test/dummy/tmp/cache/assets/test/sprockets/93ebdecd5089eeabed49b171f1373c1c +0 -0
  119. data/test/dummy/tmp/cache/assets/test/sprockets/{e28b8ab6a5b3ff792f45d5a6b7d806bc → 95dabfa1407631937482632b2fffcb03} +0 -0
  120. data/test/dummy/tmp/cache/assets/test/sprockets/{8df98e9b5189ffce4cf77a33533416a6 → 99a0c3679c80558e28bba1ecd515a14a} +0 -0
  121. data/test/dummy/tmp/cache/assets/test/sprockets/{226a629ec094e8ad208f2c273121699a → 9a2b48c02d01f27d021a726feaca4fd0} +0 -0
  122. data/test/dummy/tmp/cache/assets/test/sprockets/9d76f803477c4099b6eb8f9d4d52736a +0 -0
  123. data/test/dummy/tmp/cache/assets/test/sprockets/{a9b8decaa2942e8913458c9f35da2693 → 9fa1a48cec5e59b8081516d8f1979087} +0 -0
  124. data/test/dummy/tmp/cache/assets/test/sprockets/{edaf2543a96ee921c30a071b3a73036f → a0869545029330f96741fc96ea2c6930} +0 -0
  125. data/test/dummy/tmp/cache/assets/test/sprockets/{6ffb1f074155829dca88c57f3730a9c3 → a8bde5e0b1b491fb1a275b927bfcb5d8} +0 -0
  126. data/test/dummy/tmp/cache/assets/test/sprockets/{7925f8f38f5165ad9d36a7d73dd00c06 → b1f4d4e270e25cda21255f606e3d8ffe} +0 -0
  127. data/test/dummy/tmp/cache/assets/test/sprockets/{ac6920ecb59148769117dba39b8bb574 → b29fe26f1c1071b42a0bf9f055177649} +0 -0
  128. data/test/dummy/tmp/cache/assets/test/sprockets/{93f1c8b2c57b6a34ce6be7a69af2eeab → b2e69a2811b5e6f453beaa71ff2faa3d} +0 -0
  129. data/test/dummy/tmp/cache/assets/test/sprockets/{633ffb1bd470dc99106053fe08ffcef3 → b5576320a141123874f4348adeb3133f} +0 -0
  130. data/test/dummy/tmp/cache/assets/test/sprockets/be63e5150ae78af2a53a3691c8edb579 +0 -0
  131. data/test/dummy/tmp/cache/assets/test/sprockets/{5c694af01dab7474cace85e2e37233af → c0d10e77d7fb7d6d965e882edfc5da61} +0 -0
  132. data/test/dummy/tmp/cache/assets/test/sprockets/{1821710663a22c38d025f3600144b386 → c1b559fa06c770cd7065a4114d8fd93e} +0 -0
  133. data/test/dummy/tmp/cache/assets/test/sprockets/{508e9ca93a5c6a60e79e3496654497cf → c3d450aa26d5c5f83bc68bcde998f61d} +0 -0
  134. data/test/dummy/tmp/cache/assets/test/sprockets/{0be1680e56bd474e90098c85ed3613f1 → c3f4e4af5c70f490ae17047d3ed2bb51} +0 -0
  135. data/test/dummy/tmp/cache/assets/test/sprockets/{edd24c59de6c00e4e68dbbdf2775984a → c642987b1e8317371d1fc3b3e1a7b55e} +0 -0
  136. data/test/dummy/tmp/cache/assets/test/sprockets/{a93ec74f5cd7f26f8c663d4c481fe689 → c9cc9568b2b18e604aa3a9c9480d9763} +0 -0
  137. data/test/dummy/tmp/cache/assets/test/sprockets/cda72f48ef5c694d8c96c8fe2d854629 +0 -0
  138. data/test/dummy/tmp/cache/assets/test/sprockets/{25da091131e25acf0f55a6528a94f309 → d09161ef4c6cd263e36df8c8a4c86e18} +0 -0
  139. data/test/dummy/tmp/cache/assets/test/sprockets/{ec01e589b2029448373e8112cfd62b6a → d5037255409c85197806006794fcdf40} +0 -0
  140. data/test/dummy/tmp/cache/assets/test/sprockets/{fd06309bc284d80f9c2a30f32ed8df14 → d96931783ed30aa240c60fde4617a351} +0 -0
  141. data/test/dummy/tmp/cache/assets/test/sprockets/{fba226eba4fa5dba560496c64a18009c → d9ddb0aea190ab4fea31822b19386853} +0 -0
  142. data/test/dummy/tmp/cache/assets/test/sprockets/{b762effbcb1d2a5c2e967b26de0b8e2a → db712d4dbb79c4ac60432dcce07bd466} +0 -0
  143. data/test/dummy/tmp/cache/assets/test/sprockets/{6245a5f4c9368169ba2cab2de39b1316 → dd4cfbacaf337f92d161db82f61315b8} +0 -0
  144. data/test/dummy/tmp/cache/assets/test/sprockets/{2196fdacd39bb9f5c4e3755b86d84888 → e09a07bb146f5f5ce0f5b629c800acf3} +0 -0
  145. data/test/dummy/tmp/cache/assets/test/sprockets/{756b24d1d6762675f2f3d781313c59b6 → e129f696cc74c9cc667e27d4fad400d4} +0 -0
  146. data/test/dummy/tmp/cache/assets/test/sprockets/{91e13d81afe9041372ad8f79ee9159f4 → e5ca6700a0d0b3ddc3d4ce604e677015} +0 -0
  147. data/test/dummy/tmp/cache/assets/test/sprockets/{64550cb088f2a8bd25da69f8e7623a7a → e5e26fc0f6b8bda87e424fc53d074460} +0 -0
  148. data/test/dummy/tmp/cache/assets/test/sprockets/{312dcc14683b058a2ecb35f844b45deb → e5e6786891e684e0780275d5931e0d4c} +0 -0
  149. data/test/dummy/tmp/cache/assets/test/sprockets/{7cd04ce7e67cb693aa31bd3e03199ecd → f1a08fd2d7d7ac59d48d3673f528208f} +0 -0
  150. data/test/dummy/tmp/cache/assets/test/sprockets/{720b83386eaf5707c1535472e36ba7fb → f76b0143f821cd347e8668babc8473c2} +0 -0
  151. data/test/dummy/tmp/cache/assets/test/sprockets/{f96cec87308c4d1efa7993c38b770ba3 → ffd5d537d0557053f0955aefea60e00e} +0 -0
  152. data/vendor/assets/javascripts/angular-ui-tree.js +1259 -0
  153. metadata +280 -248
  154. data/test/dummy/tmp/cache/assets/test/sass/2df752541ff0a319141a1cb83ca971d2ffd2d050/admin.scssc +0 -0
  155. data/test/dummy/tmp/cache/assets/test/sass/2df752541ff0a319141a1cb83ca971d2ffd2d050/admin_assets.scss.erbc +0 -0
  156. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_block-grid.scssc +0 -0
  157. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_clearing.scssc +0 -0
  158. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_dropdown-buttons.scssc +0 -0
  159. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_icon-bar.scssc +0 -0
  160. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_range-slider.scssc +0 -0
  161. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_reveal.scssc +0 -0
  162. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_tabs.scssc +0 -0
  163. data/test/dummy/tmp/cache/assets/test/sass/9df51eb4a9ff930ccfaadb724cc88e9267641d13/_top-bar.scssc +0 -0
  164. data/test/dummy/tmp/cache/assets/test/sprockets/147cd256ded8a7797a230bd1f27db96a +0 -0
  165. data/test/dummy/tmp/cache/assets/test/sprockets/23c10c485dbe7ea46614928874120ecf +0 -0
  166. data/test/dummy/tmp/cache/assets/test/sprockets/6c7542a3718ad8d161e94f4816f01ccb +0 -0
  167. data/test/dummy/tmp/cache/assets/test/sprockets/8d531fdb806de0724337e0b80e253914 +0 -0
  168. data/test/dummy/tmp/cache/assets/test/sprockets/c206fbd33f49ab785c6ddf4bcffd3b93 +0 -0
  169. data/test/dummy/tmp/cache/assets/test/sprockets/df90022afc0d52f16bc498be20a5967d +0 -0
  170. data/test/dummy/tmp/cache/assets/test/sprockets/f7cf86568d1c692cb0a565614f282572 +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ad4085f3e097c6588c6b9ee61bce2cc53e4b555
4
- data.tar.gz: df95f82b3bcc826432be6a8c62b087bf6f3af3f6
3
+ metadata.gz: b77ee92c0b5bbfe3c74687c873eeb08fa596421c
4
+ data.tar.gz: 2a3d5d1f2aaa092c7aa4b7cede91e6e346d05437
5
5
  SHA512:
6
- metadata.gz: 1e17757f38197c9b9504e9ba7cd0bb0f3e78725c8ea106ad9c0c94fdecbd637b559296e5559b10ae2baedaa94a7259ee983dc910cb375d16f7169458d20013d9
7
- data.tar.gz: d23997a21eab58ca5587e96404c8ea350c2ab0855ee09f31d5aa9232a643a83c1390986eaa9865010342420953830a231576b783681623ae4953ac2cc9b1b6dd
6
+ metadata.gz: 49c79598c6af1bfd4da9499f992d6e99899c7e90e846efeba75d14281a600d6ebe1b2fd906a226e5b7aa7683b763afc0baee144fa220eace50a6d3d7d428f889
7
+ data.tar.gz: fd2b10880eeaa0405cb2b23770d63f789bed9dcf4696145c65bcd7ab19964c84b8d6fa9db6f2fb10585f49be036a9fc7a529bc68d52bf58c921a15cd18e42928
@@ -13,9 +13,11 @@
13
13
  #= require jquery
14
14
  #= require jquery_ujs
15
15
  #= require turbolinks
16
+ #= require foundation/foundation
16
17
  #= require foundation
17
18
  #= require confirm_with_reveal
18
19
  #= require angular
20
+ #= require angular-ui-tree
19
21
  #= require jquery.sticky
20
22
  #= require jquery.sortable
21
23
  #= require jquery.filedrop
@@ -27,7 +29,12 @@
27
29
 
28
30
  Turbolinks.enableProgressBar()
29
31
 
30
- @app = angular.module 'push_type', []
32
+ @app = angular.module 'push_type', ['ui.tree']
33
+
34
+ @app.run ['$http', ($http) ->
35
+ $http.defaults.headers.common['Accept'] = 'application/json'
36
+ $http.defaults.headers.common['Content-Type'] = 'application/json'
37
+ ]
31
38
 
32
39
  @app.directive 'sidePanel', ->
33
40
  (scope, $el, attrs) ->
@@ -45,7 +52,7 @@ $(document).on 'ready page:load', ->
45
52
  # Bootstrap Angular
46
53
  angular.bootstrap $('[role="main"]'), ['push_type']
47
54
 
48
- $('.sortable').sortable
55
+ $('.node-list.sortable').sortable
49
56
  handle: '.handle'
50
57
  forcePlaceholderSize: true
51
58
  .on 'sortupdate', (e, ui) ->
@@ -0,0 +1,43 @@
1
+ @app.directive 'ptConfirmReveal', ->
2
+ ($scope, $el, $attrs) ->
3
+ # Options
4
+ defaults =
5
+ title: 'Are you sure?'
6
+ body: 'This action cannot be undone.'
7
+ option = (name) -> $el.data(name) || defaults[name]
8
+
9
+ # Define modal
10
+ $modal = $("""
11
+ <div data-reveal class="reveal-modal small">
12
+ <h2 pt-title></h2>
13
+ <p pt-body></p>
14
+ <div>
15
+ <button class="button alert" pt-confirm>OK</button>
16
+ <button class="button secondary" pt-cancel>Cancel</button>
17
+ </div>
18
+ </div>
19
+ """)
20
+
21
+ $modal.find('[pt-title]').html option('title')
22
+ $modal.find('[pt-body]').html option('body')
23
+
24
+ # Define confirm callback
25
+ callbackFn = new Function('$scope', "$scope.#{ $attrs.ptConfirmReveal }")
26
+
27
+ # Bind events
28
+ $modal.find('[pt-confirm]').on 'click', (e) ->
29
+ e.preventDefault()
30
+ callbackFn($scope)
31
+ $modal.foundation('reveal', 'close')
32
+ $modal.find('[pt-cancel]').on 'click', (e) ->
33
+ e.preventDefault()
34
+ $modal.foundation('reveal', 'close')
35
+
36
+ # Reveal the modal
37
+ $el.on 'click', (e) ->
38
+ e.preventDefault()
39
+ $modal
40
+ .appendTo('body')
41
+ .foundation('reveal', 'open')
42
+ .on 'closed.fndtn.reveal', (e) ->
43
+ $modal.remove()
@@ -26,7 +26,6 @@
26
26
  else
27
27
  "Save #{ $scope.typeToString() }"
28
28
 
29
-
30
29
  $scope.publishedDates = ->
31
30
  switch $scope.node.status
32
31
  when 'draft'
@@ -37,7 +36,6 @@
37
36
  else
38
37
  $scope.publishedAtMoment().format('Do MMM YYYY, h:mma')
39
38
 
40
-
41
39
  $scope.publishedAtMoment = ->
42
40
  $scope.published_at ||= if $scope.node.published_at then moment($scope.node.published_at) else moment()
43
41
 
@@ -57,4 +55,11 @@
57
55
  dateArray = $(this).siblings('select').andSelf().map( -> $(this).val() ).get()
58
56
  dateArray[1]--
59
57
  scope[attrs.nodeDatetime] = moment(dateArray)
60
- scope.$apply() unless scope.$$phase
58
+ scope.$apply() unless scope.$$phase
59
+
60
+ @app.directive 'nodeSubmit', ->
61
+ (scope, $el, attrs) ->
62
+ $el.on 'click', (e) ->
63
+ return if $(e.target).is('span')
64
+ $el.parents('form').submit()
65
+
@@ -0,0 +1,103 @@
1
+ @app.controller 'TaxonomyTermsCtrl', ['$scope', '$http', ($scope, $http) ->
2
+
3
+ $scope.basePath = location.pathname + '/terms'
4
+
5
+ $scope.termCount = ->
6
+ $scope.terms.length
7
+
8
+ $scope.newTerm = ->
9
+ $scope.terms.push { children: [] }
10
+
11
+ $scope.treeFuncs = {
12
+ accept: (sourceNodeScope, destNodesScope) ->
13
+ term = sourceNodeScope.term
14
+ matches = $.grep destNodesScope.terms, (i) ->
15
+ i.id != term.id && ( i.title == term.title || i.slug == term.slug )
16
+ if matches.length then false else true
17
+ dropped: (e) ->
18
+ # Unless node is dropped in exactly the same position
19
+ unless e.source.index == e.dest.index && e.source.nodesScope == e.dest.nodesScope
20
+ term = e.source.nodeScope.term
21
+ parent = e.dest.nodesScope.term
22
+ index = e.dest.index
23
+ family = if parent? then parent.children else e.dest.nodesScope.terms or e.source.nodeScope.terms
24
+ obj =
25
+ prev: if family[index-1]? then family[index-1].id else null
26
+ next: if family[index+1]? then family[index+1].id else null
27
+ parent: if parent? then parent.id else null
28
+ url = "#{ $scope.basePath }/#{ term.id }/position"
29
+ req = $http.post url, obj
30
+ }
31
+
32
+ ]
33
+
34
+ @app.controller 'TaxonomyTermCtrl', ['$scope', '$http', ($scope, $http) ->
35
+
36
+ $scope.master = {}
37
+
38
+ $scope.errors = {}
39
+
40
+ $scope.isEditing = ->
41
+ $scope.isNewTerm() || $scope.termForm.$dirty
42
+
43
+ $scope.edit = ->
44
+ $scope.master = angular.copy($scope.term)
45
+ $scope.termForm.$setDirty()
46
+
47
+ $scope.reset = ->
48
+ # We need to reset the slug to force child nodes to
49
+ # update permalink
50
+ $scope.term.slug = $scope.master.slug
51
+ $scope.term = angular.copy($scope.master)
52
+ $scope.termForm.$setPristine()
53
+ if $scope.isNewTerm()
54
+ $scope.popTerm($scope.term)
55
+
56
+ $scope.popTerm = (term) ->
57
+ idx = $.inArray(term, $scope.terms)
58
+ $scope.terms.splice(idx, 1);
59
+
60
+ $scope.save = ->
61
+ params = {}
62
+ params[$scope.param] = $scope.term
63
+
64
+ req = if $scope.isNewTerm()
65
+ $http.post $scope.basePath, params
66
+ else
67
+ url = $scope.basePath + '/' + $scope.term.id
68
+ $http.put url, params
69
+
70
+ req.success (data) ->
71
+ $scope.term.id = data.term.id if $scope.isNewTerm()
72
+ $scope.termForm.$setPristine()
73
+ req.error (data, status) ->
74
+ for field, error of data.errors
75
+ $scope.errors[field] = error[0]
76
+ $scope.termForm[field].$valid = false
77
+
78
+ $scope.delete = ->
79
+ url = $scope.basePath + '/' + $scope.term.id
80
+ $http.delete url
81
+ $scope.popTerm($scope.term)
82
+
83
+ $scope.setSlug = ->
84
+ if $scope.isNewTerm()
85
+ $scope.term.slug = $scope.term.title.toLowerCase().replace(/[\s\_]/g, '-').replace(/[^\w\-]/g, '')
86
+
87
+ $scope.errorClass = (field) ->
88
+ if $scope.errors[field] then 'error' else null
89
+
90
+ $scope.isNewTerm = ->
91
+ angular.isUndefined($scope.term.id)
92
+
93
+ $scope.termPermalink = ->
94
+ path = [$scope.baseSlug]
95
+ addParents = (scope) ->
96
+ if scope.$parentNodeScope?
97
+ addParents(scope.$parentNodeScope)
98
+ path.push scope.$parentNodeScope.term.slug
99
+ addParents($scope)
100
+ path.push $scope.term.slug
101
+ '/' + path.join('/')
102
+
103
+ ]
@@ -138,6 +138,13 @@ table {
138
138
  .node-list {
139
139
  @extend .no-bullet;
140
140
  margin: 0;
141
+ .sortable-placeholder {
142
+ background-color: scale-color($warning-color, $lightness: 95%);
143
+ border-bottom: 1px solid $crumb-border-color;
144
+ &:last-child {
145
+ border-bottom: none;
146
+ }
147
+ }
141
148
  }
142
149
 
143
150
  .node-list-item {
@@ -252,10 +259,203 @@ table {
252
259
  }
253
260
  }
254
261
 
262
+ .taxonomies-list-item {
263
+ position: relative;
264
+ background-color: $white;
265
+ border: 1px solid $crumb-border-color;
266
+ @include radius($global-radius);
267
+
268
+ > a {
269
+ display: block;
270
+ @include single-transition(background-color, 200ms);
271
+ &:hover {
272
+ background-color: scale-color($primary-color, $lightness: 97.5%);
273
+ .title {
274
+ color: scale-color($primary-color, $lightness: -12%);
275
+ }
276
+ }
277
+ }
278
+ .title {
279
+ padding: rem-calc(20 15);
280
+ line-height: rem-calc(28);
281
+ font-size: rem-calc(18);
282
+ color: $tuatara;
283
+ overflow: hidden;
284
+ white-space: nowrap;
285
+ }
286
+ .meta {
287
+ height: rem-calc(40);
288
+ padding: rem-calc(0 15 0);
289
+ line-height: rem-calc(40);
290
+ font-size: rem-calc(13);
291
+ color: $aluminum;
292
+ border-top: 1px solid $crumb-border-color;
293
+ .label {
294
+ margin-right: rem-calc(10);
295
+ }
296
+ }
297
+ }
298
+
299
+ .taxonomy-term-list, .nested-taxonomy-term-list {
300
+ margin: 0;
301
+ list-style: none;
302
+ }
303
+
304
+ .nested-taxonomy-term-list {
305
+ border-top: 1px solid $crumb-border-color;
306
+ padding-left: rem-calc(40);
307
+ &:empty {
308
+ border-top: none;
309
+ }
310
+ .taxonomy-term-item {
311
+ .show, form {
312
+ border-left: 1px solid $crumb-border-color;
313
+ }
314
+ }
315
+ .taxonomy-term-item, .angular-ui-tree-placeholder {
316
+ &:before, &:after {
317
+ position: absolute;
318
+ right: 100%;
319
+ top: 0;
320
+ content: ' ';
321
+ display: block;
322
+ width: rem-calc(23);
323
+ border-left: 6px solid $crumb-border-color;
324
+ }
325
+ &:before {
326
+ height: rem-calc(43);
327
+ border-bottom: 6px solid $crumb-border-color;
328
+ }
329
+ &:after {
330
+ bottom: -1px;
331
+ }
332
+ &:last-child:after {
333
+ display: none;
334
+ }
335
+ }
336
+ }
337
+
338
+ .taxonomy-term-item {
339
+ position: relative;
340
+ border-bottom: 1px solid $crumb-border-color;
341
+
342
+ &:last-child {
343
+ border-bottom: none;
344
+ }
345
+ .show {
346
+ position: relative;
347
+ }
348
+ .title {
349
+ height: rem-calc(40);
350
+ padding: rem-calc(10 15 6 40);
351
+ line-height: rem-calc(24);
352
+ font-size: rem-calc(18);
353
+ color: $tuatara;
354
+ overflow: hidden;
355
+ white-space: nowrap;
356
+ }
357
+ .meta {
358
+ height: rem-calc(40);
359
+ padding: rem-calc(0 15 0 40);
360
+ line-height: rem-calc(40);
361
+ font-size: rem-calc(13);
362
+ color: $aluminum;
363
+ .label {
364
+ margin-right: rem-calc(10);
365
+ }
366
+ }
367
+ .buttons, .edit {
368
+ position: absolute;
369
+ top: 0;
370
+ right: 0;
371
+ bottom: 0;
372
+ line-height: rem-calc(40);
373
+ text-align: center;
374
+ border-left: 1px solid $crumb-border-color;
375
+ a {
376
+ @extend %block-link-bg;
377
+ color: $primary-color;
378
+ }
379
+ }
380
+ .buttons {
381
+ width: rem-calc(40);
382
+ a, span {
383
+ display: block;
384
+ width: 100%;
385
+ height: rem-calc(40);
386
+ color: $gainsboro;
387
+ &:first-child {
388
+ border-bottom: 1px solid $crumb-border-color;
389
+ }
390
+ }
391
+ a.alert {
392
+ color: $alert-color;
393
+ }
394
+ a.success {
395
+ color: $success-color;
396
+ }
397
+ }
398
+ .edit {
399
+ width: rem-calc(90);
400
+ .icon {
401
+ height: rem-calc(40);
402
+ padding-top: rem-calc(10);
403
+ font-size: rem-calc(24);
404
+ }
405
+ .meta {
406
+ padding: 0 !important;
407
+ }
408
+ }
409
+ .handle {
410
+ position: absolute;
411
+ top: 6px;
412
+ left: 6px;
413
+ height: rem-calc(68);
414
+ width: rem-calc(19);
415
+ background-color: $white-smoke;
416
+ cursor: move;
417
+ @include single-transition(background-color, 200ms);
418
+ &:hover {
419
+ background-color: $gainsboro;
420
+ }
421
+ }
422
+ form {
423
+ overflow: auto;
424
+ padding-top: rem-calc(16);
425
+ }
426
+ }
427
+
428
+ .angular-ui-tree-empty, .angular-ui-tree-hidden {
429
+ display: none;
430
+ }
431
+
432
+ .angular-ui-tree-placeholder {
433
+ position: relative;
434
+ width: auto !important;
435
+ border-bottom: 1px solid $crumb-border-color;
436
+ background-color: scale-color($warning-color, $lightness: 95%);
437
+ &:last-child {
438
+ border-bottom: none;
439
+ }
440
+ }
441
+
442
+ .angular-ui-tree-drag {
443
+ position: absolute;
444
+ background-color: $white;
445
+ border: 1px solid $primary-color;
446
+ box-shadow: 10px 10px 10px #000 !important;
447
+ pointer-events: none;
448
+ opacity: .9;
449
+ > li > div > .show .handle {
450
+ background-color: $primary-color;
451
+ }
452
+ }
453
+
255
454
  .user-list-item {
256
455
  position: relative;
257
456
  background-color: $white;
258
457
  border: 1px solid $crumb-border-color;
458
+ @include radius($global-radius);
259
459
 
260
460
  > a {
261
461
  display: block;
@@ -476,7 +676,7 @@ form .title {
476
676
 
477
677
  form .permalink {
478
678
  .columns {
479
- opacity: 0;
679
+ opacity: 0;
480
680
  }
481
681
  .visible {
482
682
  opacity: 1 !important;
@@ -575,4 +775,64 @@ form .asset-upload {
575
775
  }
576
776
 
577
777
  @import "foundation-icons";
578
- @import "tagsinput";
778
+ @import "tagsinput";
779
+
780
+
781
+
782
+
783
+
784
+
785
+
786
+ //.angular-ui-tree {
787
+ //
788
+ //}
789
+ //
790
+ //.angular-ui-tree-empty {
791
+ // border: 1px dashed #bbb;
792
+ // min-height: 100px;
793
+ // background-color: #e5e5e5;
794
+ // background-image: -webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), -webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
795
+ // background-image: -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
796
+ // background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
797
+ // background-size: 60px 60px;
798
+ // background-position: 0 0, 30px 30px;
799
+ //}
800
+ //
801
+ //.angular-ui-tree-nodes {
802
+ // display: block;
803
+ // position: relative;
804
+ // margin: 0px;
805
+ // padding: 0px;
806
+ // list-style: none;
807
+ //}
808
+ //
809
+ //.angular-ui-tree-nodes .angular-ui-tree-nodes {
810
+ // padding-left: 20px;
811
+ //}
812
+ //.angular-ui-tree-node, .angular-ui-tree-placeholder {
813
+ // display: block;
814
+ // position: relative;
815
+ // margin: 0px;
816
+ // padding: 0px;
817
+ // min-height: 20px;
818
+ // line-height: 20px;
819
+ //}
820
+ //
821
+
822
+ //
823
+ //.angular-ui-tree-placeholder {
824
+ // margin: 5px 0;
825
+ // padding: 0;
826
+ // min-height: 30px;
827
+ //}
828
+ //
829
+ //.angular-ui-tree-handle {
830
+ // cursor: move;
831
+ // text-decoration: none;
832
+ // font-weight: bold;
833
+ // -webkit-box-sizing: border-box;
834
+ // -moz-box-sizing: border-box;
835
+ // box-sizing: border-box;
836
+ // min-height: 20px;
837
+ // line-height: 20px;
838
+ //}
@@ -624,7 +624,7 @@ $form-label-font-color: $aluminum;
624
624
  $form-label-bottom-margin: rem-calc(5);
625
625
  $input-font-family: inherit;
626
626
  $input-font-color: $jet;
627
- $input-font-size: inherit;
627
+ $input-font-size: rem-calc(16);
628
628
  // $input-bg-color: $white;
629
629
  // $input-focus-bg-color: scale-color($white, $lightness: -2%);
630
630
  // $input-border-color: scale-color($white, $lightness: -20%);
@@ -0,0 +1,36 @@
1
+ require_dependency "push_type/admin_controller"
2
+
3
+ module PushType
4
+ class TaxonomiesController < AdminController
5
+
6
+ def index
7
+ @taxonomies = PushType::Taxonomy.descendants
8
+ end
9
+
10
+ def show
11
+ @terms = taxonomy.hash_tree.map { |parent, children| json_map(parent, children) }
12
+ end
13
+
14
+ private
15
+
16
+ def initial_breadcrumb
17
+ breadcrumbs.add 'Taxonomies', push_type.taxonomies_path
18
+ end
19
+
20
+ def taxonomy
21
+ @taxonomy ||= PushType::Taxonomy.descendants.find { |t| t.name.underscore == params[:id] }
22
+ end
23
+
24
+ def json_map(parent, children)
25
+ {
26
+ id: parent.id,
27
+ title: parent.title,
28
+ slug: parent.slug,
29
+ sort_order: parent.sort_order,
30
+ parent_id: parent.parent_id,
31
+ children: children.map { |p, c| json_map(p, c) }
32
+ }
33
+ end
34
+
35
+ end
36
+ end
@@ -0,0 +1,81 @@
1
+ require_dependency "push_type/admin_controller"
2
+
3
+ module PushType
4
+ class TaxonomyTermsController < AdminController
5
+
6
+ before_filter :build_term, only: :create
7
+ before_filter :load_term, only: [:update, :destroy, :position]
8
+
9
+ def create
10
+ respond_to do |format|
11
+ format.json do
12
+ if @term.save
13
+ render json: { term: @term.as_json }, status: :created
14
+ else
15
+ render json: { errors: @term.errors }, status: :unprocessable_entity
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ def update
22
+ respond_to do |format|
23
+ format.json do
24
+ if @term.update_attributes taxonomy_params
25
+ head :ok
26
+ else
27
+ render json: { errors: @term.errors }, status: :unprocessable_entity
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ def destroy
34
+ respond_to do |format|
35
+ format.json do
36
+ @term.destroy
37
+ head :ok
38
+ end
39
+ end
40
+ end
41
+
42
+ def position
43
+ respond_to do |format|
44
+ format.json do
45
+ reorder_term
46
+ head :ok
47
+ end
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ def taxonomy
54
+ @taxonomy ||= PushType::Taxonomy.descendants.find { |t| t.name.underscore == params[:taxonomy_id] }
55
+ end
56
+
57
+ def build_term
58
+ @term = taxonomy.new taxonomy_params
59
+ end
60
+
61
+ def load_term
62
+ @term = taxonomy.find params[:id]
63
+ end
64
+
65
+ def taxonomy_params
66
+ params.fetch(taxonomy.name.underscore.to_sym, {}).permit(:id, :title, :slug)
67
+ end
68
+
69
+ def reorder_term
70
+ if params[:prev]
71
+ taxonomy.find(params[:prev]).append_sibling(@term)
72
+ elsif params[:next]
73
+ taxonomy.find(params[:next]).prepend_sibling(@term)
74
+ elsif params[:parent]
75
+ taxonomy.find(params[:parent]).append_child(@term)
76
+ end
77
+ end
78
+
79
+
80
+ end
81
+ end
@@ -0,0 +1,6 @@
1
+ module PushType
2
+ module TaxonomiesHelper
3
+
4
+
5
+ end
6
+ end