ecm_cms_navigation 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +38 -0
  4. data/app/admin/ecm/cms_navigation/navigation_items.rb +75 -0
  5. data/app/admin/ecm/cms_navigation/navigations.rb +51 -0
  6. data/app/assets/stylesheets/active_admin/ecm-cms-navigation.css +3 -0
  7. data/app/helpers/ecm/cms_navigation_helper.rb +37 -0
  8. data/app/models/ecm/cms_navigation/navigation.rb +24 -0
  9. data/app/models/ecm/cms_navigation/navigation_item.rb +38 -0
  10. data/config/locales/ecm.cms_navigation.de.yml +26 -0
  11. data/config/locales/ecm.cms_navigation.en.yml +26 -0
  12. data/config/locales/ecm.cms_navigation.navigation.de.yml +14 -0
  13. data/config/locales/ecm.cms_navigation.navigation.en.yml +14 -0
  14. data/config/locales/ecm.cms_navigation.navigation_item.de.yml +16 -0
  15. data/config/locales/ecm.cms_navigation.navigation_item.en.yml +16 -0
  16. data/db/migrate/001_create_ecm_cms_navigation_navigations.rb +10 -0
  17. data/db/migrate/002_create_ecm_cms_navigation_navigation_items.rb +17 -0
  18. data/lib/ecm/cms_navigation/engine.rb +34 -0
  19. data/lib/ecm/cms_navigation/version.rb +5 -0
  20. data/lib/ecm_cms_navigation.rb +2 -0
  21. data/lib/generators/ecm/cms_navigation/install/install_generator.rb +16 -0
  22. data/lib/generators/ecm/cms_navigation/navigation/navigation_generator.rb +15 -0
  23. data/lib/generators/ecm/cms_navigation/navigation/templates/navigation.rb +1 -0
  24. data/lib/tasks/ecm_cms_navigation_tasks.rake +4 -0
  25. data/test/dummy/README.rdoc +261 -0
  26. data/test/dummy/Rakefile +7 -0
  27. data/test/dummy/app/admin/admin_users.rb +32 -0
  28. data/test/dummy/app/admin/dashboards.rb +44 -0
  29. data/test/dummy/app/assets/javascripts/active_admin.js +1 -0
  30. data/test/dummy/app/assets/javascripts/application.js +15 -0
  31. data/test/dummy/app/assets/stylesheets/active_admin.css.scss +6 -0
  32. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  33. data/test/dummy/app/controllers/application_controller.rb +3 -0
  34. data/test/dummy/app/controllers/home_controller.rb +4 -0
  35. data/test/dummy/app/helpers/application_helper.rb +2 -0
  36. data/test/dummy/app/models/admin_user.rb +17 -0
  37. data/test/dummy/app/views/home/index.html.erb +6 -0
  38. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  39. data/test/dummy/config/application.rb +59 -0
  40. data/test/dummy/config/boot.rb +10 -0
  41. data/test/dummy/config/database.yml +25 -0
  42. data/test/dummy/config/environment.rb +5 -0
  43. data/test/dummy/config/environments/development.rb +37 -0
  44. data/test/dummy/config/environments/production.rb +67 -0
  45. data/test/dummy/config/environments/test.rb +37 -0
  46. data/test/dummy/config/initializers/active_admin.rb +134 -0
  47. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  48. data/test/dummy/config/initializers/devise.rb +216 -0
  49. data/test/dummy/config/initializers/inflections.rb +15 -0
  50. data/test/dummy/config/initializers/mime_types.rb +5 -0
  51. data/test/dummy/config/initializers/secret_token.rb +7 -0
  52. data/test/dummy/config/initializers/session_store.rb +8 -0
  53. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  54. data/test/dummy/config/locales/admin_user.de.yml +16 -0
  55. data/test/dummy/config/locales/de.yml +161 -0
  56. data/test/dummy/config/locales/devise.en.yml +57 -0
  57. data/test/dummy/config/locales/ecm.admin.de.yml +5 -0
  58. data/test/dummy/config/locales/ecm.cms-core.de.yml +48 -0
  59. data/test/dummy/config/locales/ecm.cms-core.en.yml +48 -0
  60. data/test/dummy/config/locales/ecm.cms-navigation.de.yml +47 -0
  61. data/test/dummy/config/locales/ecm.cms-navigation.en.yml +46 -0
  62. data/test/dummy/config/locales/en.yml +5 -0
  63. data/test/dummy/config/navigation.rb +0 -0
  64. data/test/dummy/config/routes.rb +63 -0
  65. data/test/dummy/config.ru +4 -0
  66. data/test/dummy/db/development.sqlite3 +0 -0
  67. data/test/dummy/db/migrate/20120407123948_devise_create_admin_users.rb +52 -0
  68. data/test/dummy/db/migrate/20120407143959_create_admin_notes.rb +17 -0
  69. data/test/dummy/db/migrate/20120407144000_move_admin_notes_to_comments.rb +25 -0
  70. data/test/dummy/db/migrate/20120621131006_create_ecm_cms_navigation_navigations.ecm_cms_navigation_engine.rb +11 -0
  71. data/test/dummy/db/migrate/20120621131007_create_ecm_cms_navigation_navigation_items.ecm_cms_navigation_engine.rb +18 -0
  72. data/test/dummy/db/schema.rb +70 -0
  73. data/test/dummy/log/development.log +6203 -0
  74. data/test/dummy/public/404.html +26 -0
  75. data/test/dummy/public/422.html +26 -0
  76. data/test/dummy/public/500.html +25 -0
  77. data/test/dummy/public/favicon.ico +0 -0
  78. data/test/dummy/public/stylesheets/active_admin/ecm-cms-navigation.css +3 -0
  79. data/test/dummy/script/rails +6 -0
  80. data/test/dummy/test/fixtures/admin_users.yml +11 -0
  81. data/test/dummy/test/unit/admin_user_test.rb +7 -0
  82. data/test/dummy/tmp/cache/assets/C1D/230/sprockets%2F02e9e2543661cd626253c7f004464493 +0 -0
  83. data/test/dummy/tmp/cache/assets/C80/820/sprockets%2F2fcd9e4a7533803943533046c5f3d560 +0 -0
  84. data/test/dummy/tmp/cache/assets/C8D/7C0/sprockets%2F48c1ed30977942d1674d3199d08b436d +0 -0
  85. data/test/dummy/tmp/cache/assets/C8E/6C0/sprockets%2Ff6e52920f98efa019261497767e041b5 +0 -0
  86. data/test/dummy/tmp/cache/assets/CAB/C40/sprockets%2F4477e59061a7d1e7ad744e6f2670a001 +0 -0
  87. data/test/dummy/tmp/cache/assets/CBC/520/sprockets%2F4204f20b76901301c0004b9df1cdde04 +0 -0
  88. data/test/dummy/tmp/cache/assets/CBE/0D0/sprockets%2F3b521b46440e9901877e67b3d595d6ef +0 -0
  89. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  90. data/test/dummy/tmp/cache/assets/CDB/040/sprockets%2Fc732474e67003a4eb840eb44c5ca9385 +0 -0
  91. data/test/dummy/tmp/cache/assets/CDE/A60/sprockets%2Fc8fd4776f82e110ec70f1112369fc333 +0 -0
  92. data/test/dummy/tmp/cache/assets/CF0/C10/sprockets%2F48e5f698b22e7a97ebc0d7515d180827 +0 -0
  93. data/test/dummy/tmp/cache/assets/CFB/BB0/sprockets%2F03ed1ef04e988e52c1bb424143b7401a +0 -0
  94. data/test/dummy/tmp/cache/assets/CFC/CE0/sprockets%2F081e67e39b56f0f99c68593a5ef2925d +0 -0
  95. data/test/dummy/tmp/cache/assets/D08/940/sprockets%2Ff3e82f5481bc64820c2a2f270045f6fa +0 -0
  96. data/test/dummy/tmp/cache/assets/D09/9B0/sprockets%2F3169613ce57de4cdf262803a5dd2b740 +0 -0
  97. data/test/dummy/tmp/cache/assets/D0D/A80/sprockets%2F5459a5ca0e63be62545e2d4a4742b7c8 +0 -0
  98. data/test/dummy/tmp/cache/assets/D12/D00/sprockets%2Fddf374b4e6ec55510ef906085094a54c +0 -0
  99. data/test/dummy/tmp/cache/assets/D14/D40/sprockets%2Fd108c2aff238873e06a7c6fb079d7443 +0 -0
  100. data/test/dummy/tmp/cache/assets/D17/750/sprockets%2F6f150f81cc3f03a91888db0b6875af57 +0 -0
  101. data/test/dummy/tmp/cache/assets/D18/7A0/sprockets%2Fd70b33bb7e9db0e665965b947a6275e0 +0 -0
  102. data/test/dummy/tmp/cache/assets/D2D/010/sprockets%2Fd48e0f08b09c78a502d11ec2df419a00 +0 -0
  103. data/test/dummy/tmp/cache/assets/D2E/C90/sprockets%2Fd106d47b969c6805798ff5cb05f8c59f +0 -0
  104. data/test/dummy/tmp/cache/assets/D31/E50/sprockets%2F86295df08e3769c5c68b3fccc977727c +0 -0
  105. data/test/dummy/tmp/cache/assets/D32/010/sprockets%2F7f752ae9016db83230fcf2c24017c4ae +0 -0
  106. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  107. data/test/dummy/tmp/cache/assets/D38/540/sprockets%2F86e1ad844bc9df4491a2a52b870421db +0 -0
  108. data/test/dummy/tmp/cache/assets/D39/910/sprockets%2F7a5ba442debf604fd3195483a4ba1875 +0 -0
  109. data/test/dummy/tmp/cache/assets/D3B/630/sprockets%2Fc549fd403a43fca068992bc190e32ca8 +0 -0
  110. data/test/dummy/tmp/cache/assets/D48/640/sprockets%2F9f4f18d910b678b1d0777e04cdaf6f24 +0 -0
  111. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  112. data/test/dummy/tmp/cache/assets/D59/D70/sprockets%2Fed9f0de1b65ae8d7ef89087c83728461 +0 -0
  113. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  114. data/test/dummy/tmp/cache/assets/D65/A10/sprockets%2F5d2a785575b7ddc8e93e1ab10c3f201b +0 -0
  115. data/test/dummy/tmp/cache/assets/D79/910/sprockets%2F6f54ace661399cc3bf262f81d9c5a7f0 +0 -0
  116. data/test/dummy/tmp/cache/assets/D81/4B0/sprockets%2F33d0fa9de67898d28edc22d7dc7c2727 +0 -0
  117. data/test/dummy/tmp/cache/assets/D85/0C0/sprockets%2F3faa7a2282b2a4530f7253eb9a2b5bac +0 -0
  118. data/test/dummy/tmp/cache/assets/D93/4C0/sprockets%2F857ecd2092cee11f740b3cf2e373ad2a +0 -0
  119. data/test/dummy/tmp/cache/assets/D9F/990/sprockets%2Faef93bd19f09e008e68ce6f1bcb09412 +0 -0
  120. data/test/dummy/tmp/cache/assets/DA9/0B0/sprockets%2Feea56b6eec8c2eb4069704df6f15a289 +0 -0
  121. data/test/dummy/tmp/cache/assets/DA9/900/sprockets%2Fe1f74b542e4ee1ec991bb3e84209e8ee +0 -0
  122. data/test/dummy/tmp/cache/assets/DB8/A40/sprockets%2F529735aeec02af5d05bb03b1de2a5ad8 +0 -0
  123. data/test/dummy/tmp/cache/assets/DCB/210/sprockets%2F598702ccb42e02ff5db7ac4f6670afda +0 -0
  124. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  125. data/test/dummy/tmp/cache/assets/DDE/420/sprockets%2Ffb8b186d5bf0307f86f65fc787d2adeb +0 -0
  126. data/test/dummy/tmp/cache/assets/DF9/680/sprockets%2F552b35d5afffa72ded4bb41f2e88d41a +0 -0
  127. data/test/dummy/tmp/cache/assets/DFE/E50/sprockets%2F7c40c693372adf7a3fafc7aae8b63af5 +0 -0
  128. data/test/dummy/tmp/cache/assets/E04/5A0/sprockets%2Fda71e1fafe3707d7ff5532b1f6c89baf +0 -0
  129. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  130. data/test/dummy/tmp/cache/sass/2e0f90a26ed3334980f9f0cefc7301c037c5e6a7/_all.css.scssc +0 -0
  131. data/test/dummy/tmp/cache/sass/2e0f90a26ed3334980f9f0cefc7301c037c5e6a7/_buttons.css.scssc +0 -0
  132. data/test/dummy/tmp/cache/sass/2e0f90a26ed3334980f9f0cefc7301c037c5e6a7/_gradients.css.scssc +0 -0
  133. data/test/dummy/tmp/cache/sass/2e0f90a26ed3334980f9f0cefc7301c037c5e6a7/_icons.css.scssc +0 -0
  134. data/test/dummy/tmp/cache/sass/2e0f90a26ed3334980f9f0cefc7301c037c5e6a7/_reset.css.scssc +0 -0
  135. data/test/dummy/tmp/cache/sass/2e0f90a26ed3334980f9f0cefc7301c037c5e6a7/_rounded.css.scssc +0 -0
  136. data/test/dummy/tmp/cache/sass/2e0f90a26ed3334980f9f0cefc7301c037c5e6a7/_sections.css.scssc +0 -0
  137. data/test/dummy/tmp/cache/sass/2e0f90a26ed3334980f9f0cefc7301c037c5e6a7/_shadows.css.scssc +0 -0
  138. data/test/dummy/tmp/cache/sass/2e0f90a26ed3334980f9f0cefc7301c037c5e6a7/_typography.scssc +0 -0
  139. data/test/dummy/tmp/cache/sass/2e0f90a26ed3334980f9f0cefc7301c037c5e6a7/_utilities.scssc +0 -0
  140. data/test/dummy/tmp/cache/sass/2e0f90a26ed3334980f9f0cefc7301c037c5e6a7/_variables.css.scssc +0 -0
  141. data/test/dummy/tmp/cache/sass/378a5efbe5b1fb270a5eba61f1413b4042bc0f25/_button.scssc +0 -0
  142. data/test/dummy/tmp/cache/sass/378a5efbe5b1fb270a5eba61f1413b4042bc0f25/_clearfix.scssc +0 -0
  143. data/test/dummy/tmp/cache/sass/378a5efbe5b1fb270a5eba61f1413b4042bc0f25/_font-family.scssc +0 -0
  144. data/test/dummy/tmp/cache/sass/378a5efbe5b1fb270a5eba61f1413b4042bc0f25/_html5-input-types.scssc +0 -0
  145. data/test/dummy/tmp/cache/sass/378a5efbe5b1fb270a5eba61f1413b4042bc0f25/_position.scssc +0 -0
  146. data/test/dummy/tmp/cache/sass/378a5efbe5b1fb270a5eba61f1413b4042bc0f25/_timing-functions.scssc +0 -0
  147. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_batch_actions.css.scssc +0 -0
  148. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_blank_slates.scssc +0 -0
  149. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_breadcrumbs.scssc +0 -0
  150. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_buttons.scssc +0 -0
  151. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_columns.scssc +0 -0
  152. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_comments.css.scssc +0 -0
  153. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_date_picker.css.scssc +0 -0
  154. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_flash_messages.css.scssc +0 -0
  155. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_grid.scssc +0 -0
  156. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_links.scssc +0 -0
  157. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_pagination.scssc +0 -0
  158. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_panels.scssc +0 -0
  159. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_popovers.css.scssc +0 -0
  160. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_scopes.scssc +0 -0
  161. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_status_tags.scssc +0 -0
  162. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_table_tools.css.scssc +0 -0
  163. data/test/dummy/tmp/cache/sass/69c1f805ecd19454a5adf31f922b96c98249e909/_tables.css.scssc +0 -0
  164. data/test/dummy/tmp/cache/sass/6d50bd3bb8f79c9ddfeb03076798c5250f1bb8b6/_footer.scssc +0 -0
  165. data/test/dummy/tmp/cache/sass/6d50bd3bb8f79c9ddfeb03076798c5250f1bb8b6/_main_structure.scssc +0 -0
  166. data/test/dummy/tmp/cache/sass/6d50bd3bb8f79c9ddfeb03076798c5250f1bb8b6/_title_bar.scssc +0 -0
  167. data/test/dummy/tmp/cache/sass/7842134ab963cf09dadd7c2615b49cc6825f6976/_bourbon.scssc +0 -0
  168. data/test/dummy/tmp/cache/sass/7fa69198e74897139322c878f468e646709df4fe/_base.css.scssc +0 -0
  169. data/test/dummy/tmp/cache/sass/7fa69198e74897139322c878f468e646709df4fe/_forms.css.scssc +0 -0
  170. data/test/dummy/tmp/cache/sass/7fa69198e74897139322c878f468e646709df4fe/_header.css.scssc +0 -0
  171. data/test/dummy/tmp/cache/sass/7fa69198e74897139322c878f468e646709df4fe/_mixins.css.scssc +0 -0
  172. data/test/dummy/tmp/cache/sass/7fa69198e74897139322c878f468e646709df4fe/_typography.css.scssc +0 -0
  173. data/test/dummy/tmp/cache/sass/7fa69198e74897139322c878f468e646709df4fe/print.css.scssc +0 -0
  174. data/test/dummy/tmp/cache/sass/93540e1dfd808fbf20fd1c5388bc9c65df2ce6a0/active_admin.css.scssc +0 -0
  175. data/test/dummy/tmp/cache/sass/97dc896013aa89b6e113ee6298b3e4ae01f2ca5c/_dashboard.scssc +0 -0
  176. data/test/dummy/tmp/cache/sass/97dc896013aa89b6e113ee6298b3e4ae01f2ca5c/_logged_out.scssc +0 -0
  177. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_animation.scssc +0 -0
  178. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_appearance.scssc +0 -0
  179. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_background-image.scssc +0 -0
  180. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_background-size.scssc +0 -0
  181. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_border-image.scssc +0 -0
  182. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_border-radius.scssc +0 -0
  183. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_box-shadow.scssc +0 -0
  184. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_box-sizing.scssc +0 -0
  185. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_columns.scssc +0 -0
  186. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_flex-box.scssc +0 -0
  187. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_inline-block.scssc +0 -0
  188. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_linear-gradient.scssc +0 -0
  189. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_radial-gradient.scssc +0 -0
  190. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_transform.scssc +0 -0
  191. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_transition.scssc +0 -0
  192. data/test/dummy/tmp/cache/sass/abf1c7b1db7af47efaba561dc159ec42907e4376/_user-select.scssc +0 -0
  193. data/test/dummy/tmp/cache/sass/b8feec7b5dd9bdfcb6b02acda27daed749f5790a/_deprecated-webkit-gradient.scssc +0 -0
  194. data/test/dummy/tmp/cache/sass/b8feec7b5dd9bdfcb6b02acda27daed749f5790a/_flex-grid.scssc +0 -0
  195. data/test/dummy/tmp/cache/sass/b8feec7b5dd9bdfcb6b02acda27daed749f5790a/_grid-width.scssc +0 -0
  196. data/test/dummy/tmp/cache/sass/b8feec7b5dd9bdfcb6b02acda27daed749f5790a/_linear-gradient.scssc +0 -0
  197. data/test/dummy/tmp/cache/sass/b8feec7b5dd9bdfcb6b02acda27daed749f5790a/_modular-scale.scssc +0 -0
  198. data/test/dummy/tmp/cache/sass/b8feec7b5dd9bdfcb6b02acda27daed749f5790a/_radial-gradient.scssc +0 -0
  199. data/test/dummy/tmp/cache/sass/b8feec7b5dd9bdfcb6b02acda27daed749f5790a/_render-gradients.scssc +0 -0
  200. data/test/dummy/tmp/cache/sass/b8feec7b5dd9bdfcb6b02acda27daed749f5790a/_tint-shade.scssc +0 -0
  201. data/test/ecm_cms_navigation_test.rb +7 -0
  202. data/test/test_helper.rb +15 -0
  203. metadata +520 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = EcmCmsNavigation
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'EcmCmsNavigation'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
28
+ require 'rake/testtask'
29
+
30
+ Rake::TestTask.new(:test) do |t|
31
+ t.libs << 'lib'
32
+ t.libs << 'test'
33
+ t.pattern = 'test/**/*_test.rb'
34
+ t.verbose = false
35
+ end
36
+
37
+
38
+ task :default => :test
@@ -0,0 +1,75 @@
1
+ include CollectiveIdea::Acts::NestedSet::Helper
2
+
3
+ if defined?(ActiveAdmin)
4
+ ActiveAdmin.register Ecm::CmsNavigation::NavigationItem do
5
+ menu :label => Ecm::CmsNavigation::NavigationItem.model_name.human(:count => 10), :parent => I18n.t('ecm.cms.active_admin.menu')
6
+
7
+ member_action :move_up do
8
+ @navigation_item = Ecm::CmsNavigation::NavigationItem.find(params[:id])
9
+
10
+ unless @navigation_item.left_sibling
11
+ redirect_to :back, :notice => I18n.t('awesome_nested_set.illegal_move_up', :resource => @navigation_item.class.model_name.human )
12
+ return
13
+ end
14
+
15
+ @navigation_item.move_left
16
+ redirect_to :back, :notice => I18n.t('awesome_nested_set.moved_up', :resource => @navigation_item.class.model_name.human )
17
+ end
18
+
19
+ member_action :move_down do
20
+ @navigation_item = Ecm::CmsNavigation::NavigationItem.find(params[:id])
21
+
22
+ unless @navigation_item.right_sibling
23
+ redirect_to :back, :notice => I18n.t('awesome_nested_set.illegal_move_down', :resource => @navigation_item.class.model_name.human )
24
+ return
25
+ end
26
+
27
+ @navigation_item.move_right
28
+ redirect_to :back, :notice => I18n.t('awesome_nested_set.moved_down', :resource => @navigation_item.class.model_name.human )
29
+ end
30
+
31
+ form do |f|
32
+ f.inputs do
33
+ f.input :navigation
34
+ f.input :parent, :as => :select, :collection => nested_set_options(Ecm::CmsNavigation::NavigationItem, f.object) { |ni| "#{'&#160;&#160;&#160;&#160;' * ni.level} |--#{ni.name}".html_safe }
35
+ f.input :name
36
+ f.input :url
37
+ f.input :key
38
+ f.input :options
39
+ end
40
+ f.buttons
41
+ end
42
+
43
+ index :title => Ecm::CmsNavigation::NavigationItem.model_name.human(:count => 10) do
44
+ column do |navigation_item|
45
+ link_to('&#9650;'.html_safe, move_up_admin_ecm_cms_navigation_navigation_item_path(navigation_item), :class => "arrow") if navigation_item.left_sibling
46
+ end
47
+ column do |navigation_item|
48
+ link_to('&#9660;'.html_safe, move_down_admin_ecm_cms_navigation_navigation_item_path(navigation_item), :class => "arrow") if navigation_item.right_sibling
49
+ end
50
+ column :navigation do |navigation_item|
51
+ link_to navigation_item.navigation, admin_ecm_cms_navigation_navigation_path(navigation_item.navigation)
52
+ end
53
+ column :indented_name
54
+ column :url
55
+ column :key
56
+ column :options
57
+ default_actions
58
+ end
59
+
60
+ show :title => :name do
61
+ attributes_table do
62
+ row :navigation do |navigation_item|
63
+ link_to navigation_item.navigation, admin_ecm_cms_navigation_navigation_path(navigation_item.navigation)
64
+ end
65
+ row :parent do |navigation_item|
66
+ link_to_if navigation_item.parent, navigation_item.parent, admin_ecm_cms_navigation_navigation_item_path(navigation_item.parent)
67
+ end
68
+ row :name
69
+ row :url
70
+ row :key
71
+ row :options
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,51 @@
1
+ if defined?(ActiveAdmin)
2
+ ActiveAdmin.register Ecm::CmsNavigation::Navigation do
3
+ menu :label => Ecm::CmsNavigation::Navigation.model_name.human(:count => 10), :parent => I18n.t('ecm.cms.active_admin.menu')
4
+
5
+ form do |f|
6
+ f.inputs do
7
+ f.input :locale, :as => :select, :collection => I18n.available_locales.map(&:to_s)
8
+ f.input :name
9
+ end
10
+ f.buttons
11
+ end
12
+
13
+ index :title => Ecm::CmsNavigation::Navigation.model_name.human(:count => 10) do
14
+ column :locale
15
+ column :name
16
+ default_actions
17
+ end
18
+
19
+
20
+ show :title => :name do
21
+ attributes_table do
22
+ row :locale
23
+ row :name
24
+ end
25
+
26
+ panel Ecm::CmsNavigation::NavigationItem.model_name.human(:count => 10) do
27
+ if ecm_cms_navigation_navigation.has_navigation_items?
28
+ table_for ecm_cms_navigation_navigation.navigation_items.order(:lft) do
29
+ column do |navigation_item|
30
+ link_to('&#9650;'.html_safe, move_up_admin_ecm_cms_navigation_navigation_item_path(navigation_item), :class => "arrow") if navigation_item.left_sibling
31
+ end
32
+ column do |navigation_item|
33
+ link_to('&#9660;'.html_safe, move_down_admin_ecm_cms_navigation_navigation_item_path(navigation_item), :class => "arrow") if navigation_item.right_sibling
34
+ end
35
+ column Ecm::CmsNavigation::NavigationItem.human_attribute_name(:indented_name), :indented_name
36
+ column Ecm::CmsNavigation::NavigationItem.human_attribute_name(:url), :url
37
+ column Ecm::CmsNavigation::NavigationItem.human_attribute_name(:key), :key
38
+ column Ecm::CmsNavigation::NavigationItem.human_attribute_name(:options), :options
39
+ column do |navigation_item|
40
+ link_to I18n.t('active_admin.view'), admin_ecm_cms_navigation_navigation_item_path(navigation_item), :class => "member_link view_link"
41
+ end
42
+ end
43
+ else
44
+ div do
45
+ I18n.t('ecm.navigation.no_subitems')
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,3 @@
1
+ a:link.arrow {
2
+ text-decoration: none;
3
+ }
@@ -0,0 +1,37 @@
1
+ module Ecm::CmsNavigationHelper
2
+ def cms_render_navigation(name, options = {})
3
+ navigation = Ecm::CmsNavigation::Navigation.where(:name => name).first
4
+
5
+ return I18n.t('ecm.navigation.navigation_not_found', :name => name) unless navigation
6
+
7
+ options[:items] = []
8
+ navigation.navigation_items.roots.all.each do |navigation_item|
9
+ options[:items] << build_navigation(navigation_item)
10
+ end
11
+
12
+ return I18n.t('ecm.navigation.navigation_empty', :name => name) if options[:items].empty?
13
+
14
+ render_navigation(options)
15
+ end
16
+
17
+ def build_navigation(navigation_item)
18
+ if navigation_item.children.count > 0
19
+ items = []
20
+ navigation_item.children.each do |child|
21
+ items << build_navigation(child)
22
+ end
23
+ output = { :key => navigation_item.key, :name => navigation_item.name, :url => eval(navigation_item.url), :items => items }
24
+ else
25
+ output = { :key => navigation_item.key, :name => navigation_item.name, :url => eval(navigation_item.url) }
26
+ end
27
+
28
+ begin
29
+ options = eval(navigation_item.options)
30
+ output[:options] = options if options.is_a?(Hash)
31
+ rescue
32
+ logger.debug "Invalid navigation item options: #{navigation_item.options}"
33
+ end
34
+
35
+ return output
36
+ end
37
+ end
@@ -0,0 +1,24 @@
1
+ class Ecm::CmsNavigation::Navigation < ActiveRecord::Base
2
+ self.table_name = 'ecm_cms_navigation_navigations'
3
+
4
+ has_many :navigation_items, :dependent => :destroy, :class_name => 'Ecm::CmsNavigation::NavigationItem'
5
+
6
+ validates :name, :presence => true, :uniqueness => { :scope => :locale }, :format => { :with => /[a-z\-]{1,}/i }
7
+ validates :locale, :inclusion => I18n.available_locales.map(&:to_s), :unless => Proc.new { |navigation| navigation.locale.blank? }
8
+
9
+ attr_accessible :locale, :name
10
+
11
+ def to_s
12
+ "#{self.locale}: #{self.name}"
13
+ end
14
+
15
+ before_validation :downcase_name
16
+
17
+ def downcase_name
18
+ self.name.downcase!
19
+ end
20
+
21
+ def has_navigation_items?
22
+ self.navigation_items.count > 0
23
+ end
24
+ end
@@ -0,0 +1,38 @@
1
+ class Ecm::CmsNavigation::NavigationItem < ActiveRecord::Base
2
+ self.table_name = 'ecm_cms_navigation_navigation_items'
3
+
4
+ belongs_to :navigation, :class_name => 'Ecm::CmsNavigation::Navigation'
5
+
6
+ acts_as_nested_set :dependent => :destroy, :counter_cache => :children_count, :scope => :navigation_id
7
+ attr_protected :lft, :rgt
8
+
9
+ validates :name, :presence => true
10
+ validates :url, :presence => true
11
+ validates :key, :presence => true
12
+
13
+ default_scope :order => [:navigation_id, :lft]
14
+
15
+ def to_s
16
+ self.name
17
+ end
18
+
19
+ def indented_name
20
+ "#{'&#160;&#160;&#160;&#160;' * self.level} |--#{self.name}".html_safe
21
+ end
22
+
23
+ before_validation :set_navigation, :if => Proc.new { |navigation_item| navigation_item.child? }
24
+ after_save :update_children_navigations!
25
+
26
+ def set_navigation
27
+ self.navigation = self.parent.navigation
28
+ end
29
+
30
+ def set_navigation!
31
+ self.set_navigation
32
+ self.save!
33
+ end
34
+
35
+ def update_children_navigations!
36
+ self.children.map(&:"set_navigation!")
37
+ end
38
+ end
@@ -0,0 +1,26 @@
1
+ de:
2
+ :false: "nein"
3
+ :true: "ja"
4
+ active_admin:
5
+ move_up: "Up"
6
+ move_down: "Down"
7
+ awesome_nested_set:
8
+ moved_up: "%{resource} nach oben verschoben"
9
+ moved_down: "%{resource} nach unten verschoben"
10
+ illegal_move_up: "Konnte %{resource} nicht nach oben verschieben"
11
+ illegal_move_down: "Konnte %{resource} nicht nach unten verschieben"
12
+ ecm:
13
+ cms:
14
+ active_admin:
15
+ menu: "CMS"
16
+ navigation:
17
+ navigation_empty: "Navigation \"%{name}\" ist leer."
18
+ no_subitems: "Keine Unterpunkte vorhanden"
19
+ navigation_not_found: "Navigation \"%{name}\" nicht gefunden."
20
+ formtastic:
21
+ :yes: 'Ja'
22
+ :no: 'Nein'
23
+ :create: '%{model} erstellen'
24
+ :update: '%{model} aktualisieren'
25
+ :submit: '%{model} speichern'
26
+ :required: 'benötigt'
@@ -0,0 +1,26 @@
1
+ en:
2
+ :false: "no"
3
+ :true: "yes"
4
+ active_admin:
5
+ move_up: "Up"
6
+ move_down: "Down"
7
+ awesome_nested_set:
8
+ moved_up: "Moved %{resource} up"
9
+ moved_down: "Moved %{resource} down"
10
+ illegal_move_up: "Could not move %{resource} up"
11
+ illegal_move_down: "Could not move %{resource} down"
12
+ ecm:
13
+ cms:
14
+ active_admin:
15
+ menu: "cms"
16
+ navigation:
17
+ navigation_empty: "Navigation \"%{name}\" is empty."
18
+ no_subitems: "No subitems found"
19
+ navigation_not_found: "Navigation \"%{name}\" not found."
20
+ formtastic:
21
+ :yes: 'Yes'
22
+ :no: 'No'
23
+ :create: 'Create %{model}'
24
+ :update: 'Update %{model}'
25
+ :submit: 'Save %{model}'
26
+ :required: 'required'
@@ -0,0 +1,14 @@
1
+ de:
2
+ activerecord:
3
+ attributes:
4
+ ecm/cms_navigation/navigation:
5
+ created_at: "Erstellt"
6
+ expand: "Ausklappen"
7
+ level: "Level"
8
+ locale: "Sprache"
9
+ name: "Name"
10
+ updated_at: "Aktualisiert"
11
+ models:
12
+ ecm/cms_navigation/navigation:
13
+ one: "Navigation"
14
+ other: "Navigationen"
@@ -0,0 +1,14 @@
1
+ en:
2
+ activerecord:
3
+ attributes:
4
+ ecm/cms_navigation/navigation:
5
+ created_at: "created at"
6
+ expand: "epand"
7
+ level: "level"
8
+ locale: "language"
9
+ name: "name"
10
+ updated_at: "updated at"
11
+ models:
12
+ ecm/cms_navigation/navigation:
13
+ one: "navigation"
14
+ other: "navigations"
@@ -0,0 +1,16 @@
1
+ de:
2
+ activerecord:
3
+ attributes:
4
+ ecm/cms_navigation/navigation_item:
5
+ created_at: "Erstellt"
6
+ indented_name: "Name"
7
+ key: "Schlüssel"
8
+ name: "Name"
9
+ options: "Optionen"
10
+ parent: "Unterpunkt von"
11
+ updated_at: "Aktualisiert"
12
+ url: "Zieladresse"
13
+ models:
14
+ ecm/cms_navigation/navigation_item:
15
+ one: "Navigationspunkt"
16
+ other: "Navigationspunkte"
@@ -0,0 +1,16 @@
1
+ en:
2
+ activerecord:
3
+ attributes:
4
+ ecm/cms_navigation/navigation_item:
5
+ created_at: "created at"
6
+ indented_name: "name"
7
+ key: "key"
8
+ name: "name"
9
+ options: "options"
10
+ parent: "parent"
11
+ updated_at: "updated at"
12
+ url: "url"
13
+ models:
14
+ ecm/cms_navigation/navigation_item:
15
+ one: "navigation item"
16
+ other: "navigation items"
@@ -0,0 +1,10 @@
1
+ class CreateEcmCmsNavigationNavigations < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_cms_navigation_navigations do |t|
4
+ t.string :locale
5
+ t.string :name
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ class CreateEcmCmsNavigationNavigationItems < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_cms_navigation_navigation_items do |t|
4
+ t.string :key
5
+ t.string :name
6
+ t.string :url
7
+ t.string :options
8
+ t.references :navigation
9
+ t.integer :parent_id
10
+ t.integer :lft
11
+ t.integer :rgt
12
+ t.integer :children_count
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end