noodall-ui 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (542) hide show
  1. data/.document +5 -0
  2. data/.gitignore +29 -0
  3. data/Gemfile +29 -0
  4. data/Gemfile.lock +205 -0
  5. data/LICENSE +20 -0
  6. data/README.rdoc +17 -0
  7. data/Rakefile +17 -0
  8. data/app/controllers/noodall/admin/assets_controller.rb +241 -0
  9. data/app/controllers/noodall/admin/base_controller.rb +8 -0
  10. data/app/controllers/noodall/admin/components_controller.rb +22 -0
  11. data/app/controllers/noodall/admin/groups_controller.rb +11 -0
  12. data/app/controllers/noodall/admin/nodes_controller.rb +159 -0
  13. data/app/controllers/noodall/nodes_controller.rb +41 -0
  14. data/app/helpers/noodall/admin/assets_helper.rb +15 -0
  15. data/app/helpers/noodall/admin/base_helper.rb +14 -0
  16. data/app/helpers/noodall/admin/nodes_helper.rb +37 -0
  17. data/app/helpers/noodall/components_helper.rb +38 -0
  18. data/app/helpers/noodall/layout_helper.rb +25 -0
  19. data/app/helpers/noodall/nodes_helper.rb +72 -0
  20. data/app/models/asset.rb +103 -0
  21. data/app/views/layouts/noodall_admin.html.erb +66 -0
  22. data/app/views/noodall/admin/assets/_browser.html.erb +28 -0
  23. data/app/views/noodall/admin/assets/_form.html.erb +54 -0
  24. data/app/views/noodall/admin/assets/_menu.html.erb +8 -0
  25. data/app/views/noodall/admin/assets/_show.html.erb +48 -0
  26. data/app/views/noodall/admin/assets/_tags.html.erb +13 -0
  27. data/app/views/noodall/admin/assets/add.html.erb +10 -0
  28. data/app/views/noodall/admin/assets/form.html.erb +12 -0
  29. data/app/views/noodall/admin/assets/form.js.erb +2 -0
  30. data/app/views/noodall/admin/assets/index.html.erb +65 -0
  31. data/app/views/noodall/admin/assets/index.js.erb +1 -0
  32. data/app/views/noodall/admin/assets/show.html.erb +3 -0
  33. data/app/views/noodall/admin/assets/show.js.erb +1 -0
  34. data/app/views/noodall/admin/assets/tags.html.erb +3 -0
  35. data/app/views/noodall/admin/assets/tags.js.erb +1 -0
  36. data/app/views/noodall/admin/components/_component.erb +0 -0
  37. data/app/views/noodall/admin/nodes/_body.html.erb +5 -0
  38. data/app/views/noodall/admin/nodes/_branch.html.erb +10 -0
  39. data/app/views/noodall/admin/nodes/_home.html.erb +27 -0
  40. data/app/views/noodall/admin/nodes/_slot_form.html.erb +16 -0
  41. data/app/views/noodall/admin/nodes/change_template.html.erb +38 -0
  42. data/app/views/noodall/admin/nodes/index.html.erb +69 -0
  43. data/app/views/noodall/admin/nodes/new.html.erb +30 -0
  44. data/app/views/noodall/admin/nodes/show.html.erb +144 -0
  45. data/app/views/noodall/admin/nodes/tree.html.erb +3 -0
  46. data/app/views/noodall/admin/nodes/tree.js.erb +2 -0
  47. data/app/views/noodall/components/_component.erb +0 -0
  48. data/app/views/noodall/nodes/search.html.erb +14 -0
  49. data/app/views/noodall/nodes/sitemap.html.erb +3 -0
  50. data/app/views/noodall/nodes/sitemap.xml.rxml +22 -0
  51. data/config/application.rb +29 -0
  52. data/config/boot.rb +13 -0
  53. data/config/cucumber.yml +8 -0
  54. data/config/database.yml +14 -0
  55. data/config/environment.rb +5 -0
  56. data/config/environments/development.rb +30 -0
  57. data/config/environments/production.rb +50 -0
  58. data/config/environments/test.rb +35 -0
  59. data/config/locales/en.yml +5 -0
  60. data/config.ru +4 -0
  61. data/demo/controllers/application_controller.rb +22 -0
  62. data/demo/initializers/dragonfly.rb +1 -0
  63. data/demo/initializers/mongo_mapper.rb +13 -0
  64. data/demo/initializers/noodall.rb +2 -0
  65. data/demo/initializers/secret_token.rb +7 -0
  66. data/demo/initializers/session_store.rb +8 -0
  67. data/demo/models/gallery.rb +17 -0
  68. data/demo/models/page_a.rb +9 -0
  69. data/demo/models/page_b.rb +4 -0
  70. data/demo/models/page_c.rb +7 -0
  71. data/demo/models/promo.rb +22 -0
  72. data/demo/models/user.rb +12 -0
  73. data/demo/routes.rb +3 -0
  74. data/demo/seeds.rb +8 -0
  75. data/demo/views/admin/components/_gallery.html.erb +49 -0
  76. data/demo/views/admin/components/_promo.html.erb +34 -0
  77. data/demo/views/admin/nodes/_page_a.html.erb +47 -0
  78. data/demo/views/admin/nodes/_page_b.html.erb +35 -0
  79. data/demo/views/admin/nodes/_page_c.html.erb +35 -0
  80. data/demo/views/components/_gallery.html.erb +23 -0
  81. data/demo/views/components/_promo.html.erb +5 -0
  82. data/demo/views/layouts/application.html.erb +121 -0
  83. data/demo/views/nodes/page_a.html.erb +14 -0
  84. data/demo/views/nodes/page_b.html.erb +9 -0
  85. data/demo/views/nodes/page_c.html.erb +12 -0
  86. data/features/change_templates.feature +25 -0
  87. data/features/content_templates.feature +18 -0
  88. data/features/gallery_component.feature +22 -0
  89. data/features/manage_assets.feature +28 -0
  90. data/features/manage_content_tree.feature +42 -0
  91. data/features/preview.feature +8 -0
  92. data/features/promo_component.feature +18 -0
  93. data/features/publish_content.feature +28 -0
  94. data/features/search.feature +12 -0
  95. data/features/sitemap.feature +9 -0
  96. data/features/step_definitions/asset_steps.rb +66 -0
  97. data/features/step_definitions/cms_node_steps.rb +126 -0
  98. data/features/step_definitions/component_steps.rb +137 -0
  99. data/features/step_definitions/content_steps.rb +187 -0
  100. data/features/step_definitions/date_select_steps.rb +39 -0
  101. data/features/step_definitions/groups_access_steps.rb +92 -0
  102. data/features/step_definitions/node_steps.rb +25 -0
  103. data/features/step_definitions/preview_steps.rb +7 -0
  104. data/features/step_definitions/pubish_content_steps.rb +45 -0
  105. data/features/step_definitions/search_steps.rb +21 -0
  106. data/features/step_definitions/sign_in_steps.rb +3 -0
  107. data/features/step_definitions/web_steps.rb +219 -0
  108. data/features/support/env.rb +52 -0
  109. data/features/support/logo.png +0 -0
  110. data/features/support/paths.rb +56 -0
  111. data/generators/component/USAGE +8 -0
  112. data/generators/component/component_generator.rb +35 -0
  113. data/generators/component/lib/insert_commands.rb +61 -0
  114. data/generators/component/templates/admin_template.html.erb +50 -0
  115. data/generators/component/templates/factory.rb +5 -0
  116. data/generators/component/templates/model.rb +8 -0
  117. data/generators/component/templates/template.html.erb +41 -0
  118. data/generators/node/USAGE +8 -0
  119. data/generators/node/lib/insert_commands.rb +47 -0
  120. data/generators/node/node_generator.rb +35 -0
  121. data/generators/node/templates/admin_template.html.erb +49 -0
  122. data/generators/node/templates/factory.rb +5 -0
  123. data/generators/node/templates/model.rb +11 -0
  124. data/generators/node/templates/template.html.erb +41 -0
  125. data/generators/node_features/USAGE +8 -0
  126. data/generators/node_features/node_features_generator.rb +16 -0
  127. data/lib/generators/noodall/node/USAGE +8 -0
  128. data/lib/generators/noodall/node/node_generator.rb +21 -0
  129. data/lib/generators/noodall/node/templates/admin_template.html.erb +52 -0
  130. data/lib/generators/noodall/node/templates/factory.rb +8 -0
  131. data/lib/generators/noodall/node/templates/model.rb +13 -0
  132. data/lib/generators/noodall/node/templates/template.html.erb +12 -0
  133. data/lib/noodall/canable.rb +1 -0
  134. data/lib/noodall/dragonfly.rb +23 -0
  135. data/lib/noodall/engine.rb +13 -0
  136. data/lib/noodall/permalinks.rb +12 -0
  137. data/lib/noodall/routes.rb +45 -0
  138. data/lib/noodall/ui/version.rb +5 -0
  139. data/lib/noodall/ui.rb +17 -0
  140. data/lib/noodall/video_thumbnail_encoder.rb +31 -0
  141. data/lib/noodall-ui.rb +6 -0
  142. data/lib/tasks/cucumber.rake +53 -0
  143. data/log/.gitignore +0 -0
  144. data/noodall-ui.gemspec +28 -0
  145. data/public/favicon.ico +0 -0
  146. data/public/images/admin/add-small.png +0 -0
  147. data/public/images/admin/add.png +0 -0
  148. data/public/images/admin/add_file.gif +0 -0
  149. data/public/images/admin/advanced.gif +0 -0
  150. data/public/images/admin/back.png +0 -0
  151. data/public/images/admin/cancel-small.gif +0 -0
  152. data/public/images/admin/cancel.gif +0 -0
  153. data/public/images/admin/change-bg.gif +0 -0
  154. data/public/images/admin/change.gif +0 -0
  155. data/public/images/admin/check.png +0 -0
  156. data/public/images/admin/clear.gif +0 -0
  157. data/public/images/admin/close.png +0 -0
  158. data/public/images/admin/create.gif +0 -0
  159. data/public/images/admin/delete.gif +0 -0
  160. data/public/images/admin/delete.png +0 -0
  161. data/public/images/admin/doc-icon.png +0 -0
  162. data/public/images/admin/document.png +0 -0
  163. data/public/images/admin/down.png +0 -0
  164. data/public/images/admin/download.png +0 -0
  165. data/public/images/admin/draft.gif +0 -0
  166. data/public/images/admin/draft.png +0 -0
  167. data/public/images/admin/edit.gif +0 -0
  168. data/public/images/admin/edit.png +0 -0
  169. data/public/images/admin/image.png +0 -0
  170. data/public/images/admin/image_small.png +0 -0
  171. data/public/images/admin/info-white.png +0 -0
  172. data/public/images/admin/info.png +0 -0
  173. data/public/images/admin/media.gif +0 -0
  174. data/public/images/admin/nav-2.gif +0 -0
  175. data/public/images/admin/nav.gif +0 -0
  176. data/public/images/admin/next.png +0 -0
  177. data/public/images/admin/no-type-icon.png +0 -0
  178. data/public/images/admin/pagination.gif +0 -0
  179. data/public/images/admin/pdf-icon.png +0 -0
  180. data/public/images/admin/prev.png +0 -0
  181. data/public/images/admin/preview.gif +0 -0
  182. data/public/images/admin/publish.gif +0 -0
  183. data/public/images/admin/remove.gif +0 -0
  184. data/public/images/admin/reset.gif +0 -0
  185. data/public/images/admin/select_image.gif +0 -0
  186. data/public/images/admin/select_images.gif +0 -0
  187. data/public/images/admin/set.gif +0 -0
  188. data/public/images/admin/sort.png +0 -0
  189. data/public/images/admin/tag.png +0 -0
  190. data/public/images/admin/templates/article-page.gif +0 -0
  191. data/public/images/admin/templates/articles-list.gif +0 -0
  192. data/public/images/admin/templates/course-page.gif +0 -0
  193. data/public/images/admin/templates/event-page.gif +0 -0
  194. data/public/images/admin/templates/events-list.gif +0 -0
  195. data/public/images/admin/templates/home.gif +0 -0
  196. data/public/images/admin/templates/landing-page.gif +0 -0
  197. data/public/images/admin/templates/page-a.gif +0 -0
  198. data/public/images/admin/templates/page-b.gif +0 -0
  199. data/public/images/admin/templates/school-landing-page.gif +0 -0
  200. data/public/images/admin/templates/study-landing-page.gif +0 -0
  201. data/public/images/admin/top-level.png +0 -0
  202. data/public/images/admin/top-level_small.png +0 -0
  203. data/public/images/admin/txt-icon.png +0 -0
  204. data/public/images/admin/uncheck.png +0 -0
  205. data/public/images/admin/up.png +0 -0
  206. data/public/images/admin/update.gif +0 -0
  207. data/public/images/admin/upload.png +0 -0
  208. data/public/images/admin/video.png +0 -0
  209. data/public/images/admin/view.png +0 -0
  210. data/public/images/admin/xls-icon.png +0 -0
  211. data/public/images/fancybox/blank.gif +0 -0
  212. data/public/images/fancybox/fancy_close.png +0 -0
  213. data/public/images/fancybox/fancy_loading.png +0 -0
  214. data/public/images/fancybox/fancy_nav_left.png +0 -0
  215. data/public/images/fancybox/fancy_nav_right.png +0 -0
  216. data/public/images/fancybox/fancy_shadow_e.png +0 -0
  217. data/public/images/fancybox/fancy_shadow_n.png +0 -0
  218. data/public/images/fancybox/fancy_shadow_ne.png +0 -0
  219. data/public/images/fancybox/fancy_shadow_nw.png +0 -0
  220. data/public/images/fancybox/fancy_shadow_s.png +0 -0
  221. data/public/images/fancybox/fancy_shadow_se.png +0 -0
  222. data/public/images/fancybox/fancy_shadow_sw.png +0 -0
  223. data/public/images/fancybox/fancy_shadow_w.png +0 -0
  224. data/public/images/fancybox/fancy_title_left.png +0 -0
  225. data/public/images/fancybox/fancy_title_main.png +0 -0
  226. data/public/images/fancybox/fancy_title_over.png +0 -0
  227. data/public/images/fancybox/fancy_title_right.png +0 -0
  228. data/public/images/fancybox/fancybox-x.png +0 -0
  229. data/public/images/fancybox/fancybox-y.png +0 -0
  230. data/public/images/fancybox/fancybox.png +0 -0
  231. data/public/images/plupload/backgrounds.gif +0 -0
  232. data/public/images/plupload/buttons-disabled.png +0 -0
  233. data/public/images/plupload/buttons.png +0 -0
  234. data/public/images/plupload/delete.gif +0 -0
  235. data/public/images/plupload/done.gif +0 -0
  236. data/public/images/plupload/error.gif +0 -0
  237. data/public/images/plupload/throbber.gif +0 -0
  238. data/public/images/plupload/transp50.png +0 -0
  239. data/public/javascripts/admin/application.js +586 -0
  240. data/public/javascripts/admin/asset_edit.js +30 -0
  241. data/public/javascripts/admin/assets.js +98 -0
  242. data/public/javascripts/admin/gotham.font.js +20 -0
  243. data/public/javascripts/admin/jquery.jqtransform.js +366 -0
  244. data/public/javascripts/admin/nodes.js +30 -0
  245. data/public/javascripts/admin/tiny_mce_config.js +118 -0
  246. data/public/javascripts/ajaxify.js +20 -0
  247. data/public/javascripts/application.js +37 -0
  248. data/public/javascripts/carousel.lite.js +1 -0
  249. data/public/javascripts/cufon-yui.js +8 -0
  250. data/public/javascripts/fancybox.js +1078 -0
  251. data/public/javascripts/plupload/gears_init.js +86 -0
  252. data/public/javascripts/plupload/jquery.plupload.queue.min.js +1 -0
  253. data/public/javascripts/plupload/plupload.flash.swf +0 -0
  254. data/public/javascripts/plupload/plupload.full.min.js +1 -0
  255. data/public/javascripts/plupload/plupload.silverlight.xap +0 -0
  256. data/public/javascripts/rails.js +132 -0
  257. data/public/javascripts/tiny_mce/jquery.tinymce.js +1 -0
  258. data/public/javascripts/tiny_mce/langs/en.js +169 -0
  259. data/public/javascripts/tiny_mce/license.txt +504 -0
  260. data/public/javascripts/tiny_mce/plugins/advhr/css/advhr.css +5 -0
  261. data/public/javascripts/tiny_mce/plugins/advhr/editor_plugin.js +1 -0
  262. data/public/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js +57 -0
  263. data/public/javascripts/tiny_mce/plugins/advhr/js/rule.js +43 -0
  264. data/public/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +5 -0
  265. data/public/javascripts/tiny_mce/plugins/advhr/rule.htm +57 -0
  266. data/public/javascripts/tiny_mce/plugins/advimage/css/advimage.css +13 -0
  267. data/public/javascripts/tiny_mce/plugins/advimage/editor_plugin.js +1 -0
  268. data/public/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js +50 -0
  269. data/public/javascripts/tiny_mce/plugins/advimage/image.htm +232 -0
  270. data/public/javascripts/tiny_mce/plugins/advimage/img/sample.gif +0 -0
  271. data/public/javascripts/tiny_mce/plugins/advimage/js/image.js +443 -0
  272. data/public/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js +43 -0
  273. data/public/javascripts/tiny_mce/plugins/advlink/css/advlink.css +8 -0
  274. data/public/javascripts/tiny_mce/plugins/advlink/editor_plugin.js +1 -0
  275. data/public/javascripts/tiny_mce/plugins/advlink/editor_plugin_src.js +61 -0
  276. data/public/javascripts/tiny_mce/plugins/advlink/js/advlink.js +528 -0
  277. data/public/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +52 -0
  278. data/public/javascripts/tiny_mce/plugins/advlink/link.htm +333 -0
  279. data/public/javascripts/tiny_mce/plugins/advlist/editor_plugin.js +1 -0
  280. data/public/javascripts/tiny_mce/plugins/advlist/editor_plugin_src.js +154 -0
  281. data/public/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -0
  282. data/public/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +117 -0
  283. data/public/javascripts/tiny_mce/plugins/autosave/editor_plugin.js +1 -0
  284. data/public/javascripts/tiny_mce/plugins/autosave/editor_plugin_src.js +422 -0
  285. data/public/javascripts/tiny_mce/plugins/autosave/langs/en.js +4 -0
  286. data/public/javascripts/tiny_mce/plugins/bbcode/editor_plugin.js +1 -0
  287. data/public/javascripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +120 -0
  288. data/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -0
  289. data/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js +127 -0
  290. data/public/javascripts/tiny_mce/plugins/directionality/editor_plugin.js +1 -0
  291. data/public/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js +82 -0
  292. data/public/javascripts/tiny_mce/plugins/emotions/editor_plugin.js +1 -0
  293. data/public/javascripts/tiny_mce/plugins/emotions/editor_plugin_src.js +43 -0
  294. data/public/javascripts/tiny_mce/plugins/emotions/emotions.htm +40 -0
  295. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-cool.gif +0 -0
  296. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-cry.gif +0 -0
  297. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-embarassed.gif +0 -0
  298. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
  299. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-frown.gif +0 -0
  300. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-innocent.gif +0 -0
  301. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-kiss.gif +0 -0
  302. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
  303. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
  304. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
  305. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
  306. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
  307. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
  308. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-undecided.gif +0 -0
  309. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
  310. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-yell.gif +0 -0
  311. data/public/javascripts/tiny_mce/plugins/emotions/js/emotions.js +22 -0
  312. data/public/javascripts/tiny_mce/plugins/emotions/langs/en_dlg.js +20 -0
  313. data/public/javascripts/tiny_mce/plugins/example/dialog.htm +22 -0
  314. data/public/javascripts/tiny_mce/plugins/example/editor_plugin.js +1 -0
  315. data/public/javascripts/tiny_mce/plugins/example/editor_plugin_src.js +84 -0
  316. data/public/javascripts/tiny_mce/plugins/example/img/example.gif +0 -0
  317. data/public/javascripts/tiny_mce/plugins/example/js/dialog.js +19 -0
  318. data/public/javascripts/tiny_mce/plugins/example/langs/en.js +3 -0
  319. data/public/javascripts/tiny_mce/plugins/example/langs/en_dlg.js +3 -0
  320. data/public/javascripts/tiny_mce/plugins/fullpage/css/fullpage.css +182 -0
  321. data/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js +1 -0
  322. data/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +149 -0
  323. data/public/javascripts/tiny_mce/plugins/fullpage/fullpage.htm +571 -0
  324. data/public/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js +471 -0
  325. data/public/javascripts/tiny_mce/plugins/fullpage/langs/en_dlg.js +85 -0
  326. data/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -0
  327. data/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +148 -0
  328. data/public/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +109 -0
  329. data/public/javascripts/tiny_mce/plugins/iespell/editor_plugin.js +1 -0
  330. data/public/javascripts/tiny_mce/plugins/iespell/editor_plugin_src.js +54 -0
  331. data/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -0
  332. data/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +635 -0
  333. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  334. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  335. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  336. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  337. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  338. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  339. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  340. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +90 -0
  341. data/public/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -0
  342. data/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js +1 -0
  343. data/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +83 -0
  344. data/public/javascripts/tiny_mce/plugins/layer/editor_plugin.js +1 -0
  345. data/public/javascripts/tiny_mce/plugins/layer/editor_plugin_src.js +212 -0
  346. data/public/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -0
  347. data/public/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +136 -0
  348. data/public/javascripts/tiny_mce/plugins/media/css/content.css +6 -0
  349. data/public/javascripts/tiny_mce/plugins/media/css/media.css +16 -0
  350. data/public/javascripts/tiny_mce/plugins/media/editor_plugin.js +1 -0
  351. data/public/javascripts/tiny_mce/plugins/media/editor_plugin_src.js +414 -0
  352. data/public/javascripts/tiny_mce/plugins/media/img/flash.gif +0 -0
  353. data/public/javascripts/tiny_mce/plugins/media/img/flv_player.swf +0 -0
  354. data/public/javascripts/tiny_mce/plugins/media/img/quicktime.gif +0 -0
  355. data/public/javascripts/tiny_mce/plugins/media/img/realmedia.gif +0 -0
  356. data/public/javascripts/tiny_mce/plugins/media/img/shockwave.gif +0 -0
  357. data/public/javascripts/tiny_mce/plugins/media/img/trans.gif +0 -0
  358. data/public/javascripts/tiny_mce/plugins/media/img/windowsmedia.gif +0 -0
  359. data/public/javascripts/tiny_mce/plugins/media/js/embed.js +73 -0
  360. data/public/javascripts/tiny_mce/plugins/media/js/media.js +630 -0
  361. data/public/javascripts/tiny_mce/plugins/media/langs/en_dlg.js +103 -0
  362. data/public/javascripts/tiny_mce/plugins/media/media.htm +817 -0
  363. data/public/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -0
  364. data/public/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +53 -0
  365. data/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js +1 -0
  366. data/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +90 -0
  367. data/public/javascripts/tiny_mce/plugins/pagebreak/css/content.css +1 -0
  368. data/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -0
  369. data/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +77 -0
  370. data/public/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif +0 -0
  371. data/public/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif +0 -0
  372. data/public/javascripts/tiny_mce/plugins/paste/editor_plugin.js +1 -0
  373. data/public/javascripts/tiny_mce/plugins/paste/editor_plugin_src.js +929 -0
  374. data/public/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -0
  375. data/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -0
  376. data/public/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +5 -0
  377. data/public/javascripts/tiny_mce/plugins/paste/pastetext.htm +27 -0
  378. data/public/javascripts/tiny_mce/plugins/paste/pasteword.htm +21 -0
  379. data/public/javascripts/tiny_mce/plugins/preview/editor_plugin.js +1 -0
  380. data/public/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js +53 -0
  381. data/public/javascripts/tiny_mce/plugins/preview/example.html +28 -0
  382. data/public/javascripts/tiny_mce/plugins/preview/jscripts/embed.js +73 -0
  383. data/public/javascripts/tiny_mce/plugins/preview/preview.html +17 -0
  384. data/public/javascripts/tiny_mce/plugins/print/editor_plugin.js +1 -0
  385. data/public/javascripts/tiny_mce/plugins/print/editor_plugin_src.js +34 -0
  386. data/public/javascripts/tiny_mce/plugins/save/editor_plugin.js +1 -0
  387. data/public/javascripts/tiny_mce/plugins/save/editor_plugin_src.js +101 -0
  388. data/public/javascripts/tiny_mce/plugins/searchreplace/css/searchreplace.css +6 -0
  389. data/public/javascripts/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -0
  390. data/public/javascripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js +57 -0
  391. data/public/javascripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +130 -0
  392. data/public/javascripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js +16 -0
  393. data/public/javascripts/tiny_mce/plugins/searchreplace/searchreplace.htm +99 -0
  394. data/public/javascripts/tiny_mce/plugins/spellchecker/css/content.css +1 -0
  395. data/public/javascripts/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -0
  396. data/public/javascripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js +341 -0
  397. data/public/javascripts/tiny_mce/plugins/spellchecker/img/wline.gif +0 -0
  398. data/public/javascripts/tiny_mce/plugins/style/css/props.css +13 -0
  399. data/public/javascripts/tiny_mce/plugins/style/editor_plugin.js +1 -0
  400. data/public/javascripts/tiny_mce/plugins/style/editor_plugin_src.js +55 -0
  401. data/public/javascripts/tiny_mce/plugins/style/js/props.js +641 -0
  402. data/public/javascripts/tiny_mce/plugins/style/langs/en_dlg.js +63 -0
  403. data/public/javascripts/tiny_mce/plugins/style/props.htm +726 -0
  404. data/public/javascripts/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -0
  405. data/public/javascripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js +112 -0
  406. data/public/javascripts/tiny_mce/plugins/table/cell.htm +178 -0
  407. data/public/javascripts/tiny_mce/plugins/table/css/cell.css +17 -0
  408. data/public/javascripts/tiny_mce/plugins/table/css/row.css +25 -0
  409. data/public/javascripts/tiny_mce/plugins/table/css/table.css +13 -0
  410. data/public/javascripts/tiny_mce/plugins/table/editor_plugin.js +1 -0
  411. data/public/javascripts/tiny_mce/plugins/table/editor_plugin_src.js +1118 -0
  412. data/public/javascripts/tiny_mce/plugins/table/js/cell.js +286 -0
  413. data/public/javascripts/tiny_mce/plugins/table/js/merge_cells.js +27 -0
  414. data/public/javascripts/tiny_mce/plugins/table/js/row.js +237 -0
  415. data/public/javascripts/tiny_mce/plugins/table/js/table.js +449 -0
  416. data/public/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +74 -0
  417. data/public/javascripts/tiny_mce/plugins/table/merge_cells.htm +32 -0
  418. data/public/javascripts/tiny_mce/plugins/table/row.htm +155 -0
  419. data/public/javascripts/tiny_mce/plugins/table/table.htm +187 -0
  420. data/public/javascripts/tiny_mce/plugins/template/blank.htm +12 -0
  421. data/public/javascripts/tiny_mce/plugins/template/css/template.css +23 -0
  422. data/public/javascripts/tiny_mce/plugins/template/editor_plugin.js +1 -0
  423. data/public/javascripts/tiny_mce/plugins/template/editor_plugin_src.js +159 -0
  424. data/public/javascripts/tiny_mce/plugins/template/js/template.js +106 -0
  425. data/public/javascripts/tiny_mce/plugins/template/langs/en_dlg.js +15 -0
  426. data/public/javascripts/tiny_mce/plugins/template/template.htm +32 -0
  427. data/public/javascripts/tiny_mce/plugins/visualchars/editor_plugin.js +1 -0
  428. data/public/javascripts/tiny_mce/plugins/visualchars/editor_plugin_src.js +76 -0
  429. data/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
  430. data/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +98 -0
  431. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +141 -0
  432. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +141 -0
  433. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +148 -0
  434. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/cite.htm +141 -0
  435. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/css/attributes.css +11 -0
  436. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/css/popup.css +9 -0
  437. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/del.htm +161 -0
  438. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -0
  439. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +144 -0
  440. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/ins.htm +161 -0
  441. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js +28 -0
  442. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js +28 -0
  443. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +126 -0
  444. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/cite.js +28 -0
  445. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/del.js +63 -0
  446. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +231 -0
  447. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +62 -0
  448. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
  449. data/public/javascripts/tiny_mce/themes/advanced/about.htm +54 -0
  450. data/public/javascripts/tiny_mce/themes/advanced/anchor.htm +26 -0
  451. data/public/javascripts/tiny_mce/themes/advanced/charmap.htm +53 -0
  452. data/public/javascripts/tiny_mce/themes/advanced/color_picker.htm +73 -0
  453. data/public/javascripts/tiny_mce/themes/advanced/editor_template.js +1 -0
  454. data/public/javascripts/tiny_mce/themes/advanced/editor_template_src.js +1167 -0
  455. data/public/javascripts/tiny_mce/themes/advanced/image.htm +80 -0
  456. data/public/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
  457. data/public/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
  458. data/public/javascripts/tiny_mce/themes/advanced/js/about.js +72 -0
  459. data/public/javascripts/tiny_mce/themes/advanced/js/anchor.js +37 -0
  460. data/public/javascripts/tiny_mce/themes/advanced/js/charmap.js +335 -0
  461. data/public/javascripts/tiny_mce/themes/advanced/js/color_picker.js +253 -0
  462. data/public/javascripts/tiny_mce/themes/advanced/js/image.js +245 -0
  463. data/public/javascripts/tiny_mce/themes/advanced/js/link.js +156 -0
  464. data/public/javascripts/tiny_mce/themes/advanced/js/source_editor.js +62 -0
  465. data/public/javascripts/tiny_mce/themes/advanced/langs/en.js +62 -0
  466. data/public/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +51 -0
  467. data/public/javascripts/tiny_mce/themes/advanced/link.htm +58 -0
  468. data/public/javascripts/tiny_mce/themes/advanced/skins/default/content.css +35 -0
  469. data/public/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +117 -0
  470. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
  471. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
  472. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  473. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  474. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
  475. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
  476. data/public/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +213 -0
  477. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +35 -0
  478. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +116 -0
  479. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  480. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  481. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  482. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +215 -0
  483. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +8 -0
  484. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
  485. data/public/javascripts/tiny_mce/themes/advanced/source_editor.htm +26 -0
  486. data/public/javascripts/tiny_mce/themes/simple/editor_template.js +1 -0
  487. data/public/javascripts/tiny_mce/themes/simple/editor_template_src.js +85 -0
  488. data/public/javascripts/tiny_mce/themes/simple/img/icons.gif +0 -0
  489. data/public/javascripts/tiny_mce/themes/simple/langs/en.js +11 -0
  490. data/public/javascripts/tiny_mce/themes/simple/skins/default/content.css +25 -0
  491. data/public/javascripts/tiny_mce/themes/simple/skins/default/ui.css +32 -0
  492. data/public/javascripts/tiny_mce/themes/simple/skins/o2k7/content.css +17 -0
  493. data/public/javascripts/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  494. data/public/javascripts/tiny_mce/themes/simple/skins/o2k7/ui.css +35 -0
  495. data/public/javascripts/tiny_mce/tiny_mce.js +1 -0
  496. data/public/javascripts/tiny_mce/tiny_mce_popup.js +5 -0
  497. data/public/javascripts/tiny_mce/tiny_mce_src.js +13134 -0
  498. data/public/javascripts/tiny_mce/utils/editable_selects.js +70 -0
  499. data/public/javascripts/tiny_mce/utils/form_utils.js +200 -0
  500. data/public/javascripts/tiny_mce/utils/mctabs.js +77 -0
  501. data/public/javascripts/tiny_mce/utils/validate.js +220 -0
  502. data/public/stylesheets/admin/fancybox.css +341 -0
  503. data/public/stylesheets/admin/forms.css +520 -0
  504. data/public/stylesheets/admin/handheld.css +6 -0
  505. data/public/stylesheets/admin/ie.css +118 -0
  506. data/public/stylesheets/admin/ie6.css +23 -0
  507. data/public/stylesheets/admin/ie8.css +16 -0
  508. data/public/stylesheets/admin/layout.css +723 -0
  509. data/public/stylesheets/admin/print.css +27 -0
  510. data/public/stylesheets/admin/reset.css +81 -0
  511. data/public/stylesheets/admin/skin.css +698 -0
  512. data/public/stylesheets/admin/tinymce.css +2 -0
  513. data/public/stylesheets/admin/typography.css +207 -0
  514. data/public/stylesheets/ellipsis.xml +15 -0
  515. data/public/stylesheets/fancybox.css +313 -0
  516. data/public/stylesheets/forms.css +7 -0
  517. data/public/stylesheets/ie.css +12 -0
  518. data/public/stylesheets/ie8.css +8 -0
  519. data/public/stylesheets/layout.css +31 -0
  520. data/public/stylesheets/plupload.queue.css +181 -0
  521. data/public/stylesheets/reset.css +84 -0
  522. data/public/stylesheets/sass/forms.scss +7 -0
  523. data/public/stylesheets/sass/ie.scss +12 -0
  524. data/public/stylesheets/sass/ie8.scss +8 -0
  525. data/public/stylesheets/sass/layout.scss +45 -0
  526. data/public/stylesheets/sass/skin.scss +35 -0
  527. data/public/stylesheets/sass/typography.scss +162 -0
  528. data/public/stylesheets/skin.css +22 -0
  529. data/public/stylesheets/typography.css +162 -0
  530. data/script/cucumber +10 -0
  531. data/script/rails +6 -0
  532. data/spec/factories/asset.rb +16 -0
  533. data/spec/factories/component.rb +9 -0
  534. data/spec/factories/node.rb +15 -0
  535. data/spec/factories/user.rb +5 -0
  536. data/spec/files/beef.png +0 -0
  537. data/spec/files/get_video.flv +0 -0
  538. data/spec/files/test.pdf +0 -0
  539. data/spec/noodall-ui_spec.rb +9 -0
  540. data/spec/spec_helper.rb +4 -0
  541. data/tmp/.gitignore +0 -0
  542. metadata +685 -0
@@ -0,0 +1,159 @@
1
+ module Noodall
2
+ module Admin
3
+ class NodesController < BaseController
4
+ include Canable::Enforcers
5
+ layout 'noodall_admin'
6
+ before_filter :set_title
7
+
8
+ def index
9
+ if params[:node_id].nil?
10
+ @nodes = Node.roots
11
+ else
12
+ @parent = Node.find(params[:node_id])
13
+ @nodes = @parent.children
14
+ end
15
+
16
+ respond_to do |format|
17
+ format.html # index.html.erb
18
+ format.xml { render :xml => @nodes }
19
+ end
20
+ end
21
+
22
+ def tree
23
+ @options = {}
24
+ @options[:_type] = params[:allowed_types] if params[:allowed_types]
25
+ if params[:not_branch]
26
+ @options.merge!(
27
+ :_id => {"$ne" => BSON::ObjectId.from_string(params[:not_branch])},
28
+ Node.path_field => {"$ne" => BSON::ObjectId.from_string(params[:not_branch])}
29
+ )
30
+ end
31
+
32
+ respond_to do |format|
33
+ format.html
34
+ format.js
35
+ end
36
+ end
37
+
38
+ def show
39
+ @node = Node.find(params[:id])
40
+ enforce_update_permission(@node)
41
+ enforce_publish_permission(@node) if @node.published?
42
+
43
+ respond_to do |format|
44
+ format.html
45
+ format.xml { render :xml => @node }
46
+ end
47
+ end
48
+
49
+ def new
50
+ @parent = Node.find(params[:node_id])
51
+ @node = Node.new( :parent => @parent )
52
+ enforce_create_permission(@node)
53
+
54
+ @template_names = @parent.nil? ? Node.template_names : @parent.class.template_names
55
+ respond_to do |format|
56
+ format.html
57
+ format.xml { render :xml => @node }
58
+ end
59
+ end
60
+
61
+ def create
62
+ template_class = params[:node].delete(:template).to_s.gsub(' ','').constantize
63
+ @node = template_class.new(params[:node])
64
+ enforce_create_permission(@node)
65
+
66
+ # Set user stamps
67
+ @node.creator = @node.updater = current_user
68
+
69
+ respond_to do |format|
70
+ if @node.save
71
+ flash[:notice] = "#{@node.class.name.titleize} '#{@node.title}' was successfully created."
72
+ format.html { redirect_to noodall_admin_node_path(@node) }
73
+ format.xml { render :xml => @node, :status => :created, :location => @node }
74
+ else
75
+ format.html do
76
+ @parent = @node.parent
77
+ @template_names = @parent.nil? ? Node.template_names : @parent.class.template_names
78
+ render :action => "new"
79
+ end
80
+ format.xml { render :xml => @node.errors, :status => :unprocessable_entity }
81
+ end
82
+ end
83
+ end
84
+
85
+ def update
86
+ @node = Node.find(params[:id])
87
+ enforce_update_permission(@node)
88
+ enforce_publish_permission(@node) if @node.published?
89
+
90
+ # Set user stamp
91
+ @node.updater = current_user
92
+
93
+ respond_to do |format|
94
+ if @node.update_attributes(params[:node])
95
+ flash[:notice] = "#{@node.class.name.titleize} '#{@node.title}' was successfully updated."
96
+ format.html {
97
+ if @node.parent.nil?
98
+ redirect_to noodall_admin_nodes_path
99
+ else
100
+ redirect_to noodall_admin_node_nodes_path(@node.parent.id)
101
+ end
102
+ }
103
+ format.xml { head :ok }
104
+ else
105
+ format.html { render :action => "show" }
106
+ format.xml { render :xml => @node.errors, :status => :unprocessable_entity }
107
+ end
108
+ end
109
+ end
110
+
111
+ def destroy
112
+ @node = Node.find(params[:id])
113
+ enforce_destroy_permission(@node)
114
+
115
+ @node.destroy
116
+ flash[:notice] = "#{@node.class.name.titleize} '#{@node.title}' was successfully deleted."
117
+
118
+ respond_to do |format|
119
+ format.html { redirect_to(noodall_admin_nodes_url) }
120
+ format.xml { head :ok }
121
+ end
122
+ end
123
+
124
+ def move_up
125
+ @node = Node.find(params[:id])
126
+ enforce_update_permission(@node)
127
+ @node.move_higher
128
+ redirect_to :back
129
+ end
130
+
131
+ def move_down
132
+ @node = Node.find(params[:id])
133
+ enforce_update_permission(@node)
134
+ @node.move_lower
135
+ redirect_to :back
136
+ end
137
+
138
+ def preview
139
+ @node = Node.find(params[:id])
140
+ @node.attributes = params[:node]
141
+ @node.permalink ||= 'preview'
142
+ render :template => "/nodes/#{@node.class.name.underscore}", :layout => 'application'
143
+ end
144
+
145
+
146
+ def change_template
147
+ @node = Node.find(params[:id])
148
+ enforce_update_permission(@node)
149
+ @template_names = @node.parent.nil? ? Node.template_names : @node.parent.class.template_names
150
+ end
151
+
152
+
153
+ private
154
+ def set_title
155
+ @page_title = 'Content'
156
+ end
157
+ end
158
+ end
159
+ end
@@ -0,0 +1,41 @@
1
+ module Noodall
2
+ class NodesController < ApplicationController
3
+ def show
4
+ if published_states_changed_since_global_update? or stale?(:last_modified => GlobalUpdateTime::Stamp.read, :public => true)
5
+ permalink = params[:permalink].is_a?(String) ? params[:permalink] : params[:permalink].join('/')
6
+
7
+ @node = Node.find_by_permalink(permalink)
8
+ @page_title = @node.title
9
+ @page_description = @node.description
10
+ @page_keywords = @node.keywords
11
+
12
+ respond_to do |format|
13
+ format.html { render "nodes/#{@node.class.name.underscore}" }
14
+ format.rss { render "nodes/#{@node.class.name.underscore}" }
15
+ end
16
+ end
17
+ end
18
+
19
+ def sitemap
20
+ if stale?(:last_modified => GlobalUpdateTime::Stamp.read, :public => true)
21
+ @page_title = 'Sitemap'
22
+ end
23
+ end
24
+
25
+ def search
26
+ @nodes = Node.search(params[:q], :per_page => 10, :page => params[:page], :published_at => { :$lte => Time.zone.now }, :published_to => { :$gte => Time.zone.now })
27
+ @page_title = 'Searching: '+ params[:q]
28
+ end
29
+
30
+ protected
31
+
32
+ def published_states_changed_since_global_update?
33
+ if Node.count(:published_at => { :$gte => GlobalUpdateTime::Stamp.read, :$lte => Time.zone.now }).zero? and Node.count(:published_to => { :$gte => GlobalUpdateTime::Stamp.read, :$lte => Time.zone.now }).zero?
34
+ false
35
+ else
36
+ GlobalUpdateTime::Stamp.update!
37
+ true
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,15 @@
1
+ module Noodall::Admin::AssetsHelper
2
+ include SortableTable::App::Helpers::ApplicationHelper
3
+
4
+ def asset_icon(asset)
5
+ icon = case asset.file_ext
6
+ when "doc", "pdf", "txt", "xls"
7
+ "admin/#{asset.file_ext}-icon.png"
8
+ else
9
+ "admin/no-type-icon.png"
10
+ end
11
+
12
+ image_tag icon, :title => "#{asset.title} - #{asset.file.name}"
13
+ end
14
+
15
+ end
@@ -0,0 +1,14 @@
1
+ module Noodall::Admin::BaseHelper
2
+ include Noodall::LayoutHelper
3
+ def admin_page_title
4
+ @page_title ||= controller.controller_name.titleize +
5
+ (controller.action_name == 'index' ? ' ' : " | #{controller.action_name.titleize}" ) +
6
+ " | #{Noodall::UI.app_name}"
7
+ end
8
+
9
+ def admin_menu_items
10
+ Noodall::UI.menu_items.map do |title, link|
11
+ content_tag :li, link_to( title, send(link) )
12
+ end.join.html_safe
13
+ end
14
+ end
@@ -0,0 +1,37 @@
1
+ module Noodall
2
+ module Admin
3
+ module NodesHelper
4
+ include Noodall::Permalinks
5
+
6
+ def sorted_node_tree(tree)
7
+ nodes = []
8
+ tree.each do |node|
9
+ nodes << node
10
+ unless node.children.empty?
11
+ nodes += sorted_node_tree(node.children)
12
+ end
13
+ end
14
+
15
+ nodes
16
+ end
17
+
18
+ def formatted_node_tree_options
19
+ sorted_node_tree(Node.roots).reject{|n| n._id == @node._id}.collect{|n|
20
+ [n.title, n._id]
21
+ }
22
+ end
23
+
24
+ def slot_link(node,type,index)
25
+ link_to( "#{type.to_s.titleize} Slot", {:anchor => "#{type}_component_form_#{index}"}, :id=> "#{type}_slot_#{index}_selector", :class => 'slot_link') +
26
+ "<span id=\"#{type}_slot_#{index}_tag\" class=\"slot_tag\">#{node.send("#{type}_slot_#{index}").class.name.titleize unless @node.send("#{type}_slot_#{index}").nil?}</span>".html_safe
27
+ end
28
+
29
+ def slot_form(node,type,index)
30
+ component = @node.send("#{type}_slot_#{index}")
31
+ options = options_for_select([''] + Component.positions_names(type), (component._type.titleize unless component.nil?))
32
+
33
+ render :partial => 'slot_form', :locals => { :type => type, :index => index, :component => component, :options => options, :slot_name => "#{ type }_slot_#{ index }" }
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,38 @@
1
+ module Noodall::ComponentsHelper
2
+
3
+
4
+ def component_row(*args)
5
+ node = args.shift
6
+ raise ActiveRecord::RecordNotFound if node.nil?
7
+ components = args.map { |slot_code| node.send(slot_code) }
8
+
9
+ # render each slot in the row
10
+ args.map do |slot_code|
11
+ index = args.index(slot_code)
12
+ component = components[index]
13
+
14
+ additional_classes = []
15
+ additional_classes << slot_code.split("_").shift unless slot_code.split("_").shift.nil?
16
+ additional_classes << 'penultimate' if slot_code == args[args.size - 2]
17
+ additional_classes << 'last' if args.last == slot_code
18
+ additional_classes << 'first' if args.first == slot_code
19
+
20
+ # pass a flag to the view to add an expanded html class
21
+ component(node, slot_code, ( components[index + 1].nil? && index < (args.size - 1) ), additional_classes.join(' ')).to_s
22
+ end
23
+ end
24
+
25
+ def component(node, slot_code, expand = false, additional_classes = '')
26
+ component = node.send(slot_code)
27
+ # Add an empty blank to fill in
28
+ if component.respond_to?(:contents)
29
+ component.contents.reject!{|c| c.asset_id.blank? }
30
+ component.contents << Content.new
31
+ end
32
+
33
+ additional_classes = []
34
+ additional_classes << slot_code.split("_").shift unless slot_code.split("_").shift.nil?
35
+
36
+ render :partial => "components/#{component.class.name.underscore}", :locals => { :slot_code => slot_code, :component => component, :expand => expand, :additional_classes => additional_classes } unless component.nil?
37
+ end
38
+ end
@@ -0,0 +1,25 @@
1
+ module Noodall::LayoutHelper
2
+ def page_class
3
+ @node.nil? ? controller_name : "#{@node.class.name.underscore.parameterize} #{@node.permalink.join(' ')}"
4
+ end
5
+
6
+ def page_id
7
+ @node.nil? ? "#{controller_name}-#{action_name}" : @node.permalink.join('-')
8
+ end
9
+
10
+ def page_title
11
+ @page_title ||= controller.controller_name.titleize + (controller.action_name == 'index' ? " #{controller.action_name.titleize}" : ' ' )
12
+ end
13
+
14
+ attr_reader :page_description, :page_keywords
15
+
16
+ # Render flash messages
17
+ def flash_messages
18
+ return if flash.empty?
19
+ flash_divs = flash.collect do |key, value|
20
+ content_tag :div, h( value ), :class => "flash #{key}"
21
+ end
22
+
23
+ content_tag :div, flash_divs.join.html_safe, :id => "flash"
24
+ end
25
+ end
@@ -0,0 +1,72 @@
1
+ module Noodall
2
+ module NodesHelper
3
+ include Noodall::Permalinks
4
+
5
+ def sitemap(tree)
6
+ list_children(tree, nil, 'sitemap')
7
+ end
8
+
9
+ def list_children(tree, parent, id_prefix = nil, level_limit = 0)
10
+ # find the root node element or the parent's element
11
+ parent_id = (parent.nil? ? parent.to_s : parent.id.to_s)
12
+
13
+ return if tree[parent_id].blank?
14
+ content_tag 'ol', :id => (id_prefix.nil? ? '' : "#{id_prefix}-") + "node-tree-#{(parent.nil? ? 'root' : parent_id)}" do
15
+ tree[parent_id].collect do |n|
16
+ content = link_to(h(n.title), node_path(n))
17
+ # only recurse if there is no limit and the limit has not been exceeded and if there are child nodes
18
+ if (level_limit.zero? || level_limit > n.path.count) && !tree[n.id.to_s].nil?
19
+ class_name = " has-children"
20
+ content += list_children(tree, n, id_prefix, level_limit) + "\n"
21
+ end
22
+ content_tag('li', content, {:id => "nav-#{n.permalink.join('-')}", :class => class_name}) + "\n"
23
+ end.join
24
+ end
25
+ end
26
+
27
+ def breadcrumb
28
+ return if @node.nil?
29
+ links = @node.ancestors.inject([]) do |l, n|
30
+ l << content_tag( :li, link_to(h(n.title), node_path(n)))
31
+ end
32
+ links << content_tag( :li, h(@node.title) )
33
+ end
34
+
35
+ # get an organised grouped index of nodes for the primary nav
36
+ def node_tree
37
+ @node_tree ||= Node.all({:fields => "title, permalink, parent_id, _id, path, _type", :published_at => { :$lte => Time.zone.now }, :published_to => { :$gte => Time.zone.now }, :order => 'parent_id ASC, position ASC'}).group_by{|n| n.parent_id.to_s }
38
+ end
39
+
40
+ def node_nav(node = nil)
41
+ # use a passed in node maybe
42
+ current_node = (node || @node)
43
+
44
+ return unless node_has_nav?(current_node)
45
+
46
+ content_tag('ul', :id => 'sub-page-nav', :class => 'level-1') do
47
+ node_tree[current_node.root.id.to_s].collect do |node|
48
+ render :partial => 'nodes/node_nav', :locals => {:current_node => current_node, :child_node => node}
49
+ end
50
+ end
51
+ end
52
+
53
+ def node_has_nav?(node = nil)
54
+ current_node = (node || @node)
55
+ !(current_node.nil? or node_tree[current_node.root.id.to_s].nil?)
56
+ end
57
+
58
+ def related_content(ref_node, types =[], options = {})
59
+ options[:_type] = {'$in' => types} unless types.empty?
60
+
61
+ nodes = ref_node.related(publish_options(options.merge(:order => 'published_at DESC')))
62
+ return if nodes.empty?
63
+
64
+ content_tag('h2', 'Related Content') +
65
+ content_tag('ul', :id => 'related-content') do
66
+ nodes.collect do |node|
67
+ content_tag('li', link_to(h(node.title), node_path(node)) + node.published_at.to_formatted_s(:short_dot))
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,103 @@
1
+ class Asset
2
+ include MongoMapper::Document
3
+ plugin Noodall::Tagging
4
+
5
+ # Set up dragonfly
6
+ extend Dragonfly::ActiveModelExtensions
7
+ register_dragonfly_app(:asset_accessor, Dragonfly::App[:noodall_assets])
8
+
9
+ asset_accessor :file
10
+
11
+ # Dragonfly fields
12
+ key :file_uid, String #For dragonfly file uid
13
+ key :file_name, String
14
+ key :file_ext, String
15
+ key :file_size, Integer
16
+ key :file_mime_type, String
17
+ key :video_thumbnail_offset, Integer, :default => 10
18
+
19
+ key :title, String
20
+ key :description, String
21
+ timestamps!
22
+
23
+ validates_presence_of :file, :title, :description
24
+ validates_length_of :tags, :minimum => 3, :message => "must have at least 3 items"
25
+
26
+ def image?
27
+ !(file_mime_type =~ self.class.image_reg_ex).nil?
28
+ end
29
+
30
+ def video?
31
+ file_ext == 'flv'
32
+ end
33
+
34
+ def url(*args)
35
+ if args.blank?
36
+ # Use the transparent url just the file is required with no processing
37
+ file.url
38
+ elsif video?
39
+ file.encode(:tiff, { :offset => "#{video_thumbnail_offset}%" }).thumb(*args).url
40
+ else
41
+ file.thumb(*args).url
42
+ end
43
+ end
44
+
45
+ def file_uid
46
+ # Required to rerun the correct object for Dragonfly pending
47
+ return Dragonfly::ActiveRecordExtensions::PendingUID.new if @file_uid == "PENDING"
48
+ @file_uid
49
+ end
50
+
51
+ def log_usage(node_id, location)
52
+ # Check it's not been logged here before
53
+ if log_entries.select{|l| l.node_id.to_s == node_id.to_s and l.location == location }.empty?
54
+ log_entry = LogEntry.new(:node_id => node_id, :location => location)
55
+ if log_entry.valid?
56
+ self.log_entries << log_entry
57
+ self.save(:validate => false)
58
+ end
59
+ end
60
+ end
61
+
62
+ protected
63
+
64
+ def set_title
65
+ self.title = file_name.gsub(/\.[\w\d]{3,4}$/,'').titleize if title.blank?
66
+ end
67
+ before_save :set_title
68
+
69
+ module ClassMethods
70
+ def images
71
+ Asset.all(:conditions => {:file_ext.in => self.image_extensions})
72
+ end
73
+
74
+ def files
75
+ Asset.all(:conditions => {:file_ext.nin => self.image_extensions + self.video_extensions})
76
+ end
77
+
78
+ def image_reg_ex
79
+ /^image\/(#{self.image_extensions.join('|')})$/
80
+ end
81
+
82
+ def image_extensions
83
+ ['png','gif','jpg','jpeg']
84
+ end
85
+
86
+ def video_extensions
87
+ ['flv', 'avi', 'mpeg', 'mpg']
88
+ end
89
+ end
90
+ extend ClassMethods
91
+
92
+ class LogEntry
93
+ include MongoMapper::EmbeddedDocument
94
+
95
+ key :location, String, :required => true
96
+ key :node_id, ObjectId, :required => true
97
+
98
+ belongs_to :node, :class => Noodall::Node
99
+ embedded_in :asset
100
+ end
101
+
102
+ many :log_entries, :class => LogEntry
103
+ end
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5
+ <head>
6
+ <!-- START META TAGS -->
7
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
8
+ <meta http-equiv="content-language" content="en" />
9
+ <meta name="MSSmartTagsPreventParsing" content="true" />
10
+ <meta name="copyright" content="<%= Time.now.year %>, Beef" />
11
+ <meta name="web-author" content="Beef (www.wearebeef.co.uk)" />
12
+ <meta name="author" content="Beef"/>
13
+
14
+ <!-- END META TAGS -->
15
+ <title><%= admin_page_title %> | <%= Noodall::UI.app_name %> <%= Noodall::UI.system_name %></title>
16
+
17
+ <%= stylesheet_link_tag 'admin/reset', 'admin/layout', 'admin/skin', 'admin/typography', 'admin/forms', 'admin/fancybox', :media=>'screen,tv,projection' %>
18
+ <%= stylesheet_link_tag 'admin/print', :media=>'print' %>
19
+ <%= stylesheet_link_tag 'admin/handheld', :media=>'handheld' %>
20
+ <%= stylesheet_link_tag 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/themes/base/jquery.ui.all.css' %>
21
+
22
+ <!--[if IE 6]><link href="/stylesheets/admin/ie6.css" media="screen" rel="Stylesheet" type="text/css" /><![endif]-->
23
+ <!--[if IE 7]><link href="/stylesheets/admin/ie.css" media="screen" rel="Stylesheet" type="text/css" /><![endif]-->
24
+ <!--[if IE 8]><link href="/stylesheets/admin/ie8.css" media="screen" rel="Stylesheet" type="text/css" /><![endif]-->
25
+
26
+ <script src="http://www.google.com/jsapi" type="text/javascript"></script>
27
+ <script type="text/javascript">
28
+ google.load("jquery", "1.4.2");
29
+ google.load("jqueryui", "1.8");
30
+ </script>
31
+ <%= javascript_include_tag 'rails', 'cufon-yui', 'admin/gotham.font.js', 'fancybox', 'ajaxify', 'admin/application' %>
32
+ <%= csrf_meta_tag %>
33
+
34
+ <%= yield :header %>
35
+
36
+ </head>
37
+ <body id="<%= self.controller_name %>" class="<%= self.action_name %>">
38
+ <!-- begin screen -->
39
+ <div id="screen">
40
+ <!-- begin header -->
41
+ <div id="header">
42
+ <h1><strong><%= Noodall::UI.app_name %></strong> <%= Noodall::UI.system_name %></h1>
43
+ <ul id="status">
44
+ <li><%= current_user.full_name %> is logged in</li>
45
+ <li><%= link_to 'Sign Out', destroy_user_session_path %></li>
46
+ <li><%= link_to 'Live Site', '/' %></li>
47
+ </ul>
48
+ </div>
49
+ <!-- end header -->
50
+ <!-- begin navigation -->
51
+ <ul id="topnav">
52
+ <%= admin_menu_items %>
53
+ </ul>
54
+ <!-- end navigation -->
55
+
56
+ <%= flash_messages %>
57
+
58
+ <div id="content">
59
+ <%= yield %>
60
+ </div>
61
+
62
+ </div>
63
+ <!-- end screen -->
64
+ <!--[if IE]><script type="text/javascript"> Cufon.now(); </script><![endif]-->
65
+ </body>
66
+ </html>
@@ -0,0 +1,28 @@
1
+ <%= render 'menu' %>
2
+ <div id="browser-list">
3
+ <ul>
4
+ <% @assets.each do |asset| %>
5
+ <li class="file" title="<%= h( asset.title ) %>">
6
+ <div class="file-detail" id="asset-<%= asset.id %>">
7
+ <span class="file-title"><%= h( asset.title ) %></span>
8
+
9
+ <%= (asset.image? or asset.video?) ? image_tag( asset.url('70x70#', :jpg) ) : asset_icon(asset) %>
10
+ </div>
11
+
12
+ <%= link_to 'Show', noodall_admin_asset_path(asset, :readonly => readonly), :class => 'show button', :title => 'View this asset' %>
13
+ <%= link_to 'Add', asset.url, :class => 'add button', :title => 'Add this asset' %>
14
+ </li>
15
+ <% end %>
16
+ </ul>
17
+ <%= will_paginate(@assets, :previous_label => 'Previous', :next_label => 'Next') %>
18
+ </div>
19
+ <div id="tags">
20
+ <h2>Tags</h2>
21
+ <ul>
22
+ <% for tag in @tags %>
23
+ <li><%= link_to "#{h( tag.name )} (#{tag.count})", :tag => tag.name %></li>
24
+ <% end -%>
25
+ </ul>
26
+ <%= link_to 'All Tags', noodall_admin_asset_tags_path(controller.action_name) %>
27
+ </div>
28
+
@@ -0,0 +1,54 @@
1
+ <%= render 'menu' %>
2
+
3
+ <%= form_for([:noodall, :admin, @asset], :html => { :multipart => true, :id => ( 'uploader' if @asset.new_record? ) } ) do |f| %>
4
+ <div id="main-form">
5
+ <%= f.error_messages %>
6
+ <%= hidden_field_tag :pending, true if params[:pending] || controller.action_name == "pending" %>
7
+ <p>
8
+ <span class="tooltip" title="Enter a title for this asset">&nbsp;</span>
9
+ <%= f.label :title %><br/>
10
+ <span class="input-wrap"><%= f.text_field :title %></span>
11
+ </p>
12
+ <p>
13
+ <span class="tooltip" title="Enter a description for this asset">&nbsp;</span>
14
+ <%= f.label :description %><br/>
15
+ <span class="input-wrap"><%= f.text_area :description %></span>
16
+ </p>
17
+ <% if @asset.video? -%>
18
+ <p>
19
+ <span class="tooltip" title="What part of the video do you want the thumbnail genreated from">&nbsp;</span>
20
+ <%= f.label :video_thumbnail_offset, "Thumbnail Offset" %><br/>
21
+ <span class="input-wrap"><%= f.select :video_thumbnail_offset, 1..100 %>%</span>
22
+ </p>
23
+ <% end -%>
24
+ <p>
25
+ <span class="tooltip" title="Choose a file for this asset">&nbsp;</span>
26
+ <%= f.label :file %><br/>
27
+ <span class="input-wrap"><%= f.file_field :file %></span>
28
+ </p>
29
+ <p>
30
+ <span class="tooltip" title="Enter some tags for this asset">&nbsp;</span>
31
+ <%= f.label :tag_list, "Tags" %><br/>
32
+ <span class="input-wrap"><%= f.text_field :tag_list %></span>
33
+ </p>
34
+
35
+ <p class="fixed-form">
36
+ <%= f.submit @asset.new_record? ? 'Create' : 'Update', :disable_with => 'Submitting...', :class => 'update' %>
37
+
38
+ <%= link_to 'Delete', noodall_admin_asset_path(@asset, :pending => true), :confirm => 'Are you sure?', :method => :delete, :class => 'delete', :title => 'Delete this asset' if params[:pending] || controller.action_name == "pending" %>
39
+ <%= link_to 'Cancel', admin_assets_type_url(@asset), :class => 'cancel' %>
40
+ </p>
41
+ </div>
42
+ <% end %>
43
+
44
+ <% unless @asset.new_record? %>
45
+ <div id="sub-form">
46
+ <div id="image">
47
+ <% if @asset.image? or @asset.video? %>
48
+ <%= image_tag( @asset.url('260x', :jpg), :alt => @asset.description, :id => "asset-#{@asset.id}" ) %>
49
+ <% else -%>
50
+ <%= link_to( @asset.file.name, @asset.url, :title => @asset.description, :id => "asset-#{@asset.id}" ) %>
51
+ <% end -%>
52
+ </div>
53
+ </div>
54
+ <% end -%>
@@ -0,0 +1,8 @@
1
+ <ul class="choices">
2
+ <%= content_tag :li, '<a>Done</a>'.html_safe, :class => 'action' if params[:mode] == 'multi' %>
3
+ <%= content_tag :li, '<a>Cancel</a>'.html_safe, :class => 'cancel' %>
4
+ <li class="upload"><%= link_to 'Upload', new_noodall_admin_asset_path(:readonly => readonly) %></li>
5
+ <%= content_tag :li, link_to( 'Images', noodall_admin_assets_path(:readonly => readonly) ), :class => 'images' if params[:allowed_types].blank? or params[:allowed_types].include?('images') %>
6
+ <%= content_tag :li, link_to( 'Documents', documents_noodall_admin_assets_path(:readonly => readonly) ), :class => 'documents' if params[:allowed_types].blank? or params[:allowed_types].include?('documents') %>
7
+ <%= content_tag :li, link_to( 'Videos', videos_noodall_admin_assets_path(:readonly => readonly) ), :class => 'videos' if params[:allowed_types].blank? or params[:allowed_types].include?('videos') %>
8
+ </ul>