wheels 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (300) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +17 -0
  3. data/Rakefile +22 -22
  4. data/VERSION +1 -0
  5. data/app/controllers/access_control_entries_controller.rb +38 -0
  6. data/app/controllers/app_configs_controller.rb +17 -0
  7. data/app/controllers/application_controller.rb +39 -0
  8. data/app/controllers/attachments_controller.rb +16 -0
  9. data/app/controllers/blogs_controller.rb +39 -0
  10. data/app/controllers/discussions_controller.rb +10 -0
  11. data/app/controllers/external_links_controller.rb +5 -0
  12. data/app/controllers/feedbacks_controller.rb +10 -0
  13. data/app/controllers/forum_messages_controller.rb +13 -0
  14. data/app/controllers/forums_controller.rb +2 -0
  15. data/app/controllers/galleries_controller.rb +60 -0
  16. data/app/controllers/images_controller.rb +30 -0
  17. data/app/controllers/menus_controller.rb +2 -0
  18. data/app/controllers/pages_controller.rb +80 -0
  19. data/app/controllers/profiles_controller.rb +16 -0
  20. data/app/controllers/sitemaps_controller.rb +135 -0
  21. data/app/controllers/users_controller.rb +28 -0
  22. data/app/helpers/access_control_entries_helper.rb +2 -0
  23. data/app/helpers/app_configs_helper.rb +2 -0
  24. data/app/helpers/application_helper.rb +43 -0
  25. data/app/helpers/blogs_helper.rb +10 -0
  26. data/app/helpers/discussions_helper.rb +2 -0
  27. data/app/helpers/external_links_helper.rb +2 -0
  28. data/app/helpers/feedbacks_helper.rb +2 -0
  29. data/app/helpers/forums_helper.rb +2 -0
  30. data/app/helpers/menus_helper.rb +2 -0
  31. data/app/helpers/pages_helper.rb +192 -0
  32. data/app/helpers/sitemaps_helper.rb +12 -0
  33. data/app/mailers/feedback_mailer.rb +10 -0
  34. data/app/models/ability.rb +43 -0
  35. data/app/models/access_control_entry.rb +109 -0
  36. data/app/models/app_config.rb +26 -0
  37. data/app/models/attachment.rb +10 -0
  38. data/app/models/blog.rb +10 -0
  39. data/app/models/discussion.rb +19 -0
  40. data/app/models/external_link.rb +10 -0
  41. data/app/models/feedback.rb +11 -0
  42. data/app/models/forum.rb +4 -0
  43. data/app/models/forum_message.rb +5 -0
  44. data/app/models/gallery.rb +5 -0
  45. data/app/models/image.rb +10 -0
  46. data/app/models/menu.rb +5 -0
  47. data/app/models/page.rb +8 -0
  48. data/app/models/page_revision.rb +2 -0
  49. data/app/models/profile.rb +12 -0
  50. data/app/models/role.rb +29 -0
  51. data/app/models/s3_provider.rb +84 -0
  52. data/app/models/sitemap.rb +175 -0
  53. data/app/models/tagging.rb +4 -0
  54. data/app/models/user.rb +69 -0
  55. data/app/validators/email_validator.rb +22 -0
  56. data/app/views/access_control_entries/_form.html.haml +33 -0
  57. data/app/views/access_control_entries/_index.html.haml +53 -0
  58. data/app/views/access_control_entries/_show.html.haml +12 -0
  59. data/app/views/access_control_entries/create.js.haml +3 -0
  60. data/app/views/access_control_entries/destroy.js.haml +3 -0
  61. data/app/views/access_control_entries/edit.html.haml +7 -0
  62. data/app/views/access_control_entries/edit.js.haml +3 -0
  63. data/app/views/access_control_entries/index.html.haml +2 -0
  64. data/app/views/access_control_entries/index.js.haml +3 -0
  65. data/app/views/access_control_entries/new.html.haml +5 -0
  66. data/app/views/access_control_entries/new.js.haml +3 -0
  67. data/app/views/access_control_entries/show.html.haml +2 -0
  68. data/app/views/access_control_entries/show.js.haml +4 -0
  69. data/app/views/access_control_entries/update.js.haml +3 -0
  70. data/app/views/app_configs/_form.html.haml +11 -0
  71. data/app/views/app_configs/_index.html.haml +6 -0
  72. data/app/views/app_configs/_show.html.haml +3 -0
  73. data/app/views/app_configs/create.js.haml +3 -0
  74. data/app/views/app_configs/css.css.haml +2 -0
  75. data/app/views/app_configs/destroy.js.haml +3 -0
  76. data/app/views/app_configs/edit.html.haml +2 -0
  77. data/app/views/app_configs/edit.js.haml +3 -0
  78. data/app/views/app_configs/index.html.haml +2 -0
  79. data/app/views/app_configs/index.js.haml +3 -0
  80. data/app/views/app_configs/new.html.haml +2 -0
  81. data/app/views/app_configs/new.js.haml +3 -0
  82. data/app/views/app_configs/show.html.haml +2 -0
  83. data/app/views/app_configs/show.js.haml +3 -0
  84. data/app/views/app_configs/update.js.haml +3 -0
  85. data/app/views/attachments/_form.html.haml +26 -0
  86. data/app/views/attachments/_index.html.haml +9 -0
  87. data/app/views/attachments/_show.html.haml +6 -0
  88. data/app/views/attachments/_uploadify.html.erb +12 -0
  89. data/app/views/attachments/create.js.haml +3 -0
  90. data/app/views/attachments/destroy.js.haml +3 -0
  91. data/app/views/attachments/edit.js.haml +3 -0
  92. data/app/views/attachments/index.html.haml +2 -0
  93. data/app/views/attachments/index.js.haml +3 -0
  94. data/app/views/attachments/new.html.haml +3 -0
  95. data/app/views/attachments/new.js.haml +3 -0
  96. data/app/views/attachments/show.html.haml +2 -0
  97. data/app/views/attachments/show.js.haml +3 -0
  98. data/app/views/attachments/update.js.haml +3 -0
  99. data/app/views/blogs/_form.html.haml +22 -0
  100. data/app/views/blogs/edit.html.haml +8 -0
  101. data/app/views/blogs/index.html.haml +21 -0
  102. data/app/views/blogs/index.xml.builder +27 -0
  103. data/app/views/blogs/new.html.haml +6 -0
  104. data/app/views/blogs/show.html.haml +25 -0
  105. data/app/views/discussions/_form.html.haml +16 -0
  106. data/app/views/discussions/edit.html.haml +7 -0
  107. data/app/views/discussions/index.html.haml +10 -0
  108. data/app/views/discussions/new.html.haml +25 -0
  109. data/app/views/discussions/show.html.haml +16 -0
  110. data/app/views/external_links/_fields_for.html.haml +2 -0
  111. data/app/views/external_links/_form.html.haml +18 -0
  112. data/app/views/external_links/_show.html.haml +7 -0
  113. data/app/views/external_links/create.js.haml +3 -0
  114. data/app/views/external_links/destroy.js.haml +3 -0
  115. data/app/views/external_links/edit.html.haml +7 -0
  116. data/app/views/external_links/edit.js.haml +3 -0
  117. data/app/views/external_links/index.html.haml +23 -0
  118. data/app/views/external_links/index.js.haml +3 -0
  119. data/app/views/external_links/new.html.haml +5 -0
  120. data/app/views/external_links/new.js.haml +3 -0
  121. data/app/views/external_links/show.html.haml +2 -0
  122. data/app/views/external_links/show.js.haml +3 -0
  123. data/app/views/external_links/update.js.haml +3 -0
  124. data/app/views/feedback_mailer/submit_feedback.html.haml +22 -0
  125. data/app/views/feedbacks/_form.html.haml +38 -0
  126. data/app/views/feedbacks/index.html.haml +27 -0
  127. data/app/views/feedbacks/new.html.haml +6 -0
  128. data/app/views/feedbacks/show.html.haml +19 -0
  129. data/app/views/forum_messages/_form.html.haml +6 -0
  130. data/app/views/forum_messages/index.html.haml +11 -0
  131. data/app/views/forum_messages/new.html.haml +5 -0
  132. data/app/views/forums/_form.html.haml +13 -0
  133. data/app/views/forums/edit.html.haml +7 -0
  134. data/app/views/forums/index.html.haml +23 -0
  135. data/app/views/forums/new.html.haml +5 -0
  136. data/app/views/forums/show.html.haml +20 -0
  137. data/app/views/galleries/_form.html.haml +30 -0
  138. data/app/views/galleries/_show.html.haml +21 -0
  139. data/app/views/galleries/edit.html.haml +7 -0
  140. data/app/views/galleries/index.html.haml +15 -0
  141. data/app/views/galleries/new.html.haml +5 -0
  142. data/app/views/galleries/show.html.haml +4 -0
  143. data/app/views/images/_form.html.haml +10 -0
  144. data/app/views/images/create.js.haml +3 -0
  145. data/app/views/images/destroy.js.haml +3 -0
  146. data/app/views/images/edit.html.haml +7 -0
  147. data/app/views/images/edit.js.haml +3 -0
  148. data/app/views/images/index.html.haml +17 -0
  149. data/app/views/images/index.js.haml +3 -0
  150. data/app/views/images/new.html.haml +5 -0
  151. data/app/views/images/new.js.haml +3 -0
  152. data/app/views/images/show.html.haml +5 -0
  153. data/app/views/images/show.js.haml +3 -0
  154. data/app/views/images/update.js.haml +3 -0
  155. data/app/views/layouts/application.html.haml +60 -0
  156. data/app/views/layouts/bare.html.haml +2 -0
  157. data/app/views/layouts/image_dialog.html.haml +18 -0
  158. data/app/views/loadbehind/_destroy.js.haml +3 -0
  159. data/app/views/loadbehind/_edit.js.haml +4 -0
  160. data/app/views/loadbehind/_errors.html.haml +5 -0
  161. data/app/views/loadbehind/_growl_template.html.haml +65 -0
  162. data/app/views/loadbehind/_show_box.html.haml +9 -0
  163. data/app/views/loadbehind/_view.js.haml +4 -0
  164. data/app/views/loadbehind/growl.js.haml +4 -0
  165. data/app/views/loadbehind/index.js.haml +4 -0
  166. data/app/views/menus/_form.html.haml +13 -0
  167. data/app/views/menus/edit.html.haml +7 -0
  168. data/app/views/menus/index.html.haml +19 -0
  169. data/app/views/menus/new.html.haml +5 -0
  170. data/app/views/menus/show.html.haml +7 -0
  171. data/app/views/pages/_child_pages_links.html.haml +5 -0
  172. data/app/views/pages/_control_panel.html.haml +15 -0
  173. data/app/views/pages/_form.html.haml +27 -0
  174. data/app/views/pages/_form_fields.html.haml +23 -0
  175. data/app/views/pages/_show.html.haml +4 -0
  176. data/app/views/pages/_show_attachment.html.haml +6 -0
  177. data/app/views/pages/_show_small.html.haml +2 -0
  178. data/app/views/pages/create.js.haml +3 -0
  179. data/app/views/pages/destroy.js.haml +3 -0
  180. data/app/views/pages/edit.html.haml +16 -0
  181. data/app/views/pages/edit.js.haml +4 -0
  182. data/app/views/pages/index.html.haml +19 -0
  183. data/app/views/pages/index.js.haml +3 -0
  184. data/app/views/pages/new.html.haml +5 -0
  185. data/app/views/pages/new.js.haml +3 -0
  186. data/app/views/pages/show.html.haml +18 -0
  187. data/app/views/pages/show.js.haml +3 -0
  188. data/app/views/pages/update.js.haml +3 -0
  189. data/app/views/profiles/_form.html.haml +26 -0
  190. data/app/views/profiles/edit.html.haml +7 -0
  191. data/app/views/profiles/index.html.haml +25 -0
  192. data/app/views/profiles/new.html.haml +5 -0
  193. data/app/views/profiles/show.html.haml +21 -0
  194. data/app/views/sitemaps/edit.html.haml +12 -0
  195. data/app/views/sitemaps/index.html.haml +83 -0
  196. data/app/views/sitemaps/index.json.erb +23 -0
  197. data/app/views/sitemaps/new.html.haml +8 -0
  198. data/app/views/sitemaps/new.js.erb +0 -0
  199. data/app/views/users/edit.html.haml +45 -0
  200. data/app/views/users/index.html.haml +19 -0
  201. data/config/amazon_s3.yml +15 -0
  202. data/db/migrate/0000_devise_create_users.rb +26 -0
  203. data/db/migrate/0010_add_fields_to_users.rb +28 -0
  204. data/db/migrate/0020_create_blogs.rb +16 -0
  205. data/db/migrate/0030_create_galleries.rb +15 -0
  206. data/db/migrate/0040_create_images.rb +17 -0
  207. data/db/migrate/0050_create_profiles.rb +24 -0
  208. data/db/migrate/0060_insert_admin_user_and_roles.rb +24 -0
  209. data/db/migrate/0070_create_pages.rb +16 -0
  210. data/db/migrate/0080_create_forums.rb +13 -0
  211. data/db/migrate/0090_create_discussions.rb +14 -0
  212. data/db/migrate/0100_create_forum_messages.rb +15 -0
  213. data/db/migrate/0110_create_access_control_entries.rb +23 -0
  214. data/db/migrate/0120_create_attachments.rb +17 -0
  215. data/db/migrate/0130_create_roles.rb +13 -0
  216. data/db/migrate/0140_create_feedbacks.rb +20 -0
  217. data/db/migrate/0150_create_external_links.rb +14 -0
  218. data/db/migrate/0160_create_sitemaps.rb +17 -0
  219. data/db/migrate/0170_create_menus.rb +14 -0
  220. data/db/migrate/0180_acts_as_taggable_on_migration.rb +28 -0
  221. data/db/migrate/20100912194121_add_stylesheet_to_pages.rb +9 -0
  222. data/db/migrate/20100913073354_add_position_to_access_control_entries.rb +9 -0
  223. data/init.rb +2 -0
  224. data/lib/{core_extensions.rb → generators/core_extensions.rb} +2 -2
  225. data/lib/generators/templates/haml/app/views/layouts/application.html.haml +0 -0
  226. data/lib/generators/wheels/wheels_generator.rb +2 -0
  227. data/lib/generators/wheels_update/wheels_update_generator.rb +1 -1
  228. data/lib/wheels/routes.rb +13 -2
  229. data/wheels.gemspec +254 -122
  230. metadata +268 -124
  231. data/README +0 -2
  232. data/lib/generators/wheels/recipes/public.rb +0 -9
  233. data/lib/generators/wheels_update/core_extensions.3.rb +0 -64
  234. data/lib/wheels/base.rb +0 -7
  235. data/test/functional/access_control_entries_controller_test.rb +0 -49
  236. data/test/functional/app_configs_controller_test.rb +0 -49
  237. data/test/functional/discussions_controller_test.rb +0 -49
  238. data/test/functional/external_links_controller_test.rb +0 -49
  239. data/test/functional/feedback_mailer_test.rb +0 -8
  240. data/test/functional/feedbacks_controller_test.rb +0 -49
  241. data/test/functional/forums_controller_test.rb +0 -49
  242. data/test/functional/layouts_controller_test.rb +0 -49
  243. data/test/functional/member_pages_controller_test.rb +0 -49
  244. data/test/functional/members_controller_test.rb +0 -8
  245. data/test/functional/menus_controller_test.rb +0 -49
  246. data/test/functional/pages_controller_test.rb +0 -49
  247. data/test/functional/product_revisions_controller_test.rb +0 -49
  248. data/test/performance/browsing_test.rb +0 -9
  249. data/test/test_helper.rb +0 -13
  250. data/test/unit/access_control_entry_test.rb +0 -8
  251. data/test/unit/app_config_test.rb +0 -8
  252. data/test/unit/attachment_test.rb +0 -8
  253. data/test/unit/discussion_test.rb +0 -8
  254. data/test/unit/external_link_test.rb +0 -8
  255. data/test/unit/feedback_test.rb +0 -8
  256. data/test/unit/forum_message_test.rb +0 -8
  257. data/test/unit/forum_test.rb +0 -8
  258. data/test/unit/helpers/access_control_entries_helper_test.rb +0 -4
  259. data/test/unit/helpers/app_configs_helper_test.rb +0 -4
  260. data/test/unit/helpers/discussions_helper_test.rb +0 -4
  261. data/test/unit/helpers/external_links_helper_test.rb +0 -4
  262. data/test/unit/helpers/feedbacks_helper_test.rb +0 -4
  263. data/test/unit/helpers/forums_helper_test.rb +0 -4
  264. data/test/unit/helpers/layouts_helper_test.rb +0 -4
  265. data/test/unit/helpers/member_pages_helper_test.rb +0 -4
  266. data/test/unit/helpers/members_helper_test.rb +0 -4
  267. data/test/unit/helpers/menus_helper_test.rb +0 -4
  268. data/test/unit/helpers/pages_helper_test.rb +0 -4
  269. data/test/unit/helpers/product_revisions_helper_test.rb +0 -4
  270. data/test/unit/layout_test.rb +0 -8
  271. data/test/unit/member_page_test.rb +0 -8
  272. data/test/unit/menu_test.rb +0 -8
  273. data/test/unit/page_revision_test.rb +0 -8
  274. data/test/unit/page_test.rb +0 -8
  275. data/test/unit/product_revision_test.rb +0 -8
  276. data/test/unit/settings_test.rb +0 -8
  277. data/test/unit/sitemap_test.rb +0 -8
  278. data/test/unit/user_test.rb +0 -8
  279. /data/{lib/generators/wheels/templates/haml/app/views/layouts/application.html.haml → app/views/sitemaps/edit.js.erb} +0 -0
  280. /data/lib/generators/{wheels/recipes → recipes}/cancan.rb +0 -0
  281. /data/lib/generators/{wheels/recipes → recipes}/cucumber.rb +0 -0
  282. /data/lib/generators/{wheels/recipes → recipes}/default.rb +0 -0
  283. /data/lib/generators/{wheels/recipes → recipes}/design.rb +0 -0
  284. /data/lib/generators/{wheels/recipes → recipes}/devise.rb +0 -0
  285. /data/lib/generators/{wheels/recipes → recipes}/factory_girl.rb +0 -0
  286. /data/lib/generators/{wheels/recipes → recipes}/haml.rb +0 -0
  287. /data/lib/generators/{wheels/recipes → recipes}/jquery.rb +0 -0
  288. /data/lib/generators/{wheels/recipes → recipes}/mongoid.rb +0 -0
  289. /data/lib/generators/{wheels/recipes → recipes}/postgresql.rb +0 -0
  290. /data/lib/generators/{wheels/recipes → recipes}/recipes.rb +0 -0
  291. /data/lib/generators/{wheels/recipes → recipes}/remarkable.rb +0 -0
  292. /data/lib/generators/{wheels/recipes → recipes}/rspec.rb +0 -0
  293. /data/lib/generators/{wheels/recipes → recipes}/wheels.rb +0 -0
  294. /data/lib/generators/{wheels_update/recipes/wheels.rb → recipes/wheels_update.rb} +0 -0
  295. /data/lib/generators/{wheels/snippets → snippets}/cucumber/database_config +0 -0
  296. /data/lib/generators/{wheels/templates → templates}/cancan/ability.rb +0 -0
  297. /data/lib/generators/{wheels/templates → templates}/database/postgresql.yml +0 -0
  298. /data/lib/generators/{wheels/templates → templates}/git/gitignore +0 -0
  299. /data/lib/generators/{wheels/templates → templates}/mongoid/features/step_definitions/mongoid_steps.rb +0 -0
  300. /data/lib/generators/{wheels/templates → templates}/mongoid/features/support/hooks.rb +0 -0
@@ -0,0 +1,83 @@
1
+ - include_ckeditor
2
+ = content_for :head do
3
+ = javascript_include_tag %w(jquery.hotkeys jquery.cookie jquery.jstree)
4
+ = javascript_include_tag %(sitemap_jstree)
5
+ = stylesheet_link_tag %(admin)
6
+
7
+ = sidebar_content do
8
+ #control_panel
9
+ #control_panel_handle
10
+ %h3 Control Panel
11
+ #sitemap_container
12
+ #sitemap.sitemap
13
+
14
+ #content_pane
15
+ #dialog_form
16
+
17
+ :javascript
18
+ $(function () {
19
+ // $('#control_panel').draggable({handle: '#control_panel_handle', containment: '#content'}).resizable();
20
+
21
+ // Settings up the tree - using $(selector).jstree(options);
22
+ // All those configuration options are documented in the _docs folder
23
+ $.jstree._themes = '/jstree/themes/'
24
+ $("#sitemap")
25
+ .jstree(sitemapJsTreeConfig())
26
+ .bind("create.jstree", jstreeEventDeclarations()["create.jstree"])
27
+ .bind("remove.jstree", jstreeEventDeclarations()["remove.jstree"])
28
+ // { "obj" : obj, "new_name" : new_name, "old_name" : old_name });
29
+ .bind("rename.jstree", jstreeEventDeclarations()["rename.jstree"])
30
+ .bind("select_node.jstree", jstreeEventDeclarations()["select_node.jstree"])
31
+ .bind("move_node.jstree", jstreeEventDeclarations()["move_node.jstree"]);
32
+ });
33
+
34
+ function createSiteMap(data, callback) {
35
+ $.post(
36
+ "#{sitemaps_path(:format=>:json)}",
37
+ {
38
+ "utf8" : "#{"✓".html_safe}",
39
+ #{authenticity_token_json}
40
+ "sitemap[menu_text]" : data['menu_text'],
41
+ "sitemap[position]" : data['position'],
42
+ "sitemap[resource_type]" : data['resource_type'],
43
+ "sitemap[resource_id]" : data['resource_id'],
44
+ "sitemap[parent_id]" : data['parent_id']
45
+ },
46
+ callback
47
+ );
48
+ }
49
+
50
+ function updateSiteMap(data, callback) {
51
+ post_data = {
52
+ "utf8" : "#{"✓".html_safe}",
53
+ "format" : "json",
54
+ #{authenticity_token_json}
55
+ }
56
+ if (data['parent_id'] != null) {post_data['parent_id'] = data['parent_id']}
57
+ if (data['menu_text'] != null) {post_data['sitemap[menu_text]'] = data['menu_text']}
58
+ if (data['position'] != null) {post_data['sitemap[position]'] = data['position']}
59
+ if (data['resource_id'] != null) {post_data['sitemap[resource_id]'] = data['resource_id']}
60
+ if (data['resource_type'] != null) {post_data['sitemap[resource_type]'] = data['resource_type']}
61
+
62
+ $.ajax({
63
+ async : false,
64
+ type: 'PUT',
65
+ url: "/sitemaps/" + data['id'].toString(),
66
+ data : post_data,
67
+ success: callback
68
+ });
69
+ }
70
+
71
+ function deleteSiteMap(node_id, callback) {
72
+ $.ajax({
73
+ async : false,
74
+ type: 'DELETE',
75
+ url: "/sitemaps/" + node_id.toString() + ".json",
76
+ data : {
77
+ "utf8" : "#{"✓".html_safe}",
78
+ #{authenticity_token_json}
79
+ },
80
+ success : callback
81
+ });
82
+ }
83
+
@@ -0,0 +1,23 @@
1
+ {
2
+ data: {
3
+ title=>
4
+ }
5
+ :data=>{
6
+ :title=>self.menu_text,
7
+ :icon=>icon_name,
8
+ },
9
+ :attr=>{
10
+ :id=>"node_#{id}",
11
+ :data_resource_type => self.resource_type,
12
+ :data_resource_id => self.resource_id,
13
+ :data_edit_path =>
14
+ },
15
+ :state=>treeview_state,
16
+ :children=>children.map{|t| t.to_jstree(false)}
17
+ }
18
+
19
+ def to_jstree(root=true)
20
+ r =
21
+ root ? r.to_json : r
22
+ end
23
+
@@ -0,0 +1,8 @@
1
+ = form_for resource, :html=>{:id=>"sitemap_form"} do |f|
2
+ = f.hidden_field :resource_type
3
+ = f.hidden_field :resource_id
4
+ = f.label :menu_text
5
+ = f.text_field :menu_text
6
+ = f.fields_for :resource do |rf|
7
+ = render :partial = "#{resource.resource_type.tableize}/fields_for", :locals=>{:f=>rf}
8
+
File without changes
@@ -0,0 +1,45 @@
1
+ %h1 Change Your Password
2
+
3
+ .form
4
+ = form_for resource do |f|
5
+ -if resource.errors.any?
6
+ #errorExplanation
7
+ %h2= "#{pluralize(resource.errors.count, "error")} prohibited this change:"
8
+ %ul
9
+ - resource.errors.full_messages.each do |msg|
10
+ %li= msg
11
+ .field
12
+ .fieldName Old Password:
13
+ = f.password_field :old_password, :id=>"old_password"
14
+ .field
15
+ .fieldName New Password:
16
+ = f.password_field :password, :id=>"password"
17
+ .field
18
+ .fieldName Confirm Password:
19
+ = f.password_field :password_confirmation
20
+ .submit= f.submit "Change Password"
21
+
22
+ :css
23
+ .extra_form_data {
24
+ display: none;
25
+ }
26
+
27
+ = content_for :head do
28
+ = javascript_include_tag 'jquery.validate'
29
+
30
+
31
+ :javascript
32
+ var checkingPassword = true;
33
+ $(function(){
34
+ jQuery.validator.addMethod("verify_user", function(value, element, params) {
35
+ //alert($(element).attr('data-verify-user-path'));
36
+ return $.ajax({
37
+ async: false,
38
+ url: $(element).attr('data-verify-user-path')+ '?password='+value
39
+ }).responseText == "true";
40
+ }, "Password is incorrect.");
41
+
42
+ $('form').validate({onkeyup: function(element) {}});
43
+ $('#old_password').rules("add", {verify_user : true, alphanumeric: true})
44
+ });
45
+
@@ -0,0 +1,19 @@
1
+ %h1 Users
2
+ %ul
3
+ - for user in @users
4
+ %li
5
+ %table.no_border
6
+ %tr
7
+ %td= link_to user.login, user_profile_path(user)
8
+ %td= "#{user.first_name} #{user.last_name}"
9
+ %td!= image_tag user.image.url(:thumb)
10
+ - if can? :manage, User
11
+ %td!= link_to 'Edit', edit_user_path(user)
12
+ %td!= link_to 'Destroy', user, "data-confirm"=>"Really delete #{user.alias}?", :method=>"delete"
13
+ %td{:id=>user.element_id(:confirm)}
14
+ - if user.confirmed_at
15
+ Confirmed
16
+ - else
17
+ = form_for user, :remote=>true do |f|
18
+ = f.hidden_field
19
+
@@ -0,0 +1,15 @@
1
+ development:
2
+ bucket: <%= bucket %>
3
+ access_key_id: <%= access_key_id %>
4
+ secret_access_key: <%= secret_access_key %>
5
+
6
+ test:
7
+ bucket: <%= bucket %>
8
+ access_key_id: <%= access_key_id %>
9
+ secret_access_key: <%= secret_access_key %>
10
+
11
+ production:
12
+ bucket: <%= bucket %>
13
+ access_key_id: <%= access_key_id %>
14
+ secret_access_key: <%= secret_access_key %>
15
+
@@ -0,0 +1,26 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table(:users) do |t|
4
+ t.database_authenticatable :null => false
5
+ t.recoverable
6
+ t.rememberable
7
+ t.trackable
8
+
9
+ # t.confirmable
10
+ # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
11
+ # t.token_authenticatable
12
+
13
+ t.timestamps
14
+ end
15
+
16
+ add_index :users, :email, :unique => true
17
+ add_index :users, :reset_password_token, :unique => true
18
+ # add_index :users, :confirmation_token, :unique => true
19
+ # add_index :users, :unlock_token, :unique => true
20
+ end
21
+
22
+ def self.down
23
+ drop_table :users
24
+ end
25
+ end
26
+
@@ -0,0 +1,28 @@
1
+ class AddFieldsToUsers < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :users, :confirmation_token, :string
4
+ add_column :users, :confirmed_at, :datetime
5
+ add_column :users, :confirmation_sent_at, :datetime
6
+ add_column :users, :failed_attempts, :integer, :default => 0
7
+ add_column :users, :unlock_token, :string
8
+ add_column :users, :locked_at, :datetime
9
+ add_column :users, :authentication_token, :string
10
+ add_column :users, :login, :string
11
+ add_column :users, :name, :string
12
+ add_column :users, :role_id, :integer
13
+ end
14
+
15
+ def self.down
16
+ remove_column :users, :confirmation_token
17
+ remove_column :users, :confirmed_at
18
+ remove_column :users, :confirmation_sent_at
19
+ remove_column :users, :failed_attempts
20
+ remove_column :users, :unlock_token
21
+ remove_column :users, :locked_at
22
+ remove_column :users, :authentication_token
23
+ remove_column :users, :login
24
+ remove_column :users, :name
25
+ remove_column :users, :role_id
26
+ end
27
+ end
28
+
@@ -0,0 +1,16 @@
1
+ class CreateBlogs < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :blogs do |t|
4
+ t.integer :user_id
5
+ t.string :title
6
+ t.text :body
7
+ t.timestamps
8
+ end
9
+
10
+ end
11
+
12
+ def self.down
13
+ drop_table :blogs
14
+ end
15
+ end
16
+
@@ -0,0 +1,15 @@
1
+ class CreateGalleries < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :galleries do |t|
4
+ t.string :name
5
+ t.text :description
6
+ t.integer :user_id
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :galleries
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ class CreateImages < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :images do |t|
4
+ t.string :image_file_name
5
+ t.string :image_content_type
6
+ t.integer :image_file_size
7
+ t.datetime :image_updated_at
8
+ t.integer :gallery_id
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :images
15
+ end
16
+ end
17
+
@@ -0,0 +1,24 @@
1
+ class CreateProfiles < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :profiles do |t|
4
+ t.string :first_name
5
+ t.string :last_name
6
+ t.string :alias
7
+ t.string :blog_title
8
+ t.text :about_me
9
+ t.integer :user_id
10
+ t.string :image_file_name
11
+ t.string :image_content_type
12
+ t.integer :image_file_size
13
+ t.datetime :image_updated_at
14
+ t.timestamps
15
+ end
16
+ add_index :profiles, :alias, :unique=>true
17
+ add_index :profiles, :user_id, :unique=>true
18
+ end
19
+
20
+ def self.down
21
+ drop_table :profiles
22
+ end
23
+ end
24
+
@@ -0,0 +1,24 @@
1
+ class InsertAdminUserAndRoles < ActiveRecord::Migration
2
+ def self.up
3
+ Role.create(:name=>"Super")
4
+ Role.create(:name=>"Admin")
5
+ Role.create(:name=>"User")
6
+ user = User.create(:email=>"<%= user_email %>",
7
+ :password=>"<%= user_password %>",
8
+ :confirmed_at=>DateTime::now,
9
+ :role=>:super)
10
+ Profile.create(
11
+ :first_name => "<%= user_first_name %>",
12
+ :last_name => "<%= user_last_name %>",
13
+ :blog_title => "<%= user_blog_title %>",
14
+ :alias => "<%= user_alias %>",
15
+ :user => user
16
+ )
17
+ end
18
+
19
+ def self.down
20
+ User.find_by_email("<%= user_email %>").destroy
21
+ Role.all.each {|t| t.destroy}
22
+ end
23
+ end
24
+
@@ -0,0 +1,16 @@
1
+ class CreatePages < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :pages do |t|
4
+ t.string :title
5
+ t.text :body
6
+ t.boolean :show_title, :default => true
7
+ t.integer :parent_id
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :pages
14
+ end
15
+ end
16
+
@@ -0,0 +1,13 @@
1
+ class CreateForums < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :forums do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :forums
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ class CreateDiscussions < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :discussions do |t|
4
+ t.string :subject
5
+ t.integer :forum_id
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :discussions
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ class CreateForumMessages < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :forum_messages do |t|
4
+ t.integer :author_id
5
+ t.text :message
6
+ t.integer :discussion_id
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :forum_messages
13
+ end
14
+ end
15
+
@@ -0,0 +1,23 @@
1
+ class CreateAccessControlEntries < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :access_control_entries do |t|
4
+ t.string :resource_type
5
+ t.integer :resource_id
6
+ t.integer :user_id
7
+ t.integer :role_id
8
+ t.boolean :can
9
+ t.string :verb
10
+ t.string :serialized_options
11
+ t.timestamps
12
+ end
13
+ add_index :access_control_entries, :resource_type
14
+ add_index :access_control_entries, [:resource_type, :resource_id]
15
+ add_index :access_control_entries, :user_id
16
+ add_index :access_control_entries, :role_id
17
+ end
18
+
19
+ def self.down
20
+ drop_table :access_control_entries
21
+ end
22
+ end
23
+
@@ -0,0 +1,17 @@
1
+ class CreateAttachments < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :attachments do |t|
4
+ t.string :file_file_name
5
+ t.string :file_content_type
6
+ t.integer :file_file_size
7
+ t.datetime :file_updated_at
8
+ t.integer :page_id
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :attachments
15
+ end
16
+ end
17
+
@@ -0,0 +1,13 @@
1
+ class CreateRoles < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :roles do |t|
4
+ t.string :name
5
+ t.timestamps
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ drop_table :roles
11
+ end
12
+ end
13
+
@@ -0,0 +1,20 @@
1
+ class CreateFeedbacks < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :feedbacks do |t|
4
+ t.string :name
5
+ t.string :phone
6
+ t.string :subject
7
+ t.boolean :been_read
8
+ t.string :email
9
+ t.text :message
10
+ t.boolean :want_response
11
+
12
+ t.timestamps
13
+ end
14
+ end
15
+
16
+ def self.down
17
+ drop_table :feedbacks
18
+ end
19
+ end
20
+
@@ -0,0 +1,14 @@
1
+ class CreateExternalLinks < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :external_links do |t|
4
+ t.string :url
5
+ t.text :link_text
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :external_links
12
+ end
13
+ end
14
+
@@ -0,0 +1,17 @@
1
+ class CreateSitemaps < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :sitemaps do |t|
4
+ t.integer :position
5
+ t.string :menu_text
6
+ t.string :resource_type
7
+ t.integer :resource_id
8
+ t.integer :parent_id
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :sitemaps
15
+ end
16
+ end
17
+
@@ -0,0 +1,14 @@
1
+ class CreateMenus < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :menus do |t|
4
+ t.string :title
5
+ t.timestamps
6
+ end
7
+ Menu.create(:title=>"Main Menu")
8
+ end
9
+
10
+ def self.down
11
+ drop_table :menus
12
+ end
13
+ end
14
+
@@ -0,0 +1,28 @@
1
+ class ActsAsTaggableOnMigration < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :tags do |t|
4
+ t.string :name
5
+ end
6
+
7
+ create_table :taggings do |t|
8
+ t.references :tag
9
+
10
+ # You should make sure that the column created is
11
+ # long enough to store the required class names.
12
+ t.references :taggable, :polymorphic => true
13
+ t.references :tagger, :polymorphic => true
14
+
15
+ t.string :context
16
+
17
+ t.datetime :created_at
18
+ end
19
+
20
+ add_index :taggings, :tag_id
21
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
22
+ end
23
+
24
+ def self.down
25
+ drop_table :taggings
26
+ drop_table :tags
27
+ end
28
+ end
@@ -0,0 +1,9 @@
1
+ class AddStylesheetToPages < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :pages, :stylesheet, :text
4
+ end
5
+
6
+ def self.down
7
+ remove_column :pages, :stylesheet
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddPositionToAccessControlEntries < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :access_control_entries, :position, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :access_control_entries, :position
8
+ end
9
+ end
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'wheels'
2
+
@@ -16,8 +16,8 @@ module Rails
16
16
  stategies.each {|stategy| stategy.call }
17
17
  end
18
18
 
19
- def gemfile
20
- File.open(File.expand_path('Gemfile', source_root)) do |gemfile|
19
+ def gemfile()
20
+ File.open(File.expand_path('Gemfile', WheelsGenerator::SOURCE_ROOT)) do |gemfile|
21
21
  while line = gemfile.readline
22
22
  line = line.split("#").first.strip
23
23
  if line.index('gem') == 0
@@ -2,11 +2,13 @@ require 'rails/generators'
2
2
  require 'rails/generators/migration'
3
3
  require 'rails/generators/generated_attribute'
4
4
  require 'rails/generators/active_record'
5
+ require File.join(File.dirname(__FILE__), '../core_extensions.rb')
5
6
 
6
7
  class WheelsGenerator < Rails::Generators::Base
7
8
  include Rails::Generators::Migration
8
9
  require File.join(File.dirname(__FILE__), '../core_extensions.rb')
9
10
  source_root File.expand_path('../../../../', __FILE__)
11
+ SOURCE_ROOT = source_root
10
12
  desc "Installs files needed for App Template gem."
11
13
 
12
14
  # argument :scope, :required => false, :default => nil,
@@ -14,7 +14,7 @@ class WheelsUpdateGenerator < Rails::Generators::Base
14
14
  end
15
15
 
16
16
  def load_recipes
17
- apply recipe('wheels')
17
+ apply recipe('wheels_update')
18
18
  end
19
19
 
20
20
  def bundle_install
data/lib/wheels/routes.rb CHANGED
@@ -1,8 +1,18 @@
1
1
  module ActionDispatch::Routing
2
2
  class Mapper
3
3
  def wheels_resources
4
- resources :access_control_entries
5
- resources :app_configs
4
+ resources :access_control_entries do
5
+ collection do
6
+ put :sort
7
+ end
8
+ end
9
+
10
+ resources :app_configs do
11
+ member do
12
+ get :css
13
+ end
14
+ end
15
+
6
16
  resources :blogs, :path=>"blog"
7
17
  resources :external_links
8
18
  resources :feedbacks, :path=>"feedback", :only=>[:new, :index, :create]
@@ -37,6 +47,7 @@ module ActionDispatch::Routing
37
47
  end
38
48
  end
39
49
 
50
+ match '/css' => 'app_configs#css'
40
51
  match '/admin' => "sitemaps#index"
41
52
  match "change_password" => "users#edit"
42
53
  match "verify_password" => "users#verify", :format=>:json