forgeos_cms 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. data/LICENSE +2 -0
  2. data/README.textile +42 -0
  3. data/app/assets/images/forgeos/admin/favicon.gif +0 -0
  4. data/app/assets/javascripts/forgeos/admin/functions/forgeos_cms/carousels.js +56 -0
  5. data/app/assets/javascripts/forgeos/admin/functions/forgeos_cms/menus.js +93 -0
  6. data/app/assets/javascripts/forgeos/admin/functions/forgeos_cms/overlay.js +86 -0
  7. data/app/assets/javascripts/forgeos/admin/functions/forgeos_cms/trees.js +8 -0
  8. data/app/assets/javascripts/forgeos/admin/functions/forgeos_cms/widget_actualities.js +117 -0
  9. data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/carousels.js +131 -0
  10. data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/menus.js +294 -0
  11. data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/overlays.js +71 -0
  12. data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/trees.js +94 -0
  13. data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/widget_actualities.js +23 -0
  14. data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/widget_faq.js +13 -0
  15. data/app/assets/stylesheets/forgeos/admin/base.css.sass +2 -0
  16. data/app/assets/stylesheets/forgeos/admin/forgeos_cms/_all.css.sass +1 -0
  17. data/app/assets/stylesheets/forgeos/admin/forgeos_cms/_blocks.css.sass +220 -0
  18. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/bubble-quantity-products.png +0 -0
  19. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/check-checked.png +0 -0
  20. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/check-unchecked.png +0 -0
  21. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/context.gif +0 -0
  22. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/create.png +0 -0
  23. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/dark-blue-minus.png +0 -0
  24. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/dark-blue-plus.png +0 -0
  25. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/dot.gif +0 -0
  26. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/f.png +0 -0
  27. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/fminus.gif +0 -0
  28. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/fminus_rtl.gif +0 -0
  29. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/folder.png +0 -0
  30. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/fplus.gif +0 -0
  31. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/fplus_rtl.gif +0 -0
  32. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/lastli.gif +0 -0
  33. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/lastli_rtl.gif +0 -0
  34. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/li.gif +0 -0
  35. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/remove.png +0 -0
  36. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/rename.png +0 -0
  37. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/style.css.sass +219 -0
  38. data/app/assets/stylesheets/forgeos/jstree/themes/association_page/throbber.gif +0 -0
  39. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/brown-minus.png +0 -0
  40. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/brown-plus.png +0 -0
  41. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/bubble-quantity-products.png +0 -0
  42. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/context.gif +0 -0
  43. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/create.png +0 -0
  44. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/dot.gif +0 -0
  45. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/f.png +0 -0
  46. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/fminus.gif +0 -0
  47. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/fminus_rtl.gif +0 -0
  48. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/fplus.gif +0 -0
  49. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/fplus_rtl.gif +0 -0
  50. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/lastli.gif +0 -0
  51. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/lastli_rtl.gif +0 -0
  52. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/li.gif +0 -0
  53. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/remove.png +0 -0
  54. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/rename.png +0 -0
  55. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/style.css.sass +138 -0
  56. data/app/assets/stylesheets/forgeos/jstree/themes/block_category/throbber.gif +0 -0
  57. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/big-drag-and-drop.png +0 -0
  58. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/bubble-quantity-products.png +0 -0
  59. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/check-checked.png +0 -0
  60. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/check-unchecked.png +0 -0
  61. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/context.gif +0 -0
  62. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/create.png +0 -0
  63. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/dark-blue-minus.png +0 -0
  64. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/dark-blue-plus.png +0 -0
  65. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/dot.gif +0 -0
  66. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/drag-drop.png +0 -0
  67. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/f.png +0 -0
  68. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/fminus.gif +0 -0
  69. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/fminus_rtl.gif +0 -0
  70. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/folder.png +0 -0
  71. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/fplus.gif +0 -0
  72. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/fplus_rtl.gif +0 -0
  73. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/lastli.gif +0 -0
  74. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/lastli_rtl.gif +0 -0
  75. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/li.gif +0 -0
  76. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/remove.png +0 -0
  77. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/rename.png +0 -0
  78. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/style.css.sass +186 -0
  79. data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/throbber.gif +0 -0
  80. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/brown-minus.png +0 -0
  81. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/brown-plus.png +0 -0
  82. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/bubble-quantity-products.png +0 -0
  83. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/context.gif +0 -0
  84. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/create.png +0 -0
  85. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/dot.gif +0 -0
  86. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/f.png +0 -0
  87. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/fminus.gif +0 -0
  88. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/fminus_rtl.gif +0 -0
  89. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/fplus.gif +0 -0
  90. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/fplus_rtl.gif +0 -0
  91. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/lastli.gif +0 -0
  92. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/lastli_rtl.gif +0 -0
  93. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/li.gif +0 -0
  94. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/remove.png +0 -0
  95. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/rename.png +0 -0
  96. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/style.css.sass +138 -0
  97. data/app/assets/stylesheets/forgeos/jstree/themes/page_category/throbber.gif +0 -0
  98. data/app/controllers/actualities_controller.rb +11 -0
  99. data/app/controllers/admin/actualities_controller.rb +100 -0
  100. data/app/controllers/admin/base_controller.rb +11 -0
  101. data/app/controllers/admin/carousels_controller.rb +101 -0
  102. data/app/controllers/admin/import_controller.rb +20 -0
  103. data/app/controllers/admin/menus_controller.rb +104 -0
  104. data/app/controllers/admin/newsletters_controller.rb +110 -0
  105. data/app/controllers/admin/pages_controller.rb +169 -0
  106. data/app/controllers/admin/static_content_blocks_controller.rb +174 -0
  107. data/app/controllers/admin/statistics_controller.rb +29 -0
  108. data/app/controllers/admin/widget_actualities_controller.rb +101 -0
  109. data/app/controllers/admin/widget_faqs_controller.rb +71 -0
  110. data/app/controllers/admin/widgets_controller.rb +83 -0
  111. data/app/controllers/forgeos/application_controller.rb +21 -0
  112. data/app/controllers/newsletters_controller.rb +11 -0
  113. data/app/controllers/pages_controller.rb +24 -0
  114. data/app/controllers/search_controller.rb +7 -0
  115. data/app/helpers/application_helper.rb +43 -0
  116. data/app/helpers/menu_helper.rb +46 -0
  117. data/app/helpers/routes_helper.rb +19 -0
  118. data/app/models/actuality.rb +21 -0
  119. data/app/models/block.rb +65 -0
  120. data/app/models/block_category.rb +7 -0
  121. data/app/models/carousel.rb +14 -0
  122. data/app/models/carousel_item.rb +12 -0
  123. data/app/models/category_link.rb +2 -0
  124. data/app/models/comment.rb +6 -0
  125. data/app/models/external_link.rb +5 -0
  126. data/app/models/faq.rb +10 -0
  127. data/app/models/link_page.rb +2 -0
  128. data/app/models/menu.rb +30 -0
  129. data/app/models/menu_category.rb +7 -0
  130. data/app/models/menu_link.rb +57 -0
  131. data/app/models/newsletter.rb +5 -0
  132. data/app/models/page.rb +85 -0
  133. data/app/models/page_category.rb +11 -0
  134. data/app/models/page_col.rb +14 -0
  135. data/app/models/page_link.rb +17 -0
  136. data/app/models/page_sweeper.rb +54 -0
  137. data/app/models/static_content_block.rb +2 -0
  138. data/app/models/static_content_category.rb +2 -0
  139. data/app/models/widget.rb +2 -0
  140. data/app/models/widget_actuality.rb +19 -0
  141. data/app/models/widget_category.rb +2 -0
  142. data/app/models/widget_faq.rb +12 -0
  143. data/app/views/actualities/rss.rxml +20 -0
  144. data/app/views/admin/actualities/_form.html.haml +38 -0
  145. data/app/views/admin/actualities/_tabs.html.haml +5 -0
  146. data/app/views/admin/actualities/edit.html.haml +3 -0
  147. data/app/views/admin/actualities/index.html.haml +10 -0
  148. data/app/views/admin/actualities/index.json.erb +34 -0
  149. data/app/views/admin/actualities/new.html.haml +3 -0
  150. data/app/views/admin/blocks/_associated_pages.html.haml +33 -0
  151. data/app/views/admin/blocks/_tabs.html.haml +8 -0
  152. data/app/views/admin/carousels/_attachments_popups.html.haml +81 -0
  153. data/app/views/admin/carousels/_form.html.haml +95 -0
  154. data/app/views/admin/carousels/_form_item.html.haml +54 -0
  155. data/app/views/admin/carousels/_item.html.haml +25 -0
  156. data/app/views/admin/carousels/edit.html.haml +1 -0
  157. data/app/views/admin/carousels/new.html.haml +1 -0
  158. data/app/views/admin/carousels/show.html.haml +40 -0
  159. data/app/views/admin/categories/_block.html.haml +4 -0
  160. data/app/views/admin/categories/_list_blocks.html.haml +13 -0
  161. data/app/views/admin/categories/_list_pages.html.haml +13 -0
  162. data/app/views/admin/categories/_page.html.haml +2 -0
  163. data/app/views/admin/dashboard/index.html.haml +19 -0
  164. data/app/views/admin/menu_links/_show.html.haml +8 -0
  165. data/app/views/admin/menus/_empty_menu_link.html.haml +45 -0
  166. data/app/views/admin/menus/_form.html.haml +27 -0
  167. data/app/views/admin/menus/_form_menu_links.html.haml +60 -0
  168. data/app/views/admin/menus/_lang_switcher.html.haml +2 -0
  169. data/app/views/admin/menus/_tabs.html.haml +5 -0
  170. data/app/views/admin/menus/_types_popups.html.haml +21 -0
  171. data/app/views/admin/menus/edit.html.haml +1 -0
  172. data/app/views/admin/menus/index.html.haml +13 -0
  173. data/app/views/admin/menus/index.json.erb +31 -0
  174. data/app/views/admin/menus/new.html.haml +1 -0
  175. data/app/views/admin/menus/show.html.haml +22 -0
  176. data/app/views/admin/newsletters/_form.html.haml +19 -0
  177. data/app/views/admin/newsletters/_tabs.html.haml +3 -0
  178. data/app/views/admin/newsletters/edit.html.haml +2 -0
  179. data/app/views/admin/newsletters/index.html.haml +14 -0
  180. data/app/views/admin/newsletters/index.json.erb +22 -0
  181. data/app/views/admin/newsletters/new.html.haml +2 -0
  182. data/app/views/admin/pages/_block_popup.html.haml +18 -0
  183. data/app/views/admin/pages/_blocks.html.haml +29 -0
  184. data/app/views/admin/pages/_codes.html.haml +33 -0
  185. data/app/views/admin/pages/_form.html.haml +15 -0
  186. data/app/views/admin/pages/_general.html.haml +64 -0
  187. data/app/views/admin/pages/_seo.html.haml +31 -0
  188. data/app/views/admin/pages/_tabs.html.haml +5 -0
  189. data/app/views/admin/pages/_tabs_show.html.haml +9 -0
  190. data/app/views/admin/pages/edit.html.haml +1 -0
  191. data/app/views/admin/pages/index.html.haml +13 -0
  192. data/app/views/admin/pages/index.json.erb +37 -0
  193. data/app/views/admin/pages/new.html.haml +2 -0
  194. data/app/views/admin/pages/show.html.haml +100 -0
  195. data/app/views/admin/static_content_blocks/_form.html.haml +41 -0
  196. data/app/views/admin/static_content_blocks/edit.html.haml +1 -0
  197. data/app/views/admin/static_content_blocks/index.html.haml +16 -0
  198. data/app/views/admin/static_content_blocks/index.json.erb +28 -0
  199. data/app/views/admin/static_content_blocks/new.html.haml +1 -0
  200. data/app/views/admin/static_content_blocks/show.html.haml +23 -0
  201. data/app/views/admin/statistics/index.html.haml +57 -0
  202. data/app/views/admin/users/_tabs.html.haml +3 -0
  203. data/app/views/admin/widget_actualities/_form.html.haml +87 -0
  204. data/app/views/admin/widget_actualities/_form_item.html.haml +28 -0
  205. data/app/views/admin/widget_actualities/_item.html.haml +11 -0
  206. data/app/views/admin/widget_actualities/_tabs.html.haml +8 -0
  207. data/app/views/admin/widget_actualities/edit.html.haml +2 -0
  208. data/app/views/admin/widget_actualities/new.html.haml +2 -0
  209. data/app/views/admin/widget_actualities/show.html.haml +39 -0
  210. data/app/views/admin/widget_faqs/_form.html.haml +68 -0
  211. data/app/views/admin/widget_faqs/_tabs.html.haml +8 -0
  212. data/app/views/admin/widget_faqs/edit.html.haml +2 -0
  213. data/app/views/admin/widget_faqs/new.html.haml +2 -0
  214. data/app/views/admin/widgets/_tabs.html.haml +8 -0
  215. data/app/views/admin/widgets/index.html.haml +28 -0
  216. data/app/views/admin/widgets/index.json.erb +27 -0
  217. data/app/views/layouts/admin/_menu.html.haml +0 -0
  218. data/app/views/layouts/application.html.haml +21 -0
  219. data/app/views/pages/_linked_pages.html.haml +4 -0
  220. data/app/views/pages/_page.html.haml +15 -0
  221. data/app/views/pages/show.html.haml +9 -0
  222. data/app/views/search/index.html.haml +8 -0
  223. data/config/locales/activerecord/en.yml +48 -0
  224. data/config/locales/activerecord/fr.yml +77 -0
  225. data/config/locales/admin/actuality/en.yml +30 -0
  226. data/config/locales/admin/actuality/fr.yml +30 -0
  227. data/config/locales/admin/block/en.yml +38 -0
  228. data/config/locales/admin/block/fr.yml +38 -0
  229. data/config/locales/admin/carousel/en.yml +24 -0
  230. data/config/locales/admin/carousel/fr.yml +24 -0
  231. data/config/locales/admin/menu/en.yml +33 -0
  232. data/config/locales/admin/menu/fr.yml +38 -0
  233. data/config/locales/admin/newsletter/en.yml +30 -0
  234. data/config/locales/admin/newsletter/fr.yml +30 -0
  235. data/config/locales/admin/page/en.yml +77 -0
  236. data/config/locales/admin/page/fr.yml +77 -0
  237. data/config/locales/admin/section/en.yml +23 -0
  238. data/config/locales/admin/section/fr.yml +23 -0
  239. data/config/locales/admin/static_content_block/en.yml +43 -0
  240. data/config/locales/admin/static_content_block/fr.yml +42 -0
  241. data/config/locales/admin/widget/en.yml +34 -0
  242. data/config/locales/admin/widget/fr.yml +34 -0
  243. data/config/locales/admin/widget_actuality/en.yml +23 -0
  244. data/config/locales/admin/widget_actuality/fr.yml +23 -0
  245. data/config/locales/admin/widget_faq/en.yml +22 -0
  246. data/config/locales/admin/widget_faq/fr.yml +30 -0
  247. data/config/locales/common/en.yml +208 -0
  248. data/config/locales/common/fr.yml +209 -0
  249. data/config/routes.rb +73 -0
  250. data/db/fixtures/menu_link_translations.yml +5 -0
  251. data/db/fixtures/menu_links.yml +5 -0
  252. data/db/fixtures/menus.yml +3 -0
  253. data/db/fixtures/page_translations.yml +19 -0
  254. data/db/fixtures/pages.yml +5 -0
  255. data/db/fixtures/people.yml +11 -0
  256. data/db/migrate/20091009134405_create_actualities.rb +18 -0
  257. data/db/migrate/20091009134503_create_blocks.rb +15 -0
  258. data/db/migrate/20091009134510_create_blocks_pages.rb +13 -0
  259. data/db/migrate/20091009134518_create_carousel_items.rb +17 -0
  260. data/db/migrate/20091009134729_create_pages.rb +18 -0
  261. data/db/migrate/20091009134736_create_pages_links.rb +12 -0
  262. data/db/migrate/20091027153116_create_menus.rb +14 -0
  263. data/db/migrate/20091027153659_create_menu_links.rb +19 -0
  264. data/db/migrate/20091208113459_create_page_translations.rb +9 -0
  265. data/db/migrate/20091208113460_create_block_translations.rb +9 -0
  266. data/db/migrate/20091208113461_create_menu_link_translations.rb +9 -0
  267. data/db/migrate/20091208170256_remove_translations_to_page.rb +10 -0
  268. data/db/migrate/20091208170257_remove_translations_to_block.rb +9 -0
  269. data/db/migrate/20091208170258_remove_translations_to_menu_link.rb +9 -0
  270. data/db/migrate/20100203102853_add_actuality_translations.rb +9 -0
  271. data/db/migrate/20100203102914_add_carousel_item_translations.rb +9 -0
  272. data/db/migrate/20100203125804_remove_translated_columns_to_actualities.rb +9 -0
  273. data/db/migrate/20100203125820_remove_translated_columns_to_carousel_items.rb +10 -0
  274. data/db/migrate/20100405095844_create_page_cols_table.rb +12 -0
  275. data/db/migrate/20100405101416_create_blocks_page_cols.rb +13 -0
  276. data/db/migrate/20100407093551_create_table_translation_for_page_cols.rb +13 -0
  277. data/db/migrate/20100413134832_add_index_on_menu_links.rb +11 -0
  278. data/db/migrate/20100501150819_add_code_to_pages.rb +13 -0
  279. data/db/migrate/20100511161012_create_faqs.rb +13 -0
  280. data/db/migrate/20100526163534_add_popup_to_menu_link.rb +9 -0
  281. data/db/migrate/20100929183346_change_answer_type.rb +9 -0
  282. data/db/migrate/20101015095242_update_actualities.rb +11 -0
  283. data/db/migrate/20101216155044_create_newsletter.rb +12 -0
  284. data/db/migrate/20110310092311_add_indexes_to_menu.rb +9 -0
  285. data/db/migrate/20110408133955_add_summary_to_menu_link_translations.rb +7 -0
  286. data/lib/forgeos/admin_menu.rb +14 -0
  287. data/lib/forgeos/cms.rb +8 -0
  288. data/lib/forgeos/cms/engine.rb +8 -0
  289. data/lib/forgeos/cms/statistics.rb +16 -0
  290. data/lib/forgeos_cms.rb +3 -0
  291. data/lib/tasks/install.rake +9 -0
  292. data/lib/tasks/upgrade.rake +22 -0
  293. data/recipes/deploy.rb +14 -0
  294. metadata +375 -0
@@ -0,0 +1,294 @@
1
+ jQuery(document).ready(function(){
2
+ // Add root menu link
3
+ jQuery('.button-menu-link').live('click',function(){
4
+ var menu = jQuery('#menu-tree').children('ul');
5
+ var new_menu_link = '<li class="file last closed">';
6
+ new_menu_link += jQuery('#empty_menu_link').html().replace(/EMPTY_ID/g, false_id).replace(/EMPTY_NAME/g, false_id);
7
+ new_menu_link += '</li>';
8
+
9
+ jQuery(menu).append(new_menu_link);
10
+ update_menu_positions(menu);
11
+
12
+ false_id--;
13
+ return false;
14
+ });
15
+
16
+ // Add sub menu link
17
+ jQuery('.tree-menu-tree li .menu_link .action-links .add-green-plus').live('click',function(){
18
+ var current_menu_link = jQuery(this).parents('li:first');
19
+
20
+ // get list of the current menu_link or create one
21
+ var menu_list = jQuery(current_menu_link).children('ul');
22
+ if (menu_list.length == 0) {
23
+ jQuery(current_menu_link).append(jQuery('<ul>'));
24
+ menu_list = jQuery(current_menu_link).children('ul');
25
+ }
26
+
27
+ // get menu_link ancestors
28
+ var ancestor_ids = [];
29
+ jQuery(this).parents('li').each(function(){
30
+ var attributes = jQuery(this).find('input:first').attr('name').split('[');
31
+ var ancestor_id = attributes[attributes.length-2].replace(']','');
32
+ ancestor_ids.push(ancestor_id);
33
+ });
34
+
35
+ // constructs new menu_link id/name depending on its ancestors
36
+ var new_id = false_id;
37
+ var new_name = false_id;
38
+ if (ancestor_ids.length > 0){
39
+ ancestor_ids = ancestor_ids.reverse();
40
+ new_id = ancestor_ids.join('_children_attributes_') + '_children_attributes_' + false_id;
41
+ new_name = ancestor_ids.join('][children_attributes][') + '][children_attributes][' + false_id;
42
+ }
43
+
44
+ // create new menu link and append it to the list of the current menu_link
45
+ var new_menu_link = '<li class="file last closed">';
46
+ new_menu_link += jQuery('#empty_menu_link').html().replace(/EMPTY_ID/g, new_id).replace(/EMPTY_NAME/g, new_name);
47
+ new_menu_link += '</li>';
48
+ jQuery(menu_list).append(new_menu_link);
49
+
50
+ // update positions and open current menu_link
51
+ update_menu_positions(jQuery('#menu-tree').children('ul'));
52
+ toggle_menu_link(current_menu_link, 'open');
53
+
54
+ false_id--;
55
+ return false;
56
+ });
57
+
58
+ // Edition mode in menu link edit
59
+ jQuery('.tree-menu-tree li .menu_link .action-links .edit-link, .tree-menu-tree li .menu_link .actions .back-link, .tree-menu-tree li .menu_link .editing .save').live('click',function(){
60
+ var menu_link = jQuery(this).parents('li:first');
61
+ var link = jQuery(menu_link).find('a.tree-link:first');
62
+ var link_span = jQuery(link).find('.name');
63
+
64
+ var edition_block = jQuery(menu_link).find('.editing:first');
65
+ var edition_span = jQuery(edition_block).find('.linked-to-span');
66
+ var edition_link = jQuery(edition_span).find('a');
67
+
68
+ // toggle link and edition_block
69
+ link.toggle();
70
+ edition_block.toggle();
71
+
72
+ // on closing edition part
73
+ if (!jQuery(edition_block).is(':visible')){
74
+ var back_link = jQuery(this).hasClass('back-link');
75
+
76
+ // back-link is pressed then reset icon else update icon
77
+ if (back_link)
78
+ update_menu_span_icon(link_span, edition_span);
79
+ else
80
+ update_menu_span_icon(edition_span, link_span);
81
+
82
+ // back-link is pressed then reset attributes else update attributes
83
+ jQuery(edition_block).find('input, textarea, select').each(function(){
84
+ switch(get_rails_element_id(jQuery(this)))
85
+ {
86
+ // TODO: interactivity
87
+ case 'title':
88
+ if (back_link){
89
+ // reset title text field...
90
+ jQuery(this).val(link_span.html());
91
+
92
+ // and edition link title
93
+ if (edition_span.hasClass('external'))
94
+ // edition link url
95
+ edition_link.html(link.attr('href'));
96
+ else
97
+ // target name
98
+ edition_link.html(jQuery(edition_block).find('.linked-to').html());
99
+ }
100
+ else{
101
+ // update view link title
102
+ link_span.html(jQuery(this).val());
103
+ jQuery(edition_block).find('.linked-to').html(edition_link.html());
104
+ }
105
+ break;
106
+
107
+ case 'url':
108
+ if (back_link){
109
+ // reset url hidden field and edition link url
110
+ jQuery(this).val(link.attr('href'));
111
+ edition_link.attr('href', link.attr('href'));
112
+ }
113
+ else
114
+ // update view link url
115
+ link.attr('href', edition_link.attr('href'));
116
+ break;
117
+
118
+ case 'active':
119
+ status_span = link.find('.status');
120
+ if (back_link){
121
+ // update select
122
+ jQuery(this).val(status_span.hasClass('see-on') ? 1 : 0);
123
+ rebuild_custom_select('.select-status');
124
+ }
125
+ else {
126
+ // set visible or not
127
+ status_span.removeClass((jQuery(this).val() == '1') ? 'see-off' : 'see-on');
128
+ status_span.addClass((jQuery(this).val() == '1') ? 'see-on' : 'see-off');
129
+ }
130
+ break;
131
+ }
132
+ });
133
+ }
134
+ return false;
135
+ });
136
+
137
+ // Remove menu link
138
+ jQuery('.tree-menu-tree li .menu_link .action-links .destroy-link').live('click',function(){
139
+ var menu_link = jQuery(this).parents('li:first');
140
+
141
+ // set the menu link and all its children to deleted
142
+ jQuery(menu_link).find('.menu_link').each(function(){
143
+ jQuery(this).find('.delete').val(1);
144
+ });
145
+
146
+ // hide menu link and its children and update positions
147
+ jQuery(menu_link).children().hide();
148
+ update_menu_positions(jQuery('#menu-tree').children('ul'));
149
+
150
+ // close parent menu_link if there was only one sub menu_link
151
+ var parent_menu_link = menu_link.parents('li:first');
152
+ var sub_menu_links = parent_menu_link.find('li.open:visible, li.closed:visible');
153
+ if (sub_menu_links.length == 0)
154
+ toggle_menu_link(parent_menu_link, 'closed');
155
+
156
+ return false;
157
+ });
158
+
159
+ // Dialog to change menu link type
160
+ jQuery('#menuLinkTypeDialog').dialog({
161
+ autoOpen:false,
162
+ modal:true,
163
+ minHeight: 380,
164
+ width: 800,
165
+ resizable:'se',
166
+ buttons: {
167
+ Ok: function(){
168
+ jQuery('#fileSelectDialog').dialog('close');
169
+ }
170
+ },
171
+ open: function(e,ui){
172
+ eval(jQuery('#table-files').data('dataTables_init_function')+'()');
173
+ }
174
+ });
175
+
176
+ // Change menu link type
177
+ jQuery('.tree-menu-tree li .menu_link .editing .change-type').live('click',function(){
178
+ var edition_block = jQuery(this).parents('.editing');
179
+ var link_type = jQuery(edition_block).find('.input-type');
180
+
181
+ var title = jQuery(edition_block).find('.input-title');
182
+ var url = jQuery(edition_block).find('.input-url');
183
+ var span = jQuery(edition_block).find('.linked-to-span');
184
+ var link = jQuery(edition_block).find('.linked-to-span a');
185
+ var target_id = jQuery(edition_block).find('.input-target-id');
186
+ var target_type = jQuery(edition_block).find('.input-target-type');
187
+ var overlay_url = jQuery('#overlay-url');
188
+
189
+ // on open - show overlay and hide other overlays
190
+ jQuery('#menuLinkTypeDialog').bind('dialogopen', function(event, ui) {
191
+ var overlay_tab;
192
+ var overlay_type = 'target-link';
193
+
194
+ switch(link_type.val())
195
+ {
196
+ case 'PageLink':
197
+ overlay_tab = 'page';
198
+ update_current_dataTable_source('#table-files','/admin/pages.json?mode=menu_link');
199
+ break;
200
+
201
+ case 'ProductLink':
202
+ overlay_tab = 'product';
203
+ update_current_dataTable_source('#table-files','/admin/products.json?mode=menu_link');
204
+ break;
205
+
206
+ case 'CategoryLink':
207
+ overlay_tab = 'category';
208
+ update_current_dataTable_source('#table-files',"/admin/categories.json?mode=menu_link&types[]=page&types[]=product");
209
+ break;
210
+
211
+ default:
212
+ overlay_tab = 'external';
213
+ overlay_type = 'external-link';
214
+ // set overlay input value
215
+ overlay_url.val(url.val());
216
+ }
217
+
218
+ toggleSelectedOverlay('#inner-lightbox.backgrounds .' + overlay_tab);
219
+ toggle_menu_types_overlays(overlay_type);
220
+ });
221
+
222
+ // on OK button pressed - update link, hidden fields and close dialog
223
+ jQuery('#menuLinkTypeDialog').dialog('option', 'buttons', {
224
+ "Ok": function(){
225
+ var current_tab = jQuery('#inner-lightbox.backgrounds .selected');
226
+
227
+ span.removeClass('external page product category');
228
+
229
+ if (current_tab.hasClass('external')){
230
+ update_menu_link(title, span, link, url, link_type, target_id, target_type, {
231
+ 'title': title.val(),
232
+ 'type': 'external',
233
+ 'link_name': overlay_url.val(),
234
+ 'link_url': overlay_url.val(),
235
+ 'hidden_url': overlay_url.val(),
236
+ 'hidden_type': 'ExternalLink',
237
+ 'hidden_target_id': '',
238
+ 'hidden_target_type': ''
239
+ }
240
+ );
241
+ }
242
+ else{
243
+ dataTableSelectRows('#table-files:visible',function(current_table,indexes){
244
+ var row = current_table.fnGetData(indexes[0]);
245
+ var id = row.slice(-2,-1)[0];
246
+ var name = row.slice(-3,-2)[0];
247
+ var target = row.slice(-1)[0];
248
+
249
+ var type;
250
+ if (current_tab.hasClass('page'))
251
+ type = 'page';
252
+ else if (current_tab.hasClass('product'))
253
+ type = 'product';
254
+ else if (current_tab.hasClass('category'))
255
+ type = 'category';
256
+
257
+ update_menu_link(title, span, link, url, link_type, target_id, target_type, {
258
+ 'title': jQuery(name).html(),
259
+ 'type': type,
260
+ 'link_name': jQuery(name).html(),
261
+ 'link_url': jQuery(target).attr('href'),
262
+ 'hidden_url': '',
263
+ 'hidden_type': capitalize(type)+'Link',
264
+ 'hidden_target_id': id,
265
+ 'hidden_target_type': capitalize(type)
266
+ }
267
+ );
268
+ });
269
+ }
270
+
271
+ jQuery(this).dialog("close");
272
+ }
273
+ });
274
+
275
+ // on close - reset overlay url input text field
276
+ jQuery('#menuLinkTypeDialog').bind('dialogbeforeclose', function(event, ui) {
277
+ overlay_url.val('');
278
+ });
279
+
280
+ jQuery('#menuLinkTypeDialog').dialog('open');
281
+ return false;
282
+ });
283
+
284
+ //add hover on menu list elments
285
+ jQuery('.tree-menu-tree').find('li').live('mouseover',function(){
286
+ jQuery('.action-links').hide();
287
+ jQuery(this).find('.action-links:first').show();
288
+
289
+ });
290
+
291
+ jQuery('.tree-menu-tree').find('li').live('mouseout',function(){
292
+ jQuery('.action-links').hide();
293
+ });
294
+ });
@@ -0,0 +1,71 @@
1
+ jQuery(document).ready(function(){
2
+ /*
3
+ *Add click function on a.page-link items
4
+ *Those items are links that shows dialogBox to add a page to blocks
5
+ **/
6
+ jQuery('a.page-link').live('click',function(){
7
+ openPageDialog(jQuery(this));
8
+ return false;
9
+ });
10
+
11
+ /*
12
+ *Add click function on .small-icons.page items
13
+ *Those items are li in page tree (in dialog box)
14
+ * sends ajax request to link a page with a block
15
+ * add the new linked page in pages list
16
+ *and close the dialogg box
17
+ **/
18
+ jQuery('.link-page.small-icons.page').bind('click',function(){
19
+ if(!jQuery(this).hasClass('active')){
20
+ var url = jQuery(this).attr('href');
21
+ var block_id = url.split('/')[5];
22
+ var page_id = jQuery(this).parent().attr('id').substr(5);
23
+ jQuery.ajax({
24
+ url: url,
25
+ complete: putInPageList(jQuery(this).text(), jQuery(this).attr('title'), block_id, page_id),
26
+ data: 'authenticity_token=' + encodeURIComponent(window._forgeos_js_vars.token),
27
+ dataType:'script',
28
+ type:'post'
29
+ });
30
+ closeDialogBox();
31
+ }
32
+ return false;
33
+ });
34
+
35
+ /*
36
+ *Add click function on .static-tab,.widget-tab items
37
+ *Those items are headers links in blocks/widget dialog box
38
+ *that display the widgets or blocks trees
39
+ **/
40
+ jQuery('.static-tab,.widget-tab').bind('click',function(){
41
+ toggleHoverlayTrees(jQuery(this).attr('class'));
42
+ return false;
43
+ });
44
+
45
+ jQuery('.lightbox-actuality').dialog({
46
+ autoOpen:false,
47
+ modal:true,
48
+ minHeight: 400,
49
+ width: 950,
50
+ open: function(){ tmce_load_children('#form_actuality'); },
51
+ beforeclose: function(){ tmce_unload_children('#form_actuality'); },
52
+ resizable: 'se'
53
+ });
54
+
55
+ jQuery('.add-actuality').live('click',function(){
56
+ empty_actuality_overlay_fields();
57
+ tmce_unload_children('#form_actuality');
58
+ jQuery('.lightbox-actuality').dialog('open');
59
+ jQuery('#submit_actuality').addClass('create-actuality');
60
+ jQuery('#submit_actuality').removeClass('update-actuality');
61
+ return false;
62
+ });
63
+
64
+ jQuery('.edit-actuality').live('click',function(){
65
+ tmce_unload_children('#form_actuality');
66
+ jQuery('.lightbox-actuality').dialog('open');
67
+ jQuery('#submit_actuality').removeClass('create-actuality');
68
+ jQuery('#submit_actuality').addClass('update-actuality');
69
+ return false;
70
+ });
71
+ });
@@ -0,0 +1,94 @@
1
+ jQuery(document).ready(function(){
2
+ //init the tree for pages, blocks, widgets
3
+ jQuery("#page-tree").tree({
4
+ ui: {
5
+ theme_path: '/stylesheets/jstree/themes/',
6
+ theme_name : 'product_category',
7
+ selected_parent_close: false
8
+ },
9
+ callback: {
10
+ onload: function(TREE_OBJ){
11
+ tree_id = jQuery(TREE_OBJ.container).attr('id');
12
+ jQuery(TREE_OBJ.container).removeClass('tree-default');
13
+ }
14
+ }
15
+ });
16
+
17
+ // init the category tress
18
+ init_category_tree("#page-tree",'PageCategory','/admin/page_categories.json');
19
+ init_category_tree("#block-tree",'StaticContentCategory','/admin/static_content_categories.json');
20
+ init_category_tree("#widget-tree",'WidgetCategory','/admin/widget_categories.json');
21
+
22
+ // init the tress for category associations
23
+ init_association_block_category_tree('#association-static-content-tree', 'static_content_block');
24
+ init_association_block_category_tree('#association-carousel-tree', 'carousel');
25
+ init_association_block_category_tree('#association-widget-actuality-tree', 'widget_actuality');
26
+ init_association_block_category_tree('#association-widget-faq-tree', 'widget_faq');
27
+
28
+ // init the trees for page associations
29
+ init_association_page_tree('#association-static-content-page-tree', 'static_content_block');
30
+ init_association_page_tree('#association-carousel-page-tree', 'carousel');
31
+ init_association_page_tree('#association-widget-actuality-page-tree', 'widget_actuality');
32
+ init_association_page_tree('#association-widget-faq-page-tree', 'widget_faq');
33
+
34
+ //init the tree of blocks
35
+ jQuery('.blocks-tree').tree({
36
+ ui: {
37
+ theme_path: '/stylesheets/jstree/themes/',
38
+ theme_name : 'block_category',
39
+ selected_parent_close: false
40
+ },
41
+ callback: {
42
+ onload: function(TREE_OBJ){
43
+ tree_id = jQuery(TREE_OBJ.container).attr('id');
44
+ jQuery(TREE_OBJ.container).removeClass('tree-default');
45
+ },
46
+ onselect: function(NODE,TREE_OBJ){
47
+ /*
48
+ *Add click function on .small-icons.block items
49
+ *Those items are li in blocks/widget tree (in dialog box)
50
+ *and close the dialogg box
51
+ **/
52
+ var link = jQuery(NODE).find('a:first');
53
+ if(!link.hasClass('active')){
54
+ putInBlockList(link.attr('title'), link.text(), jQuery(NODE).attr('id').substr(6));
55
+ closeDialogBox();
56
+ jQuery('.selectedPageCol').removeClass('selectedPageCol');
57
+ }
58
+ return false;
59
+ }
60
+ }
61
+ });
62
+
63
+ //init the tree of pages
64
+ jQuery(".pages-tree").tree({
65
+ ui: {
66
+ theme_path: '/stylesheets/jstree/themes/',
67
+ theme_name : 'page_category',
68
+ selected_parent_close: false
69
+ },
70
+ callback: {
71
+ onload: function(TREE_OBJ){
72
+ tree_id = jQuery(TREE_OBJ.container).attr('id');
73
+ jQuery(TREE_OBJ.container).removeClass('tree-default');
74
+ },
75
+ onselect: function(NODE,TREE_OBJ){
76
+ var link = jQuery(NODE).children('a');
77
+ if(!link.hasClass('active')){
78
+ var url = jQuery(link).attr('href');
79
+ var block_id = url.split('/')[5];
80
+ var page_id = get_rails_element_id(NODE);
81
+ jQuery.ajax({
82
+ url: url,
83
+ complete: putInPageList(jQuery(link).text(), jQuery(link).attr('title'), block_id, page_id),
84
+ data: 'authenticity_token=' + encodeURIComponent(window._forgeos_js_vars.token),
85
+ dataType:'text',
86
+ type:'post'
87
+ });
88
+ closeDialogBox();
89
+ }
90
+ return false;
91
+ }
92
+ }
93
+ });
94
+ });