dust-cms 0.0.05

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +3 -0
  3. data/Rakefile +5 -0
  4. data/app/assets/images/admin/blank.png +0 -0
  5. data/app/assets/images/admin/dust-letterpress.png +0 -0
  6. data/app/assets/images/admin/main-back.png +0 -0
  7. data/app/assets/images/admin/ui/delete-icon.png +0 -0
  8. data/app/assets/images/admin/ui/edit-icon.png +0 -0
  9. data/app/assets/images/admin/ui/handle.png +0 -0
  10. data/app/assets/images/admin/ui/icons.png +0 -0
  11. data/app/assets/images/admin/ui/index-icon.png +0 -0
  12. data/app/assets/images/admin/ui/new-icon.png +0 -0
  13. data/app/assets/images/entypo/entypo.eot +0 -0
  14. data/app/assets/images/entypo/entypo.svg +13 -0
  15. data/app/assets/images/entypo/entypo.ttf +0 -0
  16. data/app/assets/images/entypo/entypo.woff +0 -0
  17. data/app/assets/images/entypo-social/entypo-social.eot +0 -0
  18. data/app/assets/images/entypo-social/entypo-social.svg +13 -0
  19. data/app/assets/images/entypo-social/entypo-social.ttf +0 -0
  20. data/app/assets/images/entypo-social/entypo-social.woff +0 -0
  21. data/app/assets/images/fancybox/blank.gif +0 -0
  22. data/app/assets/images/fancybox/fancy_close.png +0 -0
  23. data/app/assets/images/fancybox/fancy_loading.png +0 -0
  24. data/app/assets/images/fancybox/fancy_nav_left.png +0 -0
  25. data/app/assets/images/fancybox/fancy_nav_right.png +0 -0
  26. data/app/assets/images/fancybox/fancy_shadow_e.png +0 -0
  27. data/app/assets/images/fancybox/fancy_shadow_n.png +0 -0
  28. data/app/assets/images/fancybox/fancy_shadow_ne.png +0 -0
  29. data/app/assets/images/fancybox/fancy_shadow_nw.png +0 -0
  30. data/app/assets/images/fancybox/fancy_shadow_s.png +0 -0
  31. data/app/assets/images/fancybox/fancy_shadow_se.png +0 -0
  32. data/app/assets/images/fancybox/fancy_shadow_sw.png +0 -0
  33. data/app/assets/images/fancybox/fancy_shadow_w.png +0 -0
  34. data/app/assets/images/fancybox/fancy_title_left.png +0 -0
  35. data/app/assets/images/fancybox/fancy_title_main.png +0 -0
  36. data/app/assets/images/fancybox/fancy_title_over.png +0 -0
  37. data/app/assets/images/fancybox/fancy_title_right.png +0 -0
  38. data/app/assets/images/fancybox/fancybox-x.png +0 -0
  39. data/app/assets/images/fancybox/fancybox-y.png +0 -0
  40. data/app/assets/images/fancybox/fancybox.png +0 -0
  41. data/app/assets/javascripts/cms/dust/defaults.js.coffee +31 -0
  42. data/app/assets/javascripts/cms/dust/gallery/photo.js.coffee +1 -0
  43. data/app/assets/javascripts/cms/dust/gallery/photo_view.js.coffee +21 -0
  44. data/app/assets/javascripts/cms/dust/gallery/photos.js.coffee +6 -0
  45. data/app/assets/javascripts/cms/dust/gallery/photos_view.js.coffee +12 -0
  46. data/app/assets/javascripts/cms/dust/gallery/router.js.coffee +14 -0
  47. data/app/assets/javascripts/cms/dust/gallery.js.coffee +31 -0
  48. data/app/assets/javascripts/cms/dust/nav.js.coffee +21 -0
  49. data/app/assets/javascripts/cms/dust/sections.js.coffee +21 -0
  50. data/app/assets/javascripts/cms/dust/sortables.js.coffee +64 -0
  51. data/app/assets/javascripts/cms/dust/window.js.coffee +11 -0
  52. data/app/assets/javascripts/cms/dust.js.coffee +19 -0
  53. data/app/assets/javascripts/cms/lib/backbone.js +42 -0
  54. data/app/assets/javascripts/cms/lib/fineuploader-3.0.js +71 -0
  55. data/app/assets/javascripts/cms/lib/handlebars.js +1920 -0
  56. data/app/assets/javascripts/cms/lib/spin.js +2 -0
  57. data/app/assets/javascripts/cms/lib/underscore.js +1 -0
  58. data/app/assets/javascripts/cms.js +14 -0
  59. data/app/assets/javascripts/core/jquery.form.js +785 -0
  60. data/app/assets/javascripts/core/jquery.html5.js +29 -0
  61. data/app/assets/javascripts/core/jquery.mousewheel-3.0.2.pack.js +13 -0
  62. data/app/assets/javascripts/core/jquery.placeholder.min.js +11 -0
  63. data/app/assets/javascripts/core/nestedsortables.js +429 -0
  64. data/app/assets/javascripts/core/serializelist.js +66 -0
  65. data/app/assets/javascripts/core/tipTip.js +21 -0
  66. data/app/assets/javascripts/core.js +4 -0
  67. data/app/assets/javascripts/front_end/application-main.js.coffee +27 -0
  68. data/app/assets/javascripts/front_end/map.js +34 -0
  69. data/app/assets/javascripts/front_end/video.js +4569 -0
  70. data/app/assets/javascripts/front_end.js +18 -0
  71. data/app/assets/stylesheets/cms/flash_messages.css.scss +17 -0
  72. data/app/assets/stylesheets/cms/footer.css.scss +12 -0
  73. data/app/assets/stylesheets/cms/forms.css.scss +67 -0
  74. data/app/assets/stylesheets/cms/gallery.css.scss +21 -0
  75. data/app/assets/stylesheets/cms/icons.css.scss +123 -0
  76. data/app/assets/stylesheets/cms/jquery-ui.custom.scss +6 -0
  77. data/app/assets/stylesheets/cms/layout.css.scss +162 -0
  78. data/app/assets/stylesheets/cms/lib/grid.css.scss +116 -0
  79. data/app/assets/stylesheets/cms/lib/mixins.css.scss +20 -0
  80. data/app/assets/stylesheets/cms/login.scss +12 -0
  81. data/app/assets/stylesheets/cms/main.old +155 -0
  82. data/app/assets/stylesheets/cms/nav.css.scss +73 -0
  83. data/app/assets/stylesheets/cms/sections.scss +17 -0
  84. data/app/assets/stylesheets/cms/sortables.scss +20 -0
  85. data/app/assets/stylesheets/cms.css.scss +30 -0
  86. data/app/assets/stylesheets/core/app/defaults.css.scss +556 -0
  87. data/app/assets/stylesheets/core/plugins/PIE.htc +96 -0
  88. data/app/assets/stylesheets/core/plugins/jquery-ui-1.8.5.custom.old +572 -0
  89. data/app/assets/stylesheets/core/plugins/jquery.fancybox-1.3.1.css +364 -0
  90. data/app/assets/stylesheets/core/plugins/skeleton.css +155 -0
  91. data/app/assets/stylesheets/core/plugins/tipTip.css +115 -0
  92. data/app/assets/stylesheets/core/plugins/uploadify.css +25 -0
  93. data/app/assets/stylesheets/core/reset/reset.css +211 -0
  94. data/app/assets/stylesheets/core/reset/text.css +86 -0
  95. data/app/assets/stylesheets/core.css.scss +14 -0
  96. data/app/assets/stylesheets/front_end/app/just-delete-me-and-start-over.css.scss +70 -0
  97. data/app/assets/stylesheets/front_end.css +14 -0
  98. data/app/controllers/authentication_controller.rb +30 -0
  99. data/app/controllers/dust/blocks_controller.rb +49 -0
  100. data/app/controllers/dust/contacts_controller.rb +89 -0
  101. data/app/controllers/dust/dashboard_controller.rb +26 -0
  102. data/app/controllers/dust/gallery/albums_controller.rb +49 -0
  103. data/app/controllers/dust/gallery/api/photos_controller.rb +28 -0
  104. data/app/controllers/dust/gallery/photos_controller.rb +47 -0
  105. data/app/controllers/dust/menu_items_controller.rb +51 -0
  106. data/app/controllers/dust/menus_controller.rb +47 -0
  107. data/app/controllers/dust/pages_controller.rb +52 -0
  108. data/app/controllers/dust/password_resets_controller.rb +48 -0
  109. data/app/controllers/dust/posts_controller.rb +47 -0
  110. data/app/controllers/dust/roles_controller.rb +47 -0
  111. data/app/controllers/dust/sessions_controller.rb +29 -0
  112. data/app/controllers/dust/site_wides_controller.rb +28 -0
  113. data/app/controllers/dust/sortable_controller.rb +17 -0
  114. data/app/controllers/dust/users_controller.rb +52 -0
  115. data/app/controllers/front_end/page_controller.rb +27 -0
  116. data/app/controllers/front_end/post_controller.rb +14 -0
  117. data/app/controllers/front_end/sitemap_controller.rb +11 -0
  118. data/app/controllers/front_end_controller.rb +18 -0
  119. data/app/helpers/error_messages_helper.rb +23 -0
  120. data/app/helpers/exceptions.rb +4 -0
  121. data/app/helpers/layout_helper.rb +28 -0
  122. data/app/helpers/misc_helper.rb +29 -0
  123. data/app/helpers/region_helper.rb +32 -0
  124. data/app/mailers/post_office.rb +39 -0
  125. data/app/models/ckeditor/asset.rb +7 -0
  126. data/app/models/ckeditor/attachment_file.rb +7 -0
  127. data/app/models/ckeditor/picture.rb +7 -0
  128. data/app/models/dust/block.rb +114 -0
  129. data/app/models/dust/builder/page.rb +84 -0
  130. data/app/models/dust/builder/site_wide.rb +50 -0
  131. data/app/models/dust/contact.rb +34 -0
  132. data/app/models/dust/gallery/album.rb +14 -0
  133. data/app/models/dust/gallery/photo.rb +23 -0
  134. data/app/models/dust/handlebar.rb +59 -0
  135. data/app/models/dust/map.rb +21 -0
  136. data/app/models/dust/menu/item_dependency.rb +66 -0
  137. data/app/models/dust/menu.rb +11 -0
  138. data/app/models/dust/menu_item.rb +64 -0
  139. data/app/models/dust/page.rb +52 -0
  140. data/app/models/dust/post.rb +39 -0
  141. data/app/models/dust/role.rb +9 -0
  142. data/app/models/dust/section.rb +11 -0
  143. data/app/models/dust/session.rb +28 -0
  144. data/app/models/dust/site_wide.rb +41 -0
  145. data/app/models/dust/sort.rb +52 -0
  146. data/app/models/dust/sortable_item.rb +21 -0
  147. data/app/models/dust/user.rb +49 -0
  148. data/app/uploaders/ckeditor_attachment_file_uploader.rb +42 -0
  149. data/app/uploaders/ckeditor_picture_uploader.rb +53 -0
  150. data/app/uploaders/gallery_photo_uploader.rb +52 -0
  151. data/app/uploaders/image_uploader.rb +51 -0
  152. data/app/uploaders/slide_image_uploader.rb +51 -0
  153. data/app/views/dust/blocks/_block.html.haml +20 -0
  154. data/app/views/dust/blocks/_form.html.haml +50 -0
  155. data/app/views/dust/blocks/_normal_block_content.html.haml +1 -0
  156. data/app/views/dust/blocks/_search.html.haml +4 -0
  157. data/app/views/dust/blocks/edit.html.haml +4 -0
  158. data/app/views/dust/blocks/index.html.haml +16 -0
  159. data/app/views/dust/blocks/new.html.haml +3 -0
  160. data/app/views/dust/contacts/_form.html.haml +37 -0
  161. data/app/views/dust/contacts/_import_csv.html.haml +8 -0
  162. data/app/views/dust/contacts/_instance.html.haml +13 -0
  163. data/app/views/dust/contacts/_search.html.haml +4 -0
  164. data/app/views/dust/contacts/edit.html.haml +2 -0
  165. data/app/views/dust/contacts/index.html.haml +17 -0
  166. data/app/views/dust/contacts/index.json.haml +6 -0
  167. data/app/views/dust/contacts/new.html.haml +3 -0
  168. data/app/views/dust/dashboard/_options.html.haml +6 -0
  169. data/app/views/dust/dashboard/show.html.haml +33 -0
  170. data/app/views/dust/dashboard/update.html.haml +6 -0
  171. data/app/views/dust/gallery/albums/_form.html.haml +52 -0
  172. data/app/views/dust/gallery/albums/_photo.html.haml +12 -0
  173. data/app/views/dust/gallery/albums/edit.html.haml +3 -0
  174. data/app/views/dust/gallery/albums/index.html.haml +18 -0
  175. data/app/views/dust/gallery/albums/new.html.haml +4 -0
  176. data/app/views/dust/gallery/albums/show.html.haml +2 -0
  177. data/app/views/dust/gallery/photos/_form.html.haml +26 -0
  178. data/app/views/dust/gallery/photos/edit.html.haml +3 -0
  179. data/app/views/dust/gallery/photos/index.html.haml +18 -0
  180. data/app/views/dust/gallery/photos/new.html.haml +4 -0
  181. data/app/views/dust/gallery/photos/show.json.jbuilder +5 -0
  182. data/app/views/dust/menu_items/_form.html.haml +24 -0
  183. data/app/views/dust/menu_items/_roots.html.haml +3 -0
  184. data/app/views/dust/menu_items/_search.html.haml +4 -0
  185. data/app/views/dust/menu_items/_tree.html.haml +11 -0
  186. data/app/views/dust/menu_items/edit.html.haml +2 -0
  187. data/app/views/dust/menu_items/index.html.haml +19 -0
  188. data/app/views/dust/menu_items/new.html.haml +2 -0
  189. data/app/views/dust/menus/_form.html.haml +39 -0
  190. data/app/views/dust/menus/edit.html.haml +3 -0
  191. data/app/views/dust/menus/index.html.haml +18 -0
  192. data/app/views/dust/menus/new.html.haml +4 -0
  193. data/app/views/dust/menus/show.html.haml +2 -0
  194. data/app/views/dust/pages/_form.html.haml +68 -0
  195. data/app/views/dust/pages/_search.html.haml +4 -0
  196. data/app/views/dust/pages/edit.html.haml +3 -0
  197. data/app/views/dust/pages/index.html.haml +16 -0
  198. data/app/views/dust/pages/new.html.haml +3 -0
  199. data/app/views/dust/password_resets/edit.html.haml +6 -0
  200. data/app/views/dust/password_resets/new.html.haml +10 -0
  201. data/app/views/dust/posts/_form.html.haml +39 -0
  202. data/app/views/dust/posts/edit.html.haml +3 -0
  203. data/app/views/dust/posts/index.html.haml +18 -0
  204. data/app/views/dust/posts/new.html.haml +4 -0
  205. data/app/views/dust/posts/show.html.haml +2 -0
  206. data/app/views/dust/roles/_form.html.haml +11 -0
  207. data/app/views/dust/roles/edit.html.haml +2 -0
  208. data/app/views/dust/roles/index.html.haml +14 -0
  209. data/app/views/dust/roles/new.html.haml +2 -0
  210. data/app/views/dust/sessions/_form.html.haml +18 -0
  211. data/app/views/dust/sessions/new.html.haml +2 -0
  212. data/app/views/dust/site_wides/new.html.haml +19 -0
  213. data/app/views/dust/slides/_form.html.haml +26 -0
  214. data/app/views/dust/slides/_search.html.haml +4 -0
  215. data/app/views/dust/slides/_slideshow.html.haml +12 -0
  216. data/app/views/dust/slides/edit.html.haml +5 -0
  217. data/app/views/dust/slides/index.html.haml +25 -0
  218. data/app/views/dust/slides/index.js.haml +2 -0
  219. data/app/views/dust/slides/new.html.haml +6 -0
  220. data/app/views/dust/slides/show.html.haml +15 -0
  221. data/app/views/dust/sortable/sort.js.coffee +10 -0
  222. data/app/views/dust/users/_form.html.haml +27 -0
  223. data/app/views/dust/users/_search.html.haml +4 -0
  224. data/app/views/dust/users/_user_bar.html.haml +10 -0
  225. data/app/views/dust/users/dashboard.html.haml +40 -0
  226. data/app/views/dust/users/edit.html.haml +2 -0
  227. data/app/views/dust/users/index.html.haml +16 -0
  228. data/app/views/dust/users/new.html.haml +2 -0
  229. data/app/views/front_end/page/_admin.html.haml +6 -0
  230. data/app/views/front_end/page/search.html.haml +9 -0
  231. data/app/views/front_end/page/show.html.haml +8 -0
  232. data/app/views/front_end/post/_admin.html.haml +7 -0
  233. data/app/views/front_end/post/show.html.haml +12 -0
  234. data/app/views/front_end/sitemap/index.html.haml +4 -0
  235. data/app/views/front_end/sitemap/index.xml.haml +9 -0
  236. data/app/views/layouts/app_partials/_analytics.html.haml +11 -0
  237. data/app/views/layouts/app_partials/_application_tree.html.haml +6 -0
  238. data/app/views/layouts/cms.html.haml +52 -0
  239. data/app/views/layouts/cms_partials/_nav.html.haml +5 -0
  240. data/app/views/layouts/front_end.html.haml +22 -0
  241. data/app/views/layouts/sessions.html.haml +19 -0
  242. data/app/views/post_office/contact_confirmation.html.haml +7 -0
  243. data/app/views/post_office/contact_request.html.haml +24 -0
  244. data/app/views/post_office/password_reset_instructions.html.haml +6 -0
  245. data/app/views/widgets/_contact_form.html.haml +20 -0
  246. data/app/views/widgets/_map.html.haml +16 -0
  247. data/app/views/widgets/_quick_contact_form.html.haml +10 -0
  248. data/app/views/widgets/_site_map.html.haml +7 -0
  249. data/app/views/widgets/_site_menu.html.haml +10 -0
  250. data/app/views/widgets/_slider.html.haml +0 -0
  251. data/app/views/widgets/_user_login.html.haml +13 -0
  252. data/app/views/widgets/galleries/_archive.html.haml +1 -0
  253. data/app/views/widgets/galleries/_show.html.haml +0 -0
  254. data/app/views/widgets/posts/_index.html.haml +1 -0
  255. data/app/views/widgets/posts/_show.html.haml +0 -0
  256. data/config/authorization_rules.rb +23 -0
  257. data/config/generators/templates/haml/scaffold/_form.html.haml +19 -0
  258. data/config/generators/templates/haml/scaffold/edit.html.haml +3 -0
  259. data/config/generators/templates/haml/scaffold/index.html.haml +18 -0
  260. data/config/generators/templates/haml/scaffold/new.html.haml +4 -0
  261. data/config/generators/templates/haml/scaffold/show.html.haml +2 -0
  262. data/config/generators/templates/rails/scaffold_controller/controller.rb +51 -0
  263. data/config/initializers/app_string_io.rb +12 -0
  264. data/config/initializers/ckeditor.rb +18 -0
  265. data/config/initializers/client_side_validations.rb +13 -0
  266. data/config/initializers/dust_config.rb +22 -0
  267. data/config/initializers/dust_core_reloader.rb +11 -0
  268. data/config/initializers/sorcery.rb +398 -0
  269. data/config/initializers/wrap_parameters.rb +14 -0
  270. data/config/routes.rb +55 -0
  271. data/db/migrate/20101206025845_create_roles.rb +11 -0
  272. data/db/migrate/20110217212357_create_ckeditor_assets.rb +31 -0
  273. data/db/migrate/20110218000640_create_pages.rb +15 -0
  274. data/db/migrate/20110218000641_create_sections.rb +15 -0
  275. data/db/migrate/20110218002220_create_contacts.rb +22 -0
  276. data/db/migrate/20110218020608_create_menu_items.rb +21 -0
  277. data/db/migrate/20110507014158_create_blocks.rb +23 -0
  278. data/db/migrate/20121106195938_sorcery_core.rb +17 -0
  279. data/db/migrate/20121106195939_sorcery_remember_me.rb +15 -0
  280. data/db/migrate/20121106195940_sorcery_reset_password.rb +17 -0
  281. data/db/migrate/20121106195941_sorcery_activity_logging.rb +17 -0
  282. data/db/migrate/20121106200754_sorcery_user_activation.rb +17 -0
  283. data/db/migrate/20130220044031_create_site_wides.rb +11 -0
  284. data/db/migrate/20130220051658_create_menus.rb +11 -0
  285. data/db/migrate/20130223030136_create_albums.rb +13 -0
  286. data/db/migrate/20130223040911_create_photos.rb +15 -0
  287. data/db/migrate/20130223044553_create_posts.rb +15 -0
  288. data/lib/dust/engine.rb +18 -0
  289. data/lib/dust/utils.rb +14 -0
  290. data/lib/dust/version.rb +3 -0
  291. data/lib/dust-cms.rb +53 -0
  292. data/lib/tasks/dust_tasks.rake +51 -0
  293. data/lib/tasks/seed.rb +46 -0
  294. metadata +613 -0
@@ -0,0 +1,51 @@
1
+ <% if namespaced? -%>
2
+ require_dependency "<%= namespaced_file_path %>/application_controller"
3
+
4
+ <% end -%>
5
+ <% module_namespacing do -%>
6
+ class <%= controller_class_name %>Controller < AuthenticationController
7
+
8
+ filter_access_to :all
9
+
10
+ layout 'cms'
11
+
12
+ def index
13
+ @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
14
+ end
15
+
16
+ def new
17
+ @<%= singular_table_name %> = <%= orm_class.build(class_name) %>
18
+ end
19
+
20
+ def edit
21
+ @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
22
+ end
23
+
24
+ def create
25
+ @<%= singular_table_name %> = <%= orm_class.build(class_name, "params[:#{singular_table_name}]") %>
26
+
27
+ if @<%= orm_instance.save %>
28
+ redirect_to <%= plural_table_name %>_path, <%= key_value :notice, "'#{human_name} was successfully created.'" %>
29
+ else
30
+ render <%= key_value :action, '"new"' %>
31
+ end
32
+ end
33
+
34
+ def update
35
+ @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
36
+
37
+ if @<%= orm_instance.update_attributes("params[:#{singular_table_name}]") %>
38
+ redirect_to <%= plural_table_name %>_path, <%= key_value :notice, "'#{human_name} was successfully updated.'" %>
39
+ else
40
+ render <%= key_value :action, '"edit"' %>
41
+ end
42
+ end
43
+
44
+ def destroy
45
+ @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
46
+ @<%= orm_instance.destroy %>
47
+
48
+ redirect_to <%= index_helper %>_url
49
+ end
50
+ end
51
+ <% end -%>
@@ -0,0 +1,12 @@
1
+ class AppSpecificStringIO < StringIO
2
+ attr_accessor :filepath
3
+
4
+ def initialize(*args)
5
+ super(*args[1..-1])
6
+ @filepath = args[0]
7
+ end
8
+
9
+ def original_filename
10
+ File.basename(filepath)
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ # Use this hook to configure ckeditor
2
+ if Object.const_defined?("Ckeditor")
3
+ Ckeditor.setup do |config|
4
+ # ==> ORM configuration
5
+ # Load and configure the ORM. Supports :active_record (default), :mongo_mapper and
6
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
7
+ # available as additional gems.
8
+ require "ckeditor/orm/active_record"
9
+
10
+ # Allowed image file types for upload.
11
+ # Set to nil or [] (empty array) for all file types
12
+ # config.image_file_types = ["jpg", "jpeg", "png", "gif", "tiff"]
13
+
14
+ # Allowed attachment file types for upload.
15
+ # Set to nil or [] (empty array) for all file types
16
+ # config.attachment_file_types = ["doc", "docx", "xls", "odt", "ods", "pdf", "rar", "zip", "tar", "swf"]
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ # ClientSideValidations Initializer
2
+
3
+ require 'client_side_validations/simple_form' if defined?(::SimpleForm)
4
+ require 'client_side_validations/formtastic' if defined?(::Formtastic)
5
+
6
+ # Uncomment the following block if you want each input field to have the validation messages attached.
7
+ ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
8
+ unless html_tag =~ /^<label/
9
+ %{<div class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label></div>}.html_safe
10
+ else
11
+ %{<div class="field_with_errors">#{html_tag}</div>}.html_safe
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ Dust.configure do |dust|
2
+
3
+ # => rendered within the front_end layout
4
+ dust.config.regions = ['header-one', 'header-two', 'slider', 'callouts', 'content-default', 'footer-one', 'footer-two']
5
+ dust.config.default_region = 'content-default'
6
+
7
+ # => inserts the rendered page view content after the defined region
8
+ dust.config.insert_yield_after = 'callouts'
9
+
10
+ # => redirects the defined page to the root_url
11
+ dust.config.root = 'welcome'
12
+
13
+ # => :actions => [contact_confirmation, contact_request]
14
+ dust.config.mailer = PostOffice
15
+
16
+ # => :resize_to_fit => [620, 358], :thumb => process :resize_to_fill => [105, 70]
17
+ dust.config.uploader = GalleryPhotoUploader
18
+
19
+ # => system location for ImageMagick commands
20
+ dust.config.uploader_command_path = '/usr/local/bin'
21
+
22
+ end
@@ -0,0 +1,11 @@
1
+
2
+ if Rails.env.development?
3
+ lib_reloader = ActiveSupport::FileUpdateChecker.new(Dir["vendor/gems/dust/**/*"]) do
4
+ Rails.application.reload_routes! # or do something better here
5
+ end
6
+
7
+ ActionDispatch::Callbacks.to_prepare do
8
+ lib_reloader.execute_if_updated
9
+ end
10
+ end
11
+
@@ -0,0 +1,398 @@
1
+ # The first thing you need to configure is which modules you need in your app.
2
+ # The default is nothing which will include only core features (password encryption, login/logout).
3
+ # Available submodules are: :user_activation, :http_basic_auth, :remember_me,
4
+ # :reset_password, :session_timeout, :brute_force_protection, :activity_logging, :external
5
+ Rails.application.config.sorcery.submodules = [:remember_me, :activity_logging]
6
+
7
+ # Here you can configure each submodule's features.
8
+ Rails.application.config.sorcery.configure do |config|
9
+ # -- core --
10
+ # What controller action to call for non-authenticated users. You can also
11
+ # override the 'not_authenticated' method of course.
12
+ # Default: `:not_authenticated`
13
+ #
14
+ # config.not_authenticated_action =
15
+
16
+
17
+ # When a non logged in user tries to enter a page that requires login, save
18
+ # the URL he wanted to reach, and send him there after login, using 'redirect_back_or_to'.
19
+ # Default: `true`
20
+ #
21
+ # config.save_return_to_url =
22
+
23
+
24
+ # Set domain option for cookies; Useful for remember_me submodule.
25
+ # Default: `nil`
26
+ #
27
+ # config.cookie_domain =
28
+
29
+
30
+ # -- session timeout --
31
+ # How long in seconds to keep the session alive.
32
+ # Default: `3600`
33
+ #
34
+ # config.session_timeout =
35
+
36
+
37
+ # Use the last action as the beginning of session timeout.
38
+ # Default: `false`
39
+ #
40
+ # config.session_timeout_from_last_action =
41
+
42
+
43
+ # -- http_basic_auth --
44
+ # What realm to display for which controller name. For example {"My App" => "Application"}
45
+ # Default: `{"application" => "Application"}`
46
+ #
47
+ # config.controller_to_realm_map =
48
+
49
+
50
+ # -- activity logging --
51
+ # will register the time of last user login, every login.
52
+ # Default: `true`
53
+ #
54
+ # config.register_login_time =
55
+
56
+
57
+ # will register the time of last user logout, every logout.
58
+ # Default: `true`
59
+ #
60
+ # config.register_logout_time =
61
+
62
+
63
+ # will register the time of last user action, every action.
64
+ # Default: `true`
65
+ #
66
+ # config.register_last_activity_time =
67
+
68
+
69
+ # -- external --
70
+ # What providers are supported by this app, i.e. [:twitter, :facebook, :github, :google, :liveid] .
71
+ # Default: `[]`
72
+ #
73
+ # config.external_providers =
74
+
75
+
76
+ # You can change it by your local ca_file. i.e. '/etc/pki/tls/certs/ca-bundle.crt'
77
+ # Path to ca_file. By default use a internal ca-bundle.crt.
78
+ # Default: `'path/to/ca_file'`
79
+ #
80
+ # config.ca_file =
81
+
82
+
83
+ # Twitter wil not accept any requests nor redirect uri containing localhost,
84
+ # make sure you use 0.0.0.0:3000 to access your app in development
85
+ #
86
+ # config.twitter.key = ""
87
+ # config.twitter.secret = ""
88
+ # config.twitter.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=twitter"
89
+ # config.twitter.user_info_mapping = {:email => "screen_name"}
90
+ #
91
+ # config.facebook.key = ""
92
+ # config.facebook.secret = ""
93
+ # config.facebook.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=facebook"
94
+ # config.facebook.user_info_mapping = {:email => "name"}
95
+ #
96
+ # config.github.key = ""
97
+ # config.github.secret = ""
98
+ # config.github.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=github"
99
+ # config.github.user_info_mapping = {:email => "name"}
100
+ #
101
+ # config.google.key = ""
102
+ # config.google.secret = ""
103
+ # config.google.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=google"
104
+ # config.google.user_info_mapping = {:email => "email", :username => "name"}
105
+ #
106
+ # To use liveid in development mode you have to replace mydomain.com with
107
+ # a valid domain even in development. To use a valid domain in development
108
+ # simply add your domain in your /etc/hosts file in front of 127.0.0.1
109
+ #
110
+ # config.liveid.key = ""
111
+ # config.liveid.secret = ""
112
+ # config.liveid.callback_url = "http://mydomain.com:3000/oauth/callback?provider=liveid"
113
+ # config.liveid.user_info_mapping = {:username => "name"}
114
+
115
+
116
+ # --- user config ---
117
+ config.user_config do |user|
118
+ # -- core --
119
+ # specify username attributes, for example: [:username, :email].
120
+ # Default: `[:username]`
121
+ #
122
+ # user.username_attribute_names =
123
+
124
+
125
+ # change *virtual* password attribute, the one which is used until an encrypted one is generated.
126
+ # Default: `:password`
127
+ #
128
+ # user.password_attribute_name =
129
+
130
+
131
+ # downcase the username before trying to authenticate, default is false
132
+ # Default: `false`
133
+ #
134
+ # user.downcase_username_before_authenticating =
135
+
136
+
137
+ # change default email attribute.
138
+ # Default: `:email`
139
+ #
140
+ # user.email_attribute_name =
141
+
142
+
143
+ # change default crypted_password attribute.
144
+ # Default: `:crypted_password`
145
+ #
146
+ # user.crypted_password_attribute_name =
147
+
148
+
149
+ # what pattern to use to join the password with the salt
150
+ # Default: `""`
151
+ #
152
+ # user.salt_join_token =
153
+
154
+
155
+ # change default salt attribute.
156
+ # Default: `:salt`
157
+ #
158
+ # user.salt_attribute_name =
159
+
160
+
161
+ # how many times to apply encryption to the password.
162
+ # Default: `nil`
163
+ #
164
+ # user.stretches =
165
+
166
+
167
+ # encryption key used to encrypt reversible encryptions such as AES256.
168
+ # WARNING: If used for users' passwords, changing this key will leave passwords undecryptable!
169
+ # Default: `nil`
170
+ #
171
+ # user.encryption_key =
172
+
173
+
174
+ # use an external encryption class.
175
+ # Default: `nil`
176
+ #
177
+ # user.custom_encryption_provider =
178
+
179
+
180
+ # encryption algorithm name. See 'encryption_algorithm=' for available options.
181
+ # Default: `:bcrypt`
182
+ #
183
+ # user.encryption_algorithm =
184
+
185
+
186
+ # make this configuration inheritable for subclasses. Useful for ActiveRecord's STI.
187
+ # Default: `false`
188
+ #
189
+ # user.subclasses_inherit_config =
190
+
191
+
192
+ # -- user_activation --
193
+ # the attribute name to hold activation state (active/pending).
194
+ # Default: `:activation_state`
195
+ #
196
+ # user.activation_state_attribute_name =
197
+
198
+
199
+ # the attribute name to hold activation code (sent by email).
200
+ # Default: `:activation_token`
201
+ #
202
+ # user.activation_token_attribute_name =
203
+
204
+
205
+ # the attribute name to hold activation code expiration date.
206
+ # Default: `:activation_token_expires_at`
207
+ #
208
+ # user.activation_token_expires_at_attribute_name =
209
+
210
+
211
+ # how many seconds before the activation code expires. nil for never expires.
212
+ # Default: `nil`
213
+ #
214
+ # user.activation_token_expiration_period =
215
+
216
+
217
+ # your mailer class. Required.
218
+ # Default: `nil`
219
+ #
220
+ #user.user_activation_mailer = PostOffice
221
+
222
+ # when true sorcery will not automatically
223
+ # email activation details and allow you to
224
+ # manually handle how and when email is sent.
225
+ # Default: `false`
226
+ #
227
+ # user.activation_mailer_disabled =
228
+
229
+
230
+ # activation needed email method on your mailer class.
231
+ # Default: `:activation_needed_email`
232
+ #
233
+ # user.activation_needed_email_method_name =
234
+
235
+
236
+ # activation success email method on your mailer class.
237
+ # Default: `:activation_success_email`
238
+ #
239
+ # user.activation_success_email_method_name =
240
+
241
+
242
+ # do you want to prevent or allow users that did not activate by email to login?
243
+ # Default: `true`
244
+ #
245
+ # user.prevent_non_active_users_to_login =
246
+
247
+
248
+ # -- reset_password --
249
+ # reset password code attribute name.
250
+ # Default: `:reset_password_token`
251
+ #
252
+ # user.reset_password_token_attribute_name =
253
+
254
+
255
+ # expires at attribute name.
256
+ # Default: `:reset_password_token_expires_at`
257
+ #
258
+ # user.reset_password_token_expires_at_attribute_name =
259
+
260
+
261
+ # when was email sent, used for hammering protection.
262
+ # Default: `:reset_password_email_sent_at`
263
+ #
264
+ # user.reset_password_email_sent_at_attribute_name =
265
+
266
+
267
+ # mailer class. Needed.
268
+ # Default: `nil`
269
+ #
270
+ #user.reset_password_mailer = Dust.config.mailer
271
+
272
+
273
+ # reset password email method on your mailer class.
274
+ # Default: `:reset_password_email`
275
+ #
276
+ # user.reset_password_email_method_name =
277
+
278
+
279
+ # when true sorcery will not automatically
280
+ # email password reset details and allow you to
281
+ # manually handle how and when email is sent
282
+ # Default: `false`
283
+ #
284
+ # user.reset_password_mailer_disabled =
285
+
286
+
287
+ # how many seconds before the reset request expires. nil for never expires.
288
+ # Default: `nil`
289
+ #
290
+ # user.reset_password_expiration_period =
291
+
292
+
293
+ # hammering protection, how long to wait before allowing another email to be sent.
294
+ # Default: `5 * 60`
295
+ #
296
+ # user.reset_password_time_between_emails =
297
+
298
+
299
+ # -- brute_force_protection --
300
+ # Failed logins attribute name.
301
+ # Default: `:failed_logins_count`
302
+ #
303
+ # user.failed_logins_count_attribute_name =
304
+
305
+
306
+ # This field indicates whether user is banned and when it will be active again.
307
+ # Default: `:lock_expires_at`
308
+ #
309
+ # user.lock_expires_at_attribute_name =
310
+
311
+
312
+ # How many failed logins allowed.
313
+ # Default: `50`
314
+ #
315
+ # user.consecutive_login_retries_amount_limit =
316
+
317
+
318
+ # How long the user should be banned. in seconds. 0 for permanent.
319
+ # Default: `60 * 60`
320
+ #
321
+ # user.login_lock_time_period =
322
+
323
+ # Unlock token attribute name
324
+ # Default: `:unlock_token`
325
+ #
326
+ # user.unlock_token_attribute_name =
327
+
328
+ # Unlock token mailer method
329
+ # Default: `:send_unlock_token_email`
330
+ #
331
+ # user.unlock_token_email_method_name =
332
+
333
+ # when true sorcery will not automatically
334
+ # send email with unlock token
335
+ # Default: `false`
336
+ #
337
+ # user.unlock_token_mailer_disabled = true
338
+
339
+ # Unlock token mailer class
340
+ # Default: `nil`
341
+ #
342
+ # user.unlock_token_mailer = UserMailer
343
+
344
+ # -- activity logging --
345
+ # Last login attribute name.
346
+ # Default: `:last_login_at`
347
+ #
348
+ # user.last_login_at_attribute_name =
349
+
350
+
351
+ # Last logout attribute name.
352
+ # Default: `:last_logout_at`
353
+ #
354
+ # user.last_logout_at_attribute_name =
355
+
356
+
357
+ # Last activity attribute name.
358
+ # Default: `:last_activity_at`
359
+ #
360
+ # user.last_activity_at_attribute_name =
361
+
362
+
363
+ # How long since last activity is he user defined logged out?
364
+ # Default: `10 * 60`
365
+ #
366
+ # user.activity_timeout =
367
+
368
+
369
+ # -- external --
370
+ # Class which holds the various external provider data for this user.
371
+ # Default: `nil`
372
+ #
373
+ # user.authentications_class =
374
+
375
+
376
+ # User's identifier in authentications class.
377
+ # Default: `:user_id`
378
+ #
379
+ # user.authentications_user_id_attribute_name =
380
+
381
+
382
+ # Provider's identifier in authentications class.
383
+ # Default: `:provider`
384
+ #
385
+ # user.provider_attribute_name =
386
+
387
+
388
+ # User's external unique identifier in authentications class.
389
+ # Default: `:uid`
390
+ #
391
+ # user.provider_uid_attribute_name =
392
+ end
393
+
394
+ # This line must come after the 'user config' block.
395
+ # Define which model authenticates with sorcery.
396
+ config.user_class = "Dust::User"
397
+ end
398
+
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,55 @@
1
+ Rails.application.routes.draw do
2
+ mount Ckeditor::Engine => "/ckeditor"
3
+
4
+ namespace :dust do
5
+
6
+ resources :blocks
7
+ resources :contacts
8
+ resources :pages
9
+ resources :posts
10
+ resources :roles
11
+ resources :users
12
+ resources :menus
13
+ resources :menu_items
14
+ resources :site_wides, :only => [:new, :create, :destroy]
15
+
16
+ post 'sort' => 'sortable#sort', :as => :sort_items
17
+
18
+ namespace :gallery do
19
+ resources :albums
20
+ resources :photos
21
+
22
+ namespace :api do
23
+ resources :photos, :only => [:show, :create, :update, :destroy]
24
+ end
25
+ end
26
+
27
+ resources :sessions, :only => [:new, :create, :destroy]
28
+ resources :password_resets, :only => [:new, :create, :edit, :update ]
29
+
30
+ get "dashboard/show" => "dashboard#show", :as => :dashboard
31
+ match "dashboard/update" => "dashboard#update", :as => :dashboard_update
32
+
33
+ match 'download/csv' => 'contacts#csv', :as => :download_csv
34
+ match 'import/csv' => 'contacts#csv_import', :as => :import_csv
35
+
36
+ get "logout" => "sessions#destroy", :as => "logout"
37
+ get "login" => "sessions#new", :as => "login"
38
+ get "signup" => "users#new", :as => "signup"
39
+
40
+ end
41
+
42
+ scope :module => 'front_end' do
43
+
44
+ get "search" => "page#search", :as => :view_page_search #new! search
45
+
46
+ match "sitemap" => "sitemap#index", :as => :sitemap_xml
47
+ match 'post/*filename' => 'post#show', :as => :front_end_post
48
+ match '*filename' => 'page#show', :as => :front_end_page
49
+
50
+ root :to => "page#show", :filename => Dust.config.root#"welcome"
51
+
52
+ end
53
+
54
+ end
55
+
@@ -0,0 +1,11 @@
1
+ class CreateRoles < ActiveRecord::Migration
2
+ def self.up
3
+ create_table "roles" do |t|
4
+ t.string :name
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ drop_table "roles"
10
+ end
11
+ end
@@ -0,0 +1,31 @@
1
+ class CreateCkeditorAssets < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :ckeditor_assets do |t|
4
+ t.string :data_file_name, :null => false
5
+ t.string :data_content_type
6
+ t.integer :data_file_size
7
+
8
+ t.integer :assetable_id
9
+ t.string :assetable_type, :limit => 30
10
+ t.string :type, :limit => 25
11
+ t.string :guid, :limit => 10
12
+
13
+ t.integer :locale, :limit => 1, :default => 0
14
+ t.integer :user_id
15
+
16
+ # Uncomment it to save images dimensions, if your need it
17
+ # t.integer :width
18
+ # t.integer :height
19
+
20
+ t.timestamps
21
+ end
22
+
23
+ add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], :name => "idx_assetable_type"
24
+ add_index "ckeditor_assets", ["assetable_type", "assetable_id"], :name => "fk_assetable"
25
+ add_index "ckeditor_assets", ["user_id"], :name => "fk_user"
26
+ end
27
+
28
+ def self.down
29
+ drop_table :ckeditor_assets
30
+ end
31
+ end
@@ -0,0 +1,15 @@
1
+ class CreatePages < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :pages do |t|
4
+ t.string :meta_title
5
+ t.text :meta_description
6
+ t.string :classes
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :pages
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ class CreateSections < ActiveRecord::Migration
2
+ def change
3
+ create_table :sections do |t|
4
+ t.string :title
5
+ t.string :classes
6
+ t.integer :position
7
+ t.integer :page_id
8
+ t.integer :parent_id
9
+ t.integer :lft
10
+ t.integer :rgt
11
+
12
+ t.timestamps
13
+ end
14
+ end
15
+ end