dust-cms 0.0.05

Sign up to get free protection for your applications and to get access to all the features.
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,41 @@
1
+ module Dust
2
+ class SiteWide < ActiveRecord::Base
3
+ attr_accessible :name, :value, :category
4
+
5
+ validates_presence_of :name, :value, :category
6
+
7
+ def self.variables_by_category
8
+ items = order('category, name').all
9
+ items.group_by{ |i| i.category }
10
+ end
11
+
12
+ def self.all_to_object
13
+ vars = OpenStruct.new
14
+ variables_by_category.each do |cat, vars_for_cat|
15
+ cat = create_category_method(cat, vars)
16
+ create_vars_for_category_method(cat, vars_for_cat)
17
+ end
18
+ vars
19
+ end
20
+
21
+ def self.default_categories
22
+ ['Site Info', 'Contact Info', 'Location Info']
23
+ end
24
+
25
+ private
26
+
27
+ def self.create_category_method(cat, vars)
28
+ cat = cat.parameterize.gsub("-", "_")
29
+ vars.class.send(:define_method, cat, proc{OpenStruct.new})
30
+ vars.send(cat)
31
+ end
32
+
33
+ def self.create_vars_for_category_method(cat, vars)
34
+ vars.each do |var|
35
+ name = var.name.parameterize.gsub("-", "_")
36
+ cat.class.send(:define_method, name, proc{var.value})
37
+ end
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,52 @@
1
+ module Dust
2
+ class Sort
3
+
4
+ attr_accessor :previous, :position, :value, :id, :class, :list
5
+
6
+ def initialize(list={}, class_name=nil, parent=nil)
7
+ @class_name = class_name
8
+ @parent = parent
9
+ @previous = nil
10
+ @list = format_list(list.to_a)
11
+ self.sort_list
12
+ end
13
+
14
+ def format_list(list)
15
+ list.map! do |item|
16
+ Dust::SortableItem.new(:position => item[1]["position"].to_i,
17
+ :id => item[1]["id"],
18
+ :class_name => @class_name,
19
+ :children => item[1]["children"])
20
+ end
21
+ list.sort_by! { |item| item.position }
22
+ end
23
+
24
+ def sort_list
25
+ @list.each do |item|
26
+ @current_menu_item = item.object_class.find(item.id)
27
+ if @parent.nil?
28
+ self.sort_roots(item)
29
+ else
30
+ @parent = item.object_class.find(@parent)
31
+ self.sort_children(item)
32
+ end
33
+ end
34
+ end
35
+
36
+ def sort_roots(item)
37
+ unless @previous.nil?
38
+ previous_item = item.object_class.find_by_id(@previous)
39
+ @current_menu_item.move_to_right_of(previous_item)
40
+ else
41
+ @current_menu_item.move_to_root
42
+ end
43
+ @previous = item.id
44
+ end
45
+
46
+ def sort_children(item)
47
+ child_cms_menu_item = item.object_class.find_by_id(item.id)
48
+ child_cms_menu_item.move_to_child_of(@parent)
49
+ end
50
+
51
+ end
52
+ end
@@ -0,0 +1,21 @@
1
+ module Dust
2
+ class SortableItem
3
+
4
+ attr_accessor :position
5
+ attr_reader :object_class, :id, :position
6
+
7
+ def initialize(options={})
8
+ @position = options[:position]
9
+ @object_class = options[:class_name].constantize
10
+ @id = options[:id]
11
+
12
+ self.children = options[:children]
13
+ end
14
+
15
+ def children=(children)
16
+ @children = Dust::Sort.new(children, @object_class.to_s, self.id)
17
+ @children
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,49 @@
1
+ module Dust
2
+ class User < ActiveRecord::Base
3
+ authenticates_with_sorcery!
4
+
5
+ attr_accessible :username, :password, :password_confirmation, :email, :role_id, :role
6
+
7
+ belongs_to :role
8
+ has_many :assignments
9
+ has_many :roles, :through => :assignments
10
+
11
+ validates_format_of :email, :with => /^(|(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6})$/i
12
+ validates_length_of :password, :minimum => 3, :message => "password must be at least 3 characters long", :if => Proc.new{ |u| !u.password.blank? }
13
+ validates_confirmation_of :password, :message => "should match confirmation", :if => Proc.new{ |u| !u.password.blank? }
14
+
15
+ def role_symbols
16
+ [(role.name).to_sym]
17
+ end
18
+
19
+ def has_role?(role)
20
+ role_symbols.include?(role)
21
+ end
22
+
23
+ def is?(role)
24
+ role_symbols.include?(role)
25
+ end
26
+
27
+ def self.page(search, page)
28
+ search(search).paginate(:per_page => 12, :page => page)
29
+ end
30
+
31
+ def self.search(search)
32
+ if search
33
+ where("username LIKE ?", "%#{search}%")
34
+ else
35
+ scoped
36
+ end
37
+ end
38
+
39
+ def login
40
+ username
41
+ end
42
+
43
+ def deliver_password_reset_instructions!
44
+ reset_perishable_token!
45
+ PostOffice.password_reset_instructions(self).deliver
46
+ end
47
+
48
+ end
49
+ end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+ class CkeditorAttachmentFileUploader < CarrierWave::Uploader::Base
3
+ include Ckeditor::Backend::CarrierWave
4
+
5
+ # Include RMagick or ImageScience support:
6
+ # include CarrierWave::RMagick
7
+ # include CarrierWave::MiniMagick
8
+ # include CarrierWave::ImageScience
9
+
10
+ # Choose what kind of storage to use for this uploader:
11
+ storage :file
12
+
13
+ # Override the directory where uploaded files will be stored.
14
+ # This is a sensible default for uploaders that are meant to be mounted:
15
+ def store_dir
16
+ "uploads/ckeditor/attachments/#{model.id}"
17
+ end
18
+
19
+ # Provide a default URL as a default if there hasn't been a file uploaded:
20
+ # def default_url
21
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
22
+ # end
23
+
24
+ # Process files as they are uploaded:
25
+ # process :scale => [200, 300]
26
+ #
27
+ # def scale(width, height)
28
+ # # do something
29
+ # end
30
+
31
+ # Add a white list of extensions which are allowed to be uploaded.
32
+ # For images you might use something like this:
33
+ def extension_white_list
34
+ Ckeditor.attachment_file_types
35
+ end
36
+
37
+ # Override the filename of the uploaded files:
38
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
39
+ # def filename
40
+ # "something.jpg" if original_filename
41
+ # end
42
+ end
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+ class CkeditorPictureUploader < CarrierWave::Uploader::Base
3
+ include Ckeditor::Backend::CarrierWave
4
+
5
+ # Include RMagick or ImageScience support:
6
+ # include CarrierWave::RMagick
7
+ include CarrierWave::MiniMagick
8
+ # include CarrierWave::ImageScience
9
+
10
+ # Choose what kind of storage to use for this uploader:
11
+ storage :file
12
+
13
+ # Override the directory where uploaded files will be stored.
14
+ # This is a sensible default for uploaders that are meant to be mounted:
15
+ def store_dir
16
+ "uploads/ckeditor/pictures/#{model.id}"
17
+ end
18
+
19
+ # Provide a default URL as a default if there hasn't been a file uploaded:
20
+ # def default_url
21
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
22
+ # end
23
+
24
+ # Process files as they are uploaded:
25
+ # process :scale => [200, 300]
26
+ #
27
+ # def scale(width, height)
28
+ # # do something
29
+ # end
30
+
31
+ process :read_dimensions
32
+
33
+ # Create different versions of your uploaded files:
34
+ version :thumb do
35
+ process :resize_to_fill => [118, 100]
36
+ end
37
+
38
+ version :content do
39
+ process :resize_to_limit => [800, 800]
40
+ end
41
+
42
+ # Add a white list of extensions which are allowed to be uploaded.
43
+ # For images you might use something like this:
44
+ def extension_white_list
45
+ Ckeditor.image_file_types
46
+ end
47
+
48
+ # Override the filename of the uploaded files:
49
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
50
+ # def filename
51
+ # "something.jpg" if original_filename
52
+ # end
53
+ end
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+
3
+ class GalleryPhotoUploader < CarrierWave::Uploader::Base
4
+
5
+ # Include RMagick or MiniMagick support:
6
+ # include CarrierWave::RMagick
7
+ include CarrierWave::MiniMagick
8
+
9
+ # Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
10
+ # include Sprockets::Helpers::RailsHelper
11
+ # include Sprockets::Helpers::IsolatedHelper
12
+
13
+ # Choose what kind of storage to use for this uploader:
14
+ storage :file
15
+ # storage :fog
16
+
17
+ # Override the directory where uploaded files will be stored.
18
+ # This is a sensible default for uploaders that are meant to be mounted:
19
+ def store_dir
20
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
21
+ end
22
+
23
+ # Provide a default URL as a default if there hasn't been a file uploaded:
24
+ # def default_url
25
+ # # For Rails 3.1+ asset pipeline compatibility:
26
+ # # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
27
+ #
28
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
29
+ # end
30
+
31
+ # Process files as they are uploaded:
32
+ process :resize_to_fit => [620, 358]
33
+
34
+ # Create different versions of your uploaded files:
35
+ version :thumb do
36
+ process :resize_to_fill => [105, 70]
37
+ end
38
+
39
+ # Add a white list of extensions which are allowed to be uploaded.
40
+ # For images you might use something like this:
41
+ # def extension_white_list
42
+ # %w(jpg jpeg gif png)
43
+ # end
44
+
45
+ # Override the filename of the uploaded files:
46
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
47
+ # def filename
48
+ # "something.jpg" if original_filename
49
+ # end
50
+
51
+ end
52
+
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ class ImageUploader < CarrierWave::Uploader::Base
4
+
5
+ # Include RMagick or MiniMagick support:
6
+ # include CarrierWave::RMagick
7
+ include CarrierWave::MiniMagick
8
+
9
+ # Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
10
+ # include Sprockets::Helpers::RailsHelper
11
+ # include Sprockets::Helpers::IsolatedHelper
12
+
13
+ # Choose what kind of storage to use for this uploader:
14
+ storage :file
15
+ # storage :fog
16
+
17
+ # Override the directory where uploaded files will be stored.
18
+ # This is a sensible default for uploaders that are meant to be mounted:
19
+ def store_dir
20
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
21
+ end
22
+
23
+ # Provide a default URL as a default if there hasn't been a file uploaded:
24
+ # def default_url
25
+ # # For Rails 3.1+ asset pipeline compatibility:
26
+ # # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
27
+ #
28
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
29
+ # end
30
+
31
+ # Process files as they are uploaded:
32
+ process :resize_to_fit => [620, 358]
33
+
34
+ # Create different versions of your uploaded files:
35
+ version :thumb do
36
+ process :resize_to_fill => [105, 70]
37
+ end
38
+
39
+ # Add a white list of extensions which are allowed to be uploaded.
40
+ # For images you might use something like this:
41
+ # def extension_white_list
42
+ # %w(jpg jpeg gif png)
43
+ # end
44
+
45
+ # Override the filename of the uploaded files:
46
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
47
+ # def filename
48
+ # "something.jpg" if original_filename
49
+ # end
50
+
51
+ end
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ class SlideImageUploader < CarrierWave::Uploader::Base
4
+
5
+ # Include RMagick or MiniMagick support:
6
+ # include CarrierWave::RMagick
7
+ include CarrierWave::MiniMagick
8
+
9
+ # Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
10
+ # include Sprockets::Helpers::RailsHelper
11
+ # include Sprockets::Helpers::IsolatedHelper
12
+
13
+ # Choose what kind of storage to use for this uploader:
14
+ storage :file
15
+ # storage :fog
16
+
17
+ # Override the directory where uploaded files will be stored.
18
+ # This is a sensible default for uploaders that are meant to be mounted:
19
+ def store_dir
20
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
21
+ end
22
+
23
+ # Provide a default URL as a default if there hasn't been a file uploaded:
24
+ # def default_url
25
+ # # For Rails 3.1+ asset pipeline compatibility:
26
+ # # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
27
+ #
28
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
29
+ # end
30
+
31
+ # Process files as they are uploaded:
32
+ process :resize_to_fit => [620, 358]
33
+
34
+ # Create different versions of your uploaded files:
35
+ version :thumb do
36
+ process :resize_to_fill => [105, 70]
37
+ end
38
+
39
+ # Add a white list of extensions which are allowed to be uploaded.
40
+ # For images you might use something like this:
41
+ # def extension_white_list
42
+ # %w(jpg jpeg gif png)
43
+ # end
44
+
45
+ # Override the filename of the uploaded files:
46
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
47
+ # def filename
48
+ # "something.jpg" if original_filename
49
+ # end
50
+
51
+ end
@@ -0,0 +1,20 @@
1
+ .block{ :id => "#{block.title.parameterize}", :class => "#{block.final_classes}" }
2
+ .block-inner
3
+ .block-content
4
+ - if !block.partial_name.blank?
5
+ - begin
6
+ = render block.partial_name, :block => block
7
+ - rescue => e
8
+ - Rails.logger.info "\n\t[# BLOCK ERROR]"
9
+ - Rails.logger.info "\t\t#{e}"
10
+ - Rails.logger.info "\t[/ BLOCK ERROR]\n"
11
+ - if logged_in?
12
+ Error: Content not found or malfunctioning. Please notify the site administrator.
13
+ - else
14
+ &nbsp;
15
+ - else
16
+ = render "dust/blocks/normal_block_content", :block => block
17
+ - if permitted_to? :manage, :blocks
18
+ .edit-link
19
+ = link_to edit_icon("Block <br/>'#{block.title}'"), edit_dust_block_path(block, :return => request.fullpath), :class => "to-admin"
20
+ = link_to delete_icon("Delete <br/>'#{block.title}'"), dust_block_path(block, :return => request.fullpath), :class => "to-admin", :confirm => "Are you sure?", :method => :delete
@@ -0,0 +1,50 @@
1
+ .solitary-header.sub-header.clearfix
2
+ .button-bar.clearfix
3
+ = render :partial => 'search'
4
+ .admin-links
5
+ = link_to 'all blocks', dust_blocks_path, :class => 'border', :title => "All Blocks"
6
+ = link_to "delete block", @block, :confirm => 'Are you sure?', :method => :delete
7
+
8
+ .form-wrap.clearfix
9
+
10
+ -# custom page variables
11
+ - @block.where_to_show.blank? ? selected = 'content' : selected = @block.where_to_show
12
+ - @block.classes.blank? ? css_classes = 'twelve columns' : css_classes = @block.classes
13
+
14
+ = simple_form_for @block, :validations => true do |f|
15
+ = hidden_field_tag :return, params[:return]
16
+ = f.error_messages
17
+ .fields
18
+ .sub-header
19
+ .title block fields
20
+ .content-wrapper
21
+ .item.block_title
22
+ = f.input :title
23
+ - if permitted_to? :manage, :blocks
24
+ = f.input :partial_name, :collection => Dust::Block.widget_list, :label => "Widget"
25
+
26
+ = f.input :column_span, :collection => Dust::Block.grid.columns, :label => "Column Span Width", input_html: { value: css_classes }
27
+ = f.input :column_offset, :collection => Dust::Block.grid.offsets, :label => "Column Offset Width"
28
+
29
+ - if permitted_to? :manage, :blocks
30
+ = f.input :classes
31
+
32
+ = f.input :weight, :class => 'field'
33
+ = f.input :where_to_show, :collection => Dust::Block.regions, :label => "Where should I show up?"
34
+
35
+ %strong= f.label :show,"What pages is this block visible on."
36
+ %br/
37
+ List Urls of pages this block should show up on, one per Line.
38
+ %br/
39
+ %em If this area is blank the block will be visible on all pages.
40
+ = f.text_area :show, :class => 'field'
41
+
42
+ .content-areas
43
+ .sub-header
44
+ .title block content
45
+ .content-wrapper
46
+ .item
47
+ = f.cktext_area("body", :width => '100%', :height => '400px')
48
+ .item
49
+ .right= f.submit
50
+ .clear
@@ -0,0 +1 @@
1
+ = raw(block.front_end_content)
@@ -0,0 +1,4 @@
1
+ #searchbox
2
+ = form_tag dust_blocks_path, :method => 'get' do
3
+ = text_field_tag :search, params[:search], :class => "input-text", :placeholder => 'Search Blocks'
4
+ -#= image_submit_tag "/assets/admin/preview.png", :class => "image-submit"
@@ -0,0 +1,4 @@
1
+ - title "Edit Block"
2
+ - heading "Edit Block"
3
+
4
+ = render 'form'
@@ -0,0 +1,16 @@
1
+ - title "Blocks"
2
+
3
+ .sub-header
4
+ .button-bar.clearfix
5
+ = render :partial => 'search'
6
+ .admin-links
7
+ = link_to 'new block', new_dust_block_path, :class => '', :title => "New Block"
8
+
9
+ .content-wrapper
10
+ = will_paginate @blocks
11
+ - @blocks.each do |block|
12
+ .index-item
13
+ .ui-widget.ui-helper-clearfix{:style => "float:right"}
14
+ = link_to "", block, :confirm => 'Are you sure?', :method => :delete, :class => 'destroy tip', :title => "Destroy This Item"
15
+ = link_to block.title, edit_dust_block_path(block)
16
+ = will_paginate @blocks
@@ -0,0 +1,3 @@
1
+ - title "New Block"
2
+ - heading "New Block"
3
+ = render 'form'
@@ -0,0 +1,37 @@
1
+ .solitary-header.sub-header.clearfix
2
+ .button-bar.clearfix
3
+ = render :partial => 'search'
4
+ .admin-links
5
+ = link_to 'all contacts', dust_contacts_path, :class => 'border'
6
+ = link_to "delete contact", @contact, :confirm => 'Are you sure?', :method => :delete
7
+
8
+ .form-wrap.clearfix
9
+ = form_for @contact, :validate => true, :html => { :multipart => true } do |f|
10
+ = f.error_messages
11
+
12
+ .fields
13
+ .sub-header
14
+ .title contact fields
15
+ .content-wrapper
16
+ .item
17
+ = f.label :name
18
+ %br/
19
+ = f.text_field :name, :class => 'field'
20
+ .item
21
+ = f.label :email
22
+ %br/
23
+ = f.text_field :email, :class => 'field'
24
+ .item
25
+ = f.label :phone
26
+ %br/
27
+ = f.text_field :phone, :class => 'field'
28
+
29
+ .content-areas
30
+ .sub-header
31
+ .title contact content
32
+ .content-wrapper
33
+ .item
34
+ = f.label :message
35
+ %br/
36
+ = f.text_area :message, :class => 'field', :style => "height:128px;"
37
+ .item= f.submit "Submit"
@@ -0,0 +1,8 @@
1
+ .item
2
+ = form_for :csv_import, :url=>{ :controller=>"contacts", :action => 'csv_import'}, :html => { :multipart => true } do |f|
3
+ %p
4
+ = f.label :file, 'Import Contact file'
5
+ %br/
6
+ = f.file_field :file
7
+ %p
8
+ = submit_tag "Submit"
@@ -0,0 +1,13 @@
1
+ %p
2
+ %strong Name:
3
+ = h @contact.name
4
+ %p
5
+ %strong Email:
6
+ = h @contact.email
7
+
8
+ %p
9
+ %strong Phone Number:
10
+ = h @contact.phone unless @contact.phone.nil?
11
+ %p{:class => "woah"}
12
+ %strong Message:
13
+ = h @contact.message
@@ -0,0 +1,4 @@
1
+ #searchbox
2
+ = form_tag dust_contacts_path, :method => 'get' do
3
+ = text_field_tag :search, params[:search], :class => "input-text", :placeholder => 'Search Contacts'
4
+ = image_submit_tag "admin/blank.png", :class => "image-submit"
@@ -0,0 +1,2 @@
1
+ - title "Edit Contact"
2
+ = render :partial => 'form'
@@ -0,0 +1,17 @@
1
+ - title "Contact Requests"
2
+
3
+ .sub-header
4
+ .button-bar.clearfix
5
+ = render :partial => 'search'
6
+ .admin-links
7
+ = link_to 'new contact', new_dust_contact_path, :class => 'border tip', :title => "New Contact Form"
8
+ = link_to "download", dust_download_csv_path, :class => "batch tip", :title => "Downlaod a CSV of all <br /> the past contact requests."
9
+
10
+ .content-wrapper
11
+ = will_paginate @contacts
12
+ - @contacts.each do |contact|
13
+ .index-item
14
+ .ui-widget.ui-helper-clearfix{:style => "float:right"}
15
+ = link_to "", contact, :confirm => 'Are you sure?', :method => :delete, :class => 'ui-icon ui-icon-close destroy tip', :title => "Destroy This Item"
16
+ = link_to contact.name, edit_dust_contact_path(contact)
17
+ = will_paginate @contacts
@@ -0,0 +1,6 @@
1
+ {
2
+ name: "Contact Requests",
3
+ pointInterval: #{1.day * 1000 },
4
+ pointStart: #{ 1.week.ago.to_i * 1000},
5
+ data: #{ (1.week.ago.to_date..Date.tomorrow).map { |date| Contact.total_on(date + 1.day).count }.inspect}
6
+ }
@@ -0,0 +1,3 @@
1
+ - title 'New Contact'
2
+ - heading 'New Contact'
3
+ = render :partial => 'form'
@@ -0,0 +1,6 @@
1
+
2
+ = label_tag variable.name.titleize
3
+ - if variable.value.split("\n").count > 1
4
+ = text_area_tag "options[#{variable.id}][value]", variable.value
5
+ -else
6
+ = text_field_tag "options[#{variable.id}][value]", variable.value
@@ -0,0 +1,33 @@
1
+ - title "Dashboard"
2
+
3
+ - content_for :header do
4
+ - if @site_wide
5
+ = error_messages_for @site_wide
6
+
7
+ .sub-header
8
+ .button-bar.clearfix
9
+ .title Site Wide Administration
10
+
11
+ .admin-links
12
+ = link_to "New Site Wide Variable", new_dust_site_wide_path, :class => 'border'
13
+ = link_to current_user.username, edit_dust_user_path(current_user)
14
+
15
+ .content-wrapper
16
+
17
+ = form_tag('/dust/dashboard/update') do
18
+ .accordion
19
+ - @options.each do |name, options|
20
+
21
+ .index-item
22
+
23
+ = link_to name.to_s.titleize, '#'
24
+
25
+ .options
26
+ - options.each do |variable|
27
+ .item
28
+ .list-links.clearfix{:style => "float:right"}
29
+ = link_to "", variable, :confirm => 'Are you sure?', :method => :delete, :class => 'destroy tip', :title => "Destroy This Item"
30
+
31
+ = render 'dust/dashboard/options', :variable => variable
32
+ .item
33
+ = submit_tag