releaf 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (323) hide show
  1. data/LICENSE +24 -0
  2. data/README.md +74 -0
  3. data/Rakefile +62 -0
  4. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  5. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_flat_75_ffffff_40x100.png +0 -0
  6. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  7. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_glass_65_ffffff_1x400.png +0 -0
  8. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_glass_75_dadada_1x400.png +0 -0
  9. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  10. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  11. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  12. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-icons_222222_256x240.png +0 -0
  13. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-icons_2e83ff_256x240.png +0 -0
  14. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-icons_454545_256x240.png +0 -0
  15. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-icons_888888_256x240.png +0 -0
  16. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-icons_cd0a0a_256x240.png +0 -0
  17. data/app/assets/images/releaf/3rd_party/lightbox/close.png +0 -0
  18. data/app/assets/images/releaf/3rd_party/lightbox/loading.gif +0 -0
  19. data/app/assets/images/releaf/3rd_party/lightbox/next.png +0 -0
  20. data/app/assets/images/releaf/3rd_party/lightbox/prev.png +0 -0
  21. data/app/assets/images/releaf/add.png +0 -0
  22. data/app/assets/images/releaf/background.jpg +0 -0
  23. data/app/assets/images/releaf/button/button_bgr.gif +0 -0
  24. data/app/assets/images/releaf/button/button_hover_bgr.png +0 -0
  25. data/app/assets/images/releaf/controllers/content/close.gif +0 -0
  26. data/app/assets/images/releaf/controllers/content/close_active.gif +0 -0
  27. data/app/assets/images/releaf/controllers/content/close_hover.gif +0 -0
  28. data/app/assets/images/releaf/controllers/content/global_fields_bgr.png +0 -0
  29. data/app/assets/images/releaf/controllers/content/open.gif +0 -0
  30. data/app/assets/images/releaf/controllers/content/open_2.gif +0 -0
  31. data/app/assets/images/releaf/controllers/content/open_active.gif +0 -0
  32. data/app/assets/images/releaf/controllers/content/open_hover.gif +0 -0
  33. data/app/assets/images/releaf/controllers/sessions/background.jpg +0 -0
  34. data/app/assets/images/releaf/controllers/sessions/logo.jpg +0 -0
  35. data/app/assets/images/releaf/expand_tool/close.png +0 -0
  36. data/app/assets/images/releaf/expand_tool/close_hover.png +0 -0
  37. data/app/assets/images/releaf/expand_tool/close_hover_shim.png +0 -0
  38. data/app/assets/images/releaf/expand_tool/close_shim.png +0 -0
  39. data/app/assets/images/releaf/expand_tool/loader.gif +0 -0
  40. data/app/assets/images/releaf/expand_tool/open.png +0 -0
  41. data/app/assets/images/releaf/expand_tool/open_hover.png +0 -0
  42. data/app/assets/images/releaf/expand_tool/open_hover_shim.png +0 -0
  43. data/app/assets/images/releaf/expand_tool/open_shim.png +0 -0
  44. data/app/assets/images/releaf/favicon.ico +0 -0
  45. data/app/assets/images/releaf/globalFieldContainerBgr.png +0 -0
  46. data/app/assets/images/releaf/icons/129.png +0 -0
  47. data/app/assets/images/releaf/icons/130.png +0 -0
  48. data/app/assets/images/releaf/icons/accept.png +0 -0
  49. data/app/assets/images/releaf/icons/add.png +0 -0
  50. data/app/assets/images/releaf/icons/arrow_down.png +0 -0
  51. data/app/assets/images/releaf/icons/arrow_left.png +0 -0
  52. data/app/assets/images/releaf/icons/arrow_refresh.png +0 -0
  53. data/app/assets/images/releaf/icons/arrow_up.png +0 -0
  54. data/app/assets/images/releaf/icons/bin_empty.png +0 -0
  55. data/app/assets/images/releaf/icons/bullet_black.png +0 -0
  56. data/app/assets/images/releaf/icons/bullet_connect.png +0 -0
  57. data/app/assets/images/releaf/icons/bullet_start.png +0 -0
  58. data/app/assets/images/releaf/icons/bullet_tick.png +0 -0
  59. data/app/assets/images/releaf/icons/chrome.png +0 -0
  60. data/app/assets/images/releaf/icons/control_play.png +0 -0
  61. data/app/assets/images/releaf/icons/date.png +0 -0
  62. data/app/assets/images/releaf/icons/delete.png +0 -0
  63. data/app/assets/images/releaf/icons/disk.png +0 -0
  64. data/app/assets/images/releaf/icons/drag-handle.png +0 -0
  65. data/app/assets/images/releaf/icons/error.png +0 -0
  66. data/app/assets/images/releaf/icons/eye.png +0 -0
  67. data/app/assets/images/releaf/icons/firefox.png +0 -0
  68. data/app/assets/images/releaf/icons/google-not-available.gif +0 -0
  69. data/app/assets/images/releaf/icons/google.gif +0 -0
  70. data/app/assets/images/releaf/icons/keyboard.png +0 -0
  71. data/app/assets/images/releaf/icons/left_16.png +0 -0
  72. data/app/assets/images/releaf/icons/link.png +0 -0
  73. data/app/assets/images/releaf/icons/magnifier.png +0 -0
  74. data/app/assets/images/releaf/icons/notAllowed.png +0 -0
  75. data/app/assets/images/releaf/icons/page_white_add.png +0 -0
  76. data/app/assets/images/releaf/icons/page_white_edit.png +0 -0
  77. data/app/assets/images/releaf/icons/page_white_put.png +0 -0
  78. data/app/assets/images/releaf/icons/page_white_text.png +0 -0
  79. data/app/assets/images/releaf/icons/pencil.png +0 -0
  80. data/app/assets/images/releaf/icons/picture.png +0 -0
  81. data/app/assets/images/releaf/icons/right_16.png +0 -0
  82. data/app/assets/images/releaf/icons/tick.png +0 -0
  83. data/app/assets/images/releaf/icons/warning.png +0 -0
  84. data/app/assets/images/releaf/icons/world_go.png +0 -0
  85. data/app/assets/images/releaf/icons/world_link.png +0 -0
  86. data/app/assets/images/releaf/input/autocompleteExpandIcon.png +0 -0
  87. data/app/assets/images/releaf/input/input_bgr.gif +0 -0
  88. data/app/assets/images/releaf/language_root.png +0 -0
  89. data/app/assets/images/releaf/loader.gif +0 -0
  90. data/app/assets/images/releaf/logout.png +0 -0
  91. data/app/assets/images/releaf/main_menu/active_bgr.png +0 -0
  92. data/app/assets/images/releaf/main_menu/bgr.png +0 -0
  93. data/app/assets/images/releaf/main_menu/hover_bgr.png +0 -0
  94. data/app/assets/images/releaf/module.png +0 -0
  95. data/app/assets/images/releaf/panel_layout/active_bgr.png +0 -0
  96. data/app/assets/images/releaf/panel_layout/secondary_panel_horizontal_bgr.png +0 -0
  97. data/app/assets/images/releaf/panel_layout/secondary_panel_vertical_bgr.png +0 -0
  98. data/app/assets/images/releaf/releaf_table/selected_bgr.png +0 -0
  99. data/app/assets/images/releaf/releaf_table/th_bgr.gif +0 -0
  100. data/app/assets/javascripts/releaf/3rd_party/jquery-cookie/README.md +73 -0
  101. data/app/assets/javascripts/releaf/3rd_party/jquery-cookie/jquery.cookie.js +47 -0
  102. data/app/assets/javascripts/releaf/3rd_party/jquery-cookie/server.js +24 -0
  103. data/app/assets/javascripts/releaf/3rd_party/jquery-cookie/test.html +19 -0
  104. data/app/assets/javascripts/releaf/3rd_party/jquery-cookie/test.js +80 -0
  105. data/app/assets/javascripts/releaf/3rd_party/jquery-ui-timepicker-addon.js +1882 -0
  106. data/app/assets/javascripts/releaf/3rd_party/lightbox.js.erb +379 -0
  107. data/app/assets/javascripts/releaf/application.js +14 -0
  108. data/app/assets/javascripts/releaf/controllers/base.js +170 -0
  109. data/app/assets/javascripts/releaf/controllers/releaf/content.js +90 -0
  110. data/app/assets/javascripts/releaf/controllers/releaf/translations.js +31 -0
  111. data/app/assets/javascripts/releaf/include/continuous_scroll.js +321 -0
  112. data/app/assets/javascripts/releaf/include/field.type_autocomplete.js +58 -0
  113. data/app/assets/javascripts/releaf/include/field.type_richtext.js +90 -0
  114. data/app/assets/javascripts/releaf/include/localization.js +12 -0
  115. data/app/assets/javascripts/releaf/include/nested_fields.js +71 -0
  116. data/app/assets/javascripts/releaf/include/sortable.js +27 -0
  117. data/app/assets/javascripts/releaf/lib/request_url.js +183 -0
  118. data/app/assets/stylesheets/releaf/3rd_party/jquery-ui-1.9.2.custom.css.erb +464 -0
  119. data/app/assets/stylesheets/releaf/3rd_party/jquery-ui-timepicker-addon.css +10 -0
  120. data/app/assets/stylesheets/releaf/3rd_party/lightbox.css.erb +157 -0
  121. data/app/assets/stylesheets/releaf/application.css.erb +122 -0
  122. data/app/assets/stylesheets/releaf/controllers/base.css.erb +205 -0
  123. data/app/assets/stylesheets/releaf/controllers/releaf/content.css.erb +416 -0
  124. data/app/assets/stylesheets/releaf/controllers/releaf/sessions.css.scss.erb +116 -0
  125. data/app/assets/stylesheets/releaf/controllers/releaf/translations.css.erb +205 -0
  126. data/app/assets/stylesheets/releaf/include/button.css.erb +176 -0
  127. data/app/assets/stylesheets/releaf/include/field.css.erb +257 -0
  128. data/app/assets/stylesheets/releaf/include/input.css.erb +40 -0
  129. data/app/assets/stylesheets/releaf/include/main_menu.css.erb +66 -0
  130. data/app/assets/stylesheets/releaf/include/pagination.css.erb +29 -0
  131. data/app/assets/stylesheets/releaf/include/panel_layout.css.erb +251 -0
  132. data/app/assets/stylesheets/releaf/include/releaf_table.css.erb +112 -0
  133. data/app/assets/stylesheets/releaf/include/sortable.css.erb +12 -0
  134. data/app/controllers/releaf/admins_controller.rb +48 -0
  135. data/app/controllers/releaf/application_controller.rb +11 -0
  136. data/app/controllers/releaf/base_application_controller.rb +15 -0
  137. data/app/controllers/releaf/base_controller.rb +310 -0
  138. data/app/controllers/releaf/content_controller.rb +166 -0
  139. data/app/controllers/releaf/roles_controller.rb +36 -0
  140. data/app/controllers/releaf/sessions_controller.rb +5 -0
  141. data/app/controllers/releaf/tinymce_assets_controller.rb +26 -0
  142. data/app/controllers/releaf/translations_controller.rb +121 -0
  143. data/app/helpers/releaf/admin_helper.rb +79 -0
  144. data/app/helpers/releaf/application_helper.rb +4 -0
  145. data/app/helpers/releaf/pagination_renderer.rb +44 -0
  146. data/app/helpers/releaf/releaf_devise_helper.rb +8 -0
  147. data/app/models/releaf/admin.rb +51 -0
  148. data/app/models/releaf/node.rb +221 -0
  149. data/app/models/releaf/node_base.rb +25 -0
  150. data/app/models/releaf/role.rb +119 -0
  151. data/app/models/releaf/tinymce_asset.rb +6 -0
  152. data/app/views/layouts/releaf/admin.html.haml +51 -0
  153. data/app/views/releaf/aliases/_edit.body.haml +50 -0
  154. data/app/views/releaf/aliases/_edit.header.haml +19 -0
  155. data/app/views/releaf/aliases/_index.row.haml +5 -0
  156. data/app/views/releaf/aliases/_secondary_panel.haml +13 -0
  157. data/app/views/releaf/base/_edit.body.haml +19 -0
  158. data/app/views/releaf/base/_edit.field.haml +96 -0
  159. data/app/views/releaf/base/_edit.field.type_autocomplete.haml +15 -0
  160. data/app/views/releaf/base/_edit.field.type_checkbox.haml +5 -0
  161. data/app/views/releaf/base/_edit.field.type_date.haml +8 -0
  162. data/app/views/releaf/base/_edit.field.type_datetime.haml +8 -0
  163. data/app/views/releaf/base/_edit.field.type_delete_nested.haml +3 -0
  164. data/app/views/releaf/base/_edit.field.type_file.haml +10 -0
  165. data/app/views/releaf/base/_edit.field.type_image.haml +14 -0
  166. data/app/views/releaf/base/_edit.field.type_link.haml +4 -0
  167. data/app/views/releaf/base/_edit.field.type_password.haml +4 -0
  168. data/app/views/releaf/base/_edit.field.type_richtext.haml +4 -0
  169. data/app/views/releaf/base/_edit.field.type_richtext_i18n.haml +27 -0
  170. data/app/views/releaf/base/_edit.field.type_select.haml +11 -0
  171. data/app/views/releaf/base/_edit.field.type_text.haml +4 -0
  172. data/app/views/releaf/base/_edit.field.type_text_i18n.haml +27 -0
  173. data/app/views/releaf/base/_edit.field.type_textarea.haml +4 -0
  174. data/app/views/releaf/base/_edit.field.type_textarea_i18n.haml +27 -0
  175. data/app/views/releaf/base/_edit.field.type_time.haml +8 -0
  176. data/app/views/releaf/base/_edit.footer.haml +14 -0
  177. data/app/views/releaf/base/_edit.form.haml +4 -0
  178. data/app/views/releaf/base/_edit.has_many_associations.haml +45 -0
  179. data/app/views/releaf/base/_edit.header.haml +3 -0
  180. data/app/views/releaf/base/_index.body.haml +6 -0
  181. data/app/views/releaf/base/_index.cell.haml +19 -0
  182. data/app/views/releaf/base/_index.footer.haml +22 -0
  183. data/app/views/releaf/base/_index.header.haml +4 -0
  184. data/app/views/releaf/base/_index.row.haml +6 -0
  185. data/app/views/releaf/base/_index.search.haml +5 -0
  186. data/app/views/releaf/base/_index.table.haml +8 -0
  187. data/app/views/releaf/base/_secondary_panel.haml +9 -0
  188. data/app/views/releaf/base/_show.body.haml +7 -0
  189. data/app/views/releaf/base/_show.field.haml +78 -0
  190. data/app/views/releaf/base/_show.field.type_html.haml +1 -0
  191. data/app/views/releaf/base/_show.footer.haml +16 -0
  192. data/app/views/releaf/base/_show.header.haml +3 -0
  193. data/app/views/releaf/base/confirm_destroy.haml +10 -0
  194. data/app/views/releaf/base/edit.haml +1 -0
  195. data/app/views/releaf/base/index.haml +3 -0
  196. data/app/views/releaf/base/new.haml +1 -0
  197. data/app/views/releaf/base/show.haml +3 -0
  198. data/app/views/releaf/content/_edit.body.haml +45 -0
  199. data/app/views/releaf/content/_edit.content_fields.haml +19 -0
  200. data/app/views/releaf/content/_edit.slug.haml +12 -0
  201. data/app/views/releaf/content/_get_content_form.haml +7 -0
  202. data/app/views/releaf/content/_secondary_panel.haml +3 -0
  203. data/app/views/releaf/content/_show.field.content.haml +11 -0
  204. data/app/views/releaf/content/_tree_level.haml +16 -0
  205. data/app/views/releaf/content/ajax.new.haml +3 -0
  206. data/app/views/releaf/content/index.haml +0 -0
  207. data/app/views/releaf/roles/_edit.field.admins.haml +0 -0
  208. data/app/views/releaf/roles/_edit.field.permissions.haml +5 -0
  209. data/app/views/releaf/roles/_show.field.default.haml +6 -0
  210. data/app/views/releaf/roles/_show.field.permissions.haml +11 -0
  211. data/app/views/releaf/sessions/new.html.haml +17 -0
  212. data/app/views/releaf/translations/_edit.body.haml +50 -0
  213. data/app/views/releaf/translations/_edit.header.haml +19 -0
  214. data/app/views/releaf/translations/_index.row.haml +5 -0
  215. data/app/views/releaf/translations/_secondary_panel.haml +13 -0
  216. data/bin/releaf +25 -0
  217. data/lib/generators/releaf/install_generator.rb +87 -0
  218. data/lib/generators/releaf/templates/config/common_fields.yml.example +17 -0
  219. data/lib/generators/releaf/templates/controllers/home_controller.rb +4 -0
  220. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  221. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_flat_75_ffffff_40x100.png +0 -0
  222. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  223. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_glass_65_ffffff_1x400.png +0 -0
  224. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_glass_75_dadada_1x400.png +0 -0
  225. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  226. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  227. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  228. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-icons_222222_256x240.png +0 -0
  229. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-icons_2e83ff_256x240.png +0 -0
  230. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-icons_454545_256x240.png +0 -0
  231. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-icons_888888_256x240.png +0 -0
  232. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-icons_cd0a0a_256x240.png +0 -0
  233. data/lib/generators/releaf/templates/images/3rd_party/lightbox/close.png +0 -0
  234. data/lib/generators/releaf/templates/images/3rd_party/lightbox/loading.gif +0 -0
  235. data/lib/generators/releaf/templates/images/3rd_party/lightbox/next.png +0 -0
  236. data/lib/generators/releaf/templates/images/3rd_party/lightbox/prev.png +0 -0
  237. data/lib/generators/releaf/templates/initializers/releaf.rb +59 -0
  238. data/lib/generators/releaf/templates/initializers/releaf_i18n.rb +8 -0
  239. data/lib/generators/releaf/templates/initializers/releaf_store_current_template.rb +25 -0
  240. data/lib/generators/releaf/templates/javascripts/3rd_party/jquery_ui.js +14850 -0
  241. data/lib/generators/releaf/templates/javascripts/3rd_party/lightbox.js.erb +379 -0
  242. data/lib/generators/releaf/templates/javascripts/application.js +15 -0
  243. data/lib/generators/releaf/templates/javascripts/lib/js_check.js +8 -0
  244. data/lib/generators/releaf/templates/javascripts/lib/request_url.js +169 -0
  245. data/lib/generators/releaf/templates/javascripts/lib/sortable.js +29 -0
  246. data/lib/generators/releaf/templates/migrations/create_releaf_admins.rb +53 -0
  247. data/lib/generators/releaf/templates/migrations/create_releaf_nodes.rb +25 -0
  248. data/lib/generators/releaf/templates/migrations/create_releaf_roles.rb +11 -0
  249. data/lib/generators/releaf/templates/migrations/create_releaf_tinymce_assets.rb +10 -0
  250. data/lib/generators/releaf/templates/migrations/create_releaf_translations.rb +31 -0
  251. data/lib/generators/releaf/templates/models/admin_ability.rb +51 -0
  252. data/lib/generators/releaf/templates/seeds.rb +64 -0
  253. data/lib/generators/releaf/templates/stylesheets/3rd_party/jquery_ui/smoothness.css.erb +1174 -0
  254. data/lib/generators/releaf/templates/stylesheets/3rd_party/lightbox.css.erb +157 -0
  255. data/lib/generators/releaf/templates/stylesheets/3rd_party/reset.css +48 -0
  256. data/lib/generators/releaf/templates/stylesheets/application.scss +15 -0
  257. data/lib/generators/releaf/templates/stylesheets/style.scss +45 -0
  258. data/lib/generators/releaf/templates/views/home/index.html.haml +1 -0
  259. data/lib/generators/releaf/templates/views/layouts/application.html.haml +26 -0
  260. data/lib/i18n/backend/releaf.rb +96 -0
  261. data/lib/i18n/backend/releaf/translation.rb +56 -0
  262. data/lib/i18n/backend/releaf/translation_data.rb +32 -0
  263. data/lib/i18n/backend/releaf/translation_group.rb +30 -0
  264. data/lib/i18n/releaf.rb +1 -0
  265. data/lib/releaf.rb +30 -0
  266. data/lib/releaf/engine.rb +4 -0
  267. data/lib/releaf/slug.rb +79 -0
  268. data/lib/releaf/version.rb +3 -0
  269. data/lib/tasks/releaf_tasks.rake +4 -0
  270. data/spec/dummy/README.rdoc +261 -0
  271. data/spec/dummy/Rakefile +7 -0
  272. data/spec/dummy/app/assets/images/rails.png +0 -0
  273. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  274. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  275. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  276. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  277. data/spec/dummy/app/models/admin_ability.rb +51 -0
  278. data/spec/dummy/app/models/settings.rb +2 -0
  279. data/spec/dummy/app/views/layouts/application.html.haml +10 -0
  280. data/spec/dummy/config.ru +4 -0
  281. data/spec/dummy/config/application.rb +68 -0
  282. data/spec/dummy/config/boot.rb +6 -0
  283. data/spec/dummy/config/common_fields.yml.example +17 -0
  284. data/spec/dummy/config/database.yml +42 -0
  285. data/spec/dummy/config/environment.rb +5 -0
  286. data/spec/dummy/config/environments/development.rb +37 -0
  287. data/spec/dummy/config/environments/production.rb +67 -0
  288. data/spec/dummy/config/environments/test.rb +37 -0
  289. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  290. data/spec/dummy/config/initializers/devise.rb +232 -0
  291. data/spec/dummy/config/initializers/dragonfly.rb +1 -0
  292. data/spec/dummy/config/initializers/inflections.rb +15 -0
  293. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  294. data/spec/dummy/config/initializers/releaf.rb +59 -0
  295. data/spec/dummy/config/initializers/releaf_i18n.rb +8 -0
  296. data/spec/dummy/config/initializers/releaf_store_current_template.rb +25 -0
  297. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  298. data/spec/dummy/config/initializers/session_store.rb +8 -0
  299. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  300. data/spec/dummy/config/locales/devise.en.yml +58 -0
  301. data/spec/dummy/config/locales/en.yml +5 -0
  302. data/spec/dummy/config/routes.rb +11 -0
  303. data/spec/dummy/db/migrate/20130204164516_create_settings.rb +17 -0
  304. data/spec/dummy/db/migrate/20130204164523_create_releaf_nodes.rb +25 -0
  305. data/spec/dummy/db/migrate/20130204164524_create_releaf_roles.rb +11 -0
  306. data/spec/dummy/db/migrate/20130204164525_create_releaf_translations.rb +31 -0
  307. data/spec/dummy/db/migrate/20130204164526_create_releaf_admins.rb +53 -0
  308. data/spec/dummy/db/schema.rb +112 -0
  309. data/spec/dummy/db/seeds.rb +64 -0
  310. data/spec/dummy/doc/README_FOR_APP +2 -0
  311. data/spec/dummy/log/development.log +74 -0
  312. data/spec/dummy/log/test.log +129 -0
  313. data/spec/dummy/public/404.html +26 -0
  314. data/spec/dummy/public/422.html +26 -0
  315. data/spec/dummy/public/500.html +25 -0
  316. data/spec/dummy/public/favicon.ico +0 -0
  317. data/spec/dummy/script/rails +6 -0
  318. data/spec/dummy/tmp/cache/9C5/660/settings%3Ai18n_updated_at +1 -0
  319. data/spec/factories/factories.rb +24 -0
  320. data/spec/features/admin_spec.rb +41 -0
  321. data/spec/spec_helper.rb +23 -0
  322. data/templates/releaf/installer.rb +196 -0
  323. metadata +777 -0
@@ -0,0 +1,32 @@
1
+ require 'active_record'
2
+
3
+ module I18n
4
+ module Backend
5
+ class Releaf
6
+ class TranslationData < ::ActiveRecord::Base
7
+
8
+ self.table_name = "releaf_translation_data"
9
+
10
+ validates_presence_of :translation_id, :lang
11
+ validates_uniqueness_of :translation_id, :scope => :lang
12
+ belongs_to :translation
13
+
14
+ scope :available_locales, where('lang IS NOT NULL').group(:lang).pluck(:lang)
15
+ after_commit :reload_cache
16
+
17
+ def text
18
+ self[:localization].blank? == false ? self[:localization] : self.translation.try(:key).try(:humanize)
19
+ end
20
+
21
+ private
22
+
23
+ def reload_cache
24
+ Settings.i18n_updated_at = Time.now
25
+ I18n.backend.reload_cache
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
32
+
@@ -0,0 +1,30 @@
1
+ require 'active_record'
2
+
3
+ module I18n
4
+ module Backend
5
+ class Releaf
6
+ class TranslationGroup < ::ActiveRecord::Base
7
+
8
+ self.table_name = "releaf_translation_groups"
9
+
10
+ validates_presence_of :scope
11
+
12
+ has_many :translations, :dependent => :destroy, :foreign_key => :group_id, :order => 'releaf_translations.key'
13
+ after_commit :reload_cache
14
+
15
+ def to_s
16
+ scope
17
+ end
18
+
19
+ private
20
+
21
+ def reload_cache
22
+ Settings.i18n_updated_at = Time.now
23
+ I18n.backend.reload_cache
24
+ end
25
+
26
+ end
27
+ end
28
+ end
29
+ end
30
+
@@ -0,0 +1 @@
1
+ require 'i18n'
@@ -0,0 +1,30 @@
1
+ require "releaf/slug"
2
+ require "releaf/engine"
3
+
4
+ module Releaf
5
+ mattr_accessor :main_menu
6
+ @@main_menu = [
7
+ 'releaf/content',
8
+ '*permissions',
9
+ 'releaf/translations'
10
+ ]
11
+
12
+ mattr_accessor :base_menu
13
+ @@base_menu = {
14
+ '*permissions' => [
15
+ ['permissions', %w[releaf/admins releaf/roles]],
16
+ ]
17
+ }
18
+
19
+ mattr_accessor :devise_for
20
+ @@devise_for = 'releaf/admin'
21
+
22
+ mattr_accessor :layout
23
+ @@layout = "releaf/admin"
24
+
25
+ class << self
26
+ def setup
27
+ yield self
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,4 @@
1
+ module Releaf
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,79 @@
1
+ module Releaf
2
+ module Slug
3
+ def self.included(base)
4
+ base.class_eval {
5
+
6
+ def self.find_object id_or_slug, scope=nil
7
+ raise ArgumentError unless id_or_slug.is_a?(String) or id_or_slug.is_a?(Fixnum)
8
+
9
+ unless self.column_names.include?('slug')
10
+ if scope.blank?
11
+ return self.find(id_or_slug)
12
+ else
13
+ return self.send(scope).find(id_or_slug)
14
+ end
15
+ end
16
+
17
+ obj = nil
18
+
19
+ # if it looks like id, search by id
20
+ if id_or_slug.to_s =~ /\A\d+\z/
21
+ if scope.blank?
22
+ obj = self.find_by_id(id_or_slug)
23
+ else
24
+ obj = self.send(scope).find_by_id(id_or_slug)
25
+ end
26
+ end
27
+
28
+ unless obj
29
+ unless self.column_names.include?('ancestry')
30
+ if scope.blank?
31
+ obj = self.find_by_slug(id_or_slug)
32
+ else
33
+ obj = self.send(scope).find_by_slug(id_or_slug)
34
+ end
35
+ else
36
+ slugs = id_or_slug.split('/')
37
+ if scope.blank?
38
+ obj = self.find_by_slug( slugs.shift )
39
+ else
40
+ obj = self.send(scope).find_by_slug( slugs.shift )
41
+ end
42
+ raise ActiveRecord::RecordNotFound unless obj
43
+ slugs.each do |slug_part|
44
+ if scope.blank?
45
+ obj = obj.children.find_by_slug(slug_part)
46
+ else
47
+ obj = obj.children.send(scope).find_by_slug(slug_part)
48
+ end
49
+ raise ActiveRecord::RecordNotFound unless obj
50
+ end
51
+ end
52
+ end
53
+
54
+ raise ActiveRecord::RecordNotFound unless obj
55
+ return obj
56
+ end
57
+
58
+ def to_param
59
+ return id unless self.class.column_names.include?('slug')
60
+ return id if self.slug.blank?
61
+ col_names = self.class.column_names
62
+
63
+ if col_names.include?('ancestry')
64
+ return path.pluck(:slug).join('/')
65
+ elsif col_names.include?('lft') && col_names.include?('rgt') && col_names.include?('parent_id') && self.class.respond_to?(:in_list?)
66
+ unless parent_id.blank?
67
+ return parent.to_param + '/' + slug
68
+ else
69
+ return slug
70
+ end
71
+ else
72
+ return slug
73
+ end
74
+ end
75
+ }
76
+
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,3 @@
1
+ module Releaf
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :releaf do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,261 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.all
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.org/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- assets
160
+ | |-- images
161
+ | |-- javascripts
162
+ | `-- stylesheets
163
+ | |-- controllers
164
+ | |-- helpers
165
+ | |-- mailers
166
+ | |-- models
167
+ | `-- views
168
+ | `-- layouts
169
+ |-- config
170
+ | |-- environments
171
+ | |-- initializers
172
+ | `-- locales
173
+ |-- db
174
+ |-- doc
175
+ |-- lib
176
+ | `-- tasks
177
+ |-- log
178
+ |-- public
179
+ |-- script
180
+ |-- test
181
+ | |-- fixtures
182
+ | |-- functional
183
+ | |-- integration
184
+ | |-- performance
185
+ | `-- unit
186
+ |-- tmp
187
+ | |-- cache
188
+ | |-- pids
189
+ | |-- sessions
190
+ | `-- sockets
191
+ `-- vendor
192
+ |-- assets
193
+ `-- stylesheets
194
+ `-- plugins
195
+
196
+ app
197
+ Holds all the code that's specific to this particular application.
198
+
199
+ app/assets
200
+ Contains subdirectories for images, stylesheets, and JavaScript files.
201
+
202
+ app/controllers
203
+ Holds controllers that should be named like weblogs_controller.rb for
204
+ automated URL mapping. All controllers should descend from
205
+ ApplicationController which itself descends from ActionController::Base.
206
+
207
+ app/models
208
+ Holds models that should be named like post.rb. Models descend from
209
+ ActiveRecord::Base by default.
210
+
211
+ app/views
212
+ Holds the template files for the view that should be named like
213
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
214
+ eRuby syntax by default.
215
+
216
+ app/views/layouts
217
+ Holds the template files for layouts to be used with views. This models the
218
+ common header/footer method of wrapping views. In your views, define a layout
219
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
220
+ Inside default.html.erb, call <% yield %> to render the view using this
221
+ layout.
222
+
223
+ app/helpers
224
+ Holds view helpers that should be named like weblogs_helper.rb. These are
225
+ generated for you automatically when using generators for controllers.
226
+ Helpers can be used to wrap functionality for your views into methods.
227
+
228
+ config
229
+ Configuration files for the Rails environment, the routing map, the database,
230
+ and other dependencies.
231
+
232
+ db
233
+ Contains the database schema in schema.rb. db/migrate contains all the
234
+ sequence of Migrations for your schema.
235
+
236
+ doc
237
+ This directory is where your application documentation will be stored when
238
+ generated using <tt>rake doc:app</tt>
239
+
240
+ lib
241
+ Application specific libraries. Basically, any kind of custom code that
242
+ doesn't belong under controllers, models, or helpers. This directory is in
243
+ the load path.
244
+
245
+ public
246
+ The directory available for the web server. Also contains the dispatchers and the
247
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
+ server.
249
+
250
+ script
251
+ Helper scripts for automation and generation.
252
+
253
+ test
254
+ Unit and functional tests along with fixtures. When using the rails generate
255
+ command, template test files will be generated for you and placed in this
256
+ directory.
257
+
258
+ vendor
259
+ External libraries that the application depends on. Also includes the plugins
260
+ subdirectory. If the app has frozen rails, those gems also go here, under
261
+ vendor/rails/. This directory is in the load path.