hobo 1.1.0 → 1.3.0.RC

Sign up to get free protection for your applications and to get access to all the features.
Files changed (278) hide show
  1. data/CHANGES.txt +238 -287
  2. data/Rakefile +14 -31
  3. data/VERSION +1 -0
  4. data/{lib/hobo → app/controllers}/dev_controller.rb +6 -6
  5. data/app/controllers/dryml_support_controller.rb +13 -0
  6. data/{rails_generators/hobo_front_controller/templates → app/views/dev}/summary.dryml +7 -10
  7. data/bin/hobo +12 -144
  8. data/config/initializers/inflections.rb +3 -0
  9. data/config/routes.rb +6 -0
  10. data/{doctest → doctests}/hobo/lifecycles.rdoctest +40 -59
  11. data/{doctest → doctests/hobo}/model.rdoctest +33 -40
  12. data/{doctest → doctests/hobo}/multi_model_forms.rdoctest +15 -19
  13. data/{doctest → doctests/hobo}/scopes.rdoctest +27 -41
  14. data/doctests/prepare_testapp.rb +8 -0
  15. data/hobo.gemspec +26 -199
  16. data/lib/generators/hobo/activation_email.rb +11 -0
  17. data/lib/generators/hobo/admin_subsite/admin_subsite_generator.rb +35 -0
  18. data/lib/generators/hobo/admin_subsite/templates/admin.css +20 -0
  19. data/lib/generators/hobo/admin_subsite/templates/admin_tag_injection.erb +10 -0
  20. data/{rails_generators/hobo_admin_site → lib/generators/hobo/admin_subsite}/templates/application.dryml +0 -0
  21. data/{rails_generators/hobo_admin_site/templates/controller.rb → lib/generators/hobo/admin_subsite/templates/controller.rb.erb} +5 -5
  22. data/lib/generators/hobo/admin_subsite/templates/users_index.dryml +7 -0
  23. data/lib/generators/hobo/assets/assets_generator.rb +18 -0
  24. data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/application.css +0 -0
  25. data/lib/generators/hobo/assets/templates/application.dryml.erb +9 -0
  26. data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/dryml-support.js +2 -2
  27. data/lib/generators/hobo/assets/templates/dryml_taglibs_initializer.rb +1 -0
  28. data/lib/generators/hobo/assets/templates/en_injection.yml +19 -0
  29. data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/guest.rb +1 -1
  30. data/lib/generators/hobo/controller.rb +35 -0
  31. data/lib/generators/hobo/controller/controller_generator.rb +6 -0
  32. data/lib/generators/hobo/controller/templates/controller.rb.erb +7 -0
  33. data/{rails_generators/hobo_front_controller → lib/generators/hobo/front_controller}/USAGE +0 -0
  34. data/lib/generators/hobo/front_controller/front_controller_generator.rb +55 -0
  35. data/{rails_generators/hobo_front_controller/templates/controller.rb → lib/generators/hobo/front_controller/templates/controller.rb.erb} +0 -0
  36. data/{rails_generators/hobo_front_controller → lib/generators/hobo/front_controller}/templates/index.dryml +6 -12
  37. data/lib/generators/hobo/i18n/i18n_generator.rb +35 -0
  38. data/lib/generators/hobo/i18n/templates/app.de.yml +30 -0
  39. data/lib/generators/hobo/i18n/templates/app.en.yml +25 -0
  40. data/lib/generators/hobo/i18n/templates/app.es.yml +31 -0
  41. data/lib/generators/hobo/i18n/templates/app.fr.yml +26 -0
  42. data/lib/generators/hobo/i18n/templates/app.it.yml +28 -0
  43. data/lib/generators/hobo/i18n/templates/app.pt-PT.yml +25 -0
  44. data/lib/generators/hobo/i18n/templates/app.ru.yml +24 -0
  45. data/lib/generators/hobo/i18n/templates/hobo.de.yml +204 -0
  46. data/lib/generators/hobo/i18n/templates/hobo.en.yml +195 -0
  47. data/lib/generators/hobo/i18n/templates/hobo.es.yml +202 -0
  48. data/lib/generators/hobo/i18n/templates/hobo.fr.yml +195 -0
  49. data/lib/generators/hobo/i18n/templates/hobo.it.yml +202 -0
  50. data/lib/generators/hobo/i18n/templates/hobo.pt-PT.yml +196 -0
  51. data/lib/generators/hobo/i18n/templates/hobo.ru.yml +200 -0
  52. data/lib/generators/hobo/invite_only.rb +18 -0
  53. data/lib/generators/hobo/model/USAGE +19 -0
  54. data/lib/generators/hobo/model/model_generator.rb +11 -0
  55. data/{rails_generators/hobo_model/templates/model.rb → lib/generators/hobo/model/templates/model_injection.rb.erb} +0 -2
  56. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/USAGE +0 -0
  57. data/lib/generators/hobo/rapid/rapid_generator.rb +24 -0
  58. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/IE7.js +0 -0
  59. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/blank.gif +0 -0
  60. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/hobo-rapid.css +0 -0
  61. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/hobo-rapid.js +65 -65
  62. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/ie7-recalc.js +21 -21
  63. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/lowpro.js +31 -31
  64. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/reset.css +1 -1
  65. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/100-ACD3E6-DBE1E5-H.png +0 -0
  66. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/100-DBE1E5-FCFEF5-H.png +0 -0
  67. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/300-3B5F87-ACD3E6-H.png +0 -0
  68. data/{rails_generators/hobo_rapid/templates/themes/clean → lib/generators/hobo/rapid/templates/themes/clean-sidemenu}/public/images/spinner.gif +0 -0
  69. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/stylesheets/clean-sidemenu.css +81 -0
  70. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/views/clean-sidemenu.dryml +30 -0
  71. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/101-3B5F87-ACD3E6.png +0 -0
  72. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/30-3E547A-242E42.png +0 -0
  73. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/30-DBE1E5-FCFEF5.png +0 -0
  74. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/300-ACD3E6-fff.png +0 -0
  75. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/50-ACD3E6-fff.png +0 -0
  76. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/fieldbg.gif +0 -0
  77. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/pencil.png +0 -0
  78. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/small_close.png +0 -0
  79. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/spinner.gif +0 -0
  80. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/stylesheets/clean.css +16 -16
  81. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/stylesheets/rapid-ui.css +3 -3
  82. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/views/clean.dryml +1 -1
  83. data/lib/generators/hobo/resource/resource_generator.rb +23 -0
  84. data/lib/generators/hobo/routes/USAGE +9 -0
  85. data/lib/generators/hobo/routes/router.rb +115 -0
  86. data/lib/generators/hobo/routes/routes_generator.rb +40 -0
  87. data/lib/generators/hobo/routes/templates/hobo_routes.rb.erb +33 -0
  88. data/lib/generators/hobo/setup_wizard/USAGE +4 -0
  89. data/lib/generators/hobo/setup_wizard/setup_wizard_generator.rb +274 -0
  90. data/lib/generators/hobo/subsite.rb +48 -0
  91. data/lib/generators/hobo/subsite/subsite_generator.rb +16 -0
  92. data/{rails_generators/hobo_subsite → lib/generators/hobo/subsite}/templates/application.dryml +0 -0
  93. data/{rails_generators/hobo_subsite/templates/controller.rb → lib/generators/hobo/subsite/templates/controller.rb.erb} +1 -1
  94. data/lib/generators/hobo/subsite_taglib/subsite_taglib_generator.rb +16 -0
  95. data/{rails_generators/hobo_admin_site/templates/site_taglib.dryml → lib/generators/hobo/subsite_taglib/templates/taglib.dryml.erb} +9 -10
  96. data/lib/generators/hobo/taglib.rb +12 -0
  97. data/lib/generators/hobo/test_framework/test_framework_generator.rb +72 -0
  98. data/lib/generators/hobo/test_options.rb +19 -0
  99. data/{rails_generators/hobo_user_controller → lib/generators/hobo/user_controller}/templates/accept_invitation.dryml +0 -0
  100. data/lib/generators/hobo/user_controller/templates/controller.rb.erb +31 -0
  101. data/lib/generators/hobo/user_controller/user_controller_generator.rb +25 -0
  102. data/lib/generators/hobo/user_mailer/templates/activation.erb +9 -0
  103. data/{rails_generators/hobo_user_model → lib/generators/hobo/user_mailer}/templates/forgot_password.erb +2 -2
  104. data/{rails_generators/hobo_user_model → lib/generators/hobo/user_mailer}/templates/invite.erb +2 -2
  105. data/lib/generators/hobo/user_mailer/templates/mailer.rb.erb +25 -0
  106. data/lib/generators/hobo/user_mailer/user_mailer_generator.rb +33 -0
  107. data/lib/generators/hobo/user_model/USAGE +12 -0
  108. data/{rails_generators/hobo_user_model/templates/model.rb → lib/generators/hobo/user_model/templates/model_injection.rb.erb} +40 -20
  109. data/lib/generators/hobo/user_model/user_model_generator.rb +23 -0
  110. data/lib/generators/hobo/user_resource/user_resource_generator.rb +27 -0
  111. data/lib/hobo.rb +29 -129
  112. data/lib/hobo/controller.rb +37 -47
  113. data/lib/hobo/controller/authentication_support.rb +109 -0
  114. data/lib/hobo/{model_controller.rb → controller/model.rb} +71 -79
  115. data/lib/hobo/{user_controller.rb → controller/user.rb} +59 -49
  116. data/lib/hobo/engine.rb +80 -0
  117. data/lib/hobo/extensions/action_controller/hobo_methods.rb +44 -0
  118. data/lib/hobo/extensions/action_mailer/helper.rb +38 -0
  119. data/lib/{action_view_extensions/helpers → hobo/extensions/action_view}/tag_helper.rb +5 -2
  120. data/lib/hobo/extensions/action_view/translation_helper.rb +25 -0
  121. data/lib/hobo/extensions/active_model/name.rb +16 -0
  122. data/lib/hobo/extensions/active_model/translation.rb +35 -0
  123. data/lib/{active_record/association_collection.rb → hobo/extensions/active_record/associations/collection.rb} +8 -17
  124. data/lib/{active_record/association_proxy.rb → hobo/extensions/active_record/associations/proxy.rb} +6 -7
  125. data/lib/hobo/extensions/active_record/associations/reflection.rb +23 -0
  126. data/lib/hobo/extensions/active_record/associations/scope.rb +35 -0
  127. data/lib/hobo/extensions/active_record/hobo_methods.rb +11 -0
  128. data/lib/hobo/extensions/active_record/permissions.rb +159 -0
  129. data/lib/hobo/extensions/active_record/relation_with_origin.rb +28 -0
  130. data/lib/hobo/extensions/array.rb +27 -0
  131. data/lib/hobo/extensions/enumerable.rb +12 -0
  132. data/lib/hobo/extensions/i18n.rb +17 -0
  133. data/lib/hobo/{hobo_helper.rb → helper.rb} +58 -31
  134. data/lib/hobo/helper/translations.rb +54 -0
  135. data/lib/hobo/helper/translations/normalizer.rb +39 -0
  136. data/lib/hobo/model.rb +61 -95
  137. data/lib/hobo/model/accessible_associations.rb +178 -0
  138. data/lib/hobo/{find_for.rb → model/find_for.rb} +17 -17
  139. data/lib/hobo/model/guest.rb +25 -0
  140. data/lib/hobo/model/include_in_save.rb +55 -0
  141. data/lib/hobo/model/lifecycles.rb +119 -0
  142. data/lib/hobo/model/lifecycles/actions.rb +146 -0
  143. data/lib/hobo/model/lifecycles/creator.rb +74 -0
  144. data/lib/hobo/model/lifecycles/lifecycle.rb +243 -0
  145. data/lib/hobo/model/lifecycles/state.rb +22 -0
  146. data/lib/hobo/model/lifecycles/transition.rb +70 -0
  147. data/lib/hobo/model/permissions.rb +448 -0
  148. data/lib/hobo/model/scopes.rb +38 -0
  149. data/lib/hobo/model/scopes/apply_scopes.rb +21 -0
  150. data/lib/hobo/model/scopes/automatic_scopes.rb +428 -0
  151. data/lib/hobo/model/user_base.rb +184 -0
  152. data/lib/hobo/model/view_hints.rb +123 -0
  153. data/{rapid_generators → lib/hobo/rapid/generators}/rapid/cards.dryml.erb +2 -2
  154. data/{rapid_generators → lib/hobo/rapid/generators}/rapid/forms.dryml.erb +3 -3
  155. data/{rapid_generators → lib/hobo/rapid/generators}/rapid/pages.dryml.erb +38 -51
  156. data/lib/hobo/rapid/helper.rb +166 -0
  157. data/{taglibs → lib/hobo/rapid/taglibs}/rapid.dryml +6 -5
  158. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_core.dryml +286 -118
  159. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_document_tags.dryml +2 -2
  160. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_editing.dryml +45 -45
  161. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_forms.dryml +190 -158
  162. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_generics.dryml +12 -9
  163. data/lib/hobo/rapid/taglibs/rapid_i18n.dryml +107 -0
  164. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_lifecycles.dryml +7 -7
  165. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_navigation.dryml +15 -15
  166. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_pages.dryml +37 -36
  167. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_plus.dryml +107 -43
  168. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_summary.dryml +28 -57
  169. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_support.dryml +9 -9
  170. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_user_pages.dryml +41 -40
  171. data/lib/hobo/routes.rb +31 -0
  172. data/{doctest → test/doctest}/hobo/hobo_helper.rdoctest +11 -11
  173. data/test/irt/generators/admin_subsite.irt +27 -0
  174. data/test/irt/generators/assets.irt +16 -0
  175. data/test/irt/generators/controller.irt +6 -0
  176. data/test/irt/generators/front_controller.irt +30 -0
  177. data/test/irt/generators/helper.rb +31 -0
  178. data/test/irt/generators/model.irt +28 -0
  179. data/test/irt/generators/partials/_account_user_model_tests.rb +21 -0
  180. data/test/irt/generators/partials/_accounts_users_controller_tests.rb +15 -0
  181. data/test/irt/generators/partials/_default_user_model_tests.rb +21 -0
  182. data/test/irt/generators/partials/_default_users_controller_tests.rb +16 -0
  183. data/test/irt/generators/partials/_house_controller_tests.rb +15 -0
  184. data/test/irt/generators/partials/_house_model_tests.rb +18 -0
  185. data/test/irt/generators/partials/_subsite_taglib_admin.rb +4 -0
  186. data/test/irt/generators/partials/_subsite_taglib_admin_invite_only.rb +3 -0
  187. data/test/irt/generators/partials/_subsite_taglib_noopt.rb +4 -0
  188. data/test/irt/generators/partials/_subsite_taglib_variables.rb +27 -0
  189. data/test/irt/generators/partials/_user_mailer_tests.rb +19 -0
  190. data/test/irt/generators/rapid.irt +29 -0
  191. data/test/irt/generators/resource.irt +8 -0
  192. data/test/irt/generators/subsite.irt +52 -0
  193. data/test/irt/generators/subsite_taglib.irt +23 -0
  194. data/test/irt/generators/test_framework.irt +62 -0
  195. data/test/irt/generators/user_controller.irt +10 -0
  196. data/test/irt/generators/user_mailer.irt +20 -0
  197. data/test/irt/generators/user_model.irt +10 -0
  198. data/test/irt/generators/user_resource.irt +14 -0
  199. data/test/irt/readme.txt +7 -0
  200. data/test/permissions/models/models.rb +27 -24
  201. data/test/permissions/test_permissions.rb +104 -104
  202. metadata +239 -217
  203. data/lib/active_record/association_reflection.rb +0 -20
  204. data/lib/active_record/viewhints_validations_interceptor.rb +0 -9
  205. data/lib/hobo/accessible_associations.rb +0 -183
  206. data/lib/hobo/authentication_support.rb +0 -131
  207. data/lib/hobo/generator.rb +0 -26
  208. data/lib/hobo/guest.rb +0 -25
  209. data/lib/hobo/include_in_save.rb +0 -55
  210. data/lib/hobo/lifecycles.rb +0 -137
  211. data/lib/hobo/lifecycles/actions.rb +0 -142
  212. data/lib/hobo/lifecycles/creator.rb +0 -72
  213. data/lib/hobo/lifecycles/lifecycle.rb +0 -249
  214. data/lib/hobo/lifecycles/state.rb +0 -22
  215. data/lib/hobo/lifecycles/transition.rb +0 -70
  216. data/lib/hobo/model_router.rb +0 -290
  217. data/lib/hobo/permissions.rb +0 -451
  218. data/lib/hobo/permissions/associations.rb +0 -175
  219. data/lib/hobo/rapid_helper.rb +0 -157
  220. data/lib/hobo/scopes.rb +0 -43
  221. data/lib/hobo/scopes/apply_scopes.rb +0 -23
  222. data/lib/hobo/scopes/association_proxy_extensions.rb +0 -62
  223. data/lib/hobo/scopes/automatic_scopes.rb +0 -421
  224. data/lib/hobo/scopes/named_scope_extensions.rb +0 -39
  225. data/lib/hobo/tasks/rails.rb +0 -4
  226. data/lib/hobo/translations.rb +0 -93
  227. data/lib/hobo/undefined_access_error.rb +0 -5
  228. data/lib/hobo/user.rb +0 -182
  229. data/lib/hobo/view_hints.rb +0 -115
  230. data/rails/init.rb +0 -10
  231. data/rails_generators/hobo/USAGE +0 -4
  232. data/rails_generators/hobo/hobo_generator.rb +0 -53
  233. data/rails_generators/hobo/templates/application.dryml +0 -1
  234. data/rails_generators/hobo/templates/initializer.rb +0 -2
  235. data/rails_generators/hobo_admin_site/USAGE +0 -16
  236. data/rails_generators/hobo_admin_site/hobo_admin_site_generator.rb +0 -45
  237. data/rails_generators/hobo_admin_site/templates/admin.css +0 -2
  238. data/rails_generators/hobo_admin_site/templates/users_index.dryml +0 -5
  239. data/rails_generators/hobo_front_controller/hobo_front_controller_generator.rb +0 -95
  240. data/rails_generators/hobo_front_controller/templates/functional_test.rb +0 -8
  241. data/rails_generators/hobo_front_controller/templates/helper.rb +0 -2
  242. data/rails_generators/hobo_model/USAGE +0 -25
  243. data/rails_generators/hobo_model/hobo_model_generator.rb +0 -43
  244. data/rails_generators/hobo_model/templates/fixtures.yml +0 -6
  245. data/rails_generators/hobo_model/templates/hints.rb +0 -7
  246. data/rails_generators/hobo_model/templates/unit_test.rb +0 -8
  247. data/rails_generators/hobo_model_controller/USAGE +0 -30
  248. data/rails_generators/hobo_model_controller/hobo_model_controller_generator.rb +0 -46
  249. data/rails_generators/hobo_model_controller/templates/controller.rb +0 -7
  250. data/rails_generators/hobo_model_controller/templates/functional_test.rb +0 -8
  251. data/rails_generators/hobo_model_controller/templates/helper.rb +0 -2
  252. data/rails_generators/hobo_model_resource/USAGE +0 -38
  253. data/rails_generators/hobo_model_resource/hobo_model_resource_generator.rb +0 -73
  254. data/rails_generators/hobo_model_resource/templates/controller.rb +0 -7
  255. data/rails_generators/hobo_model_resource/templates/functional_test.rb +0 -8
  256. data/rails_generators/hobo_model_resource/templates/helper.rb +0 -2
  257. data/rails_generators/hobo_rapid/hobo_rapid_generator.rb +0 -94
  258. data/rails_generators/hobo_subsite/USAGE +0 -16
  259. data/rails_generators/hobo_subsite/hobo_subsite_generator.rb +0 -73
  260. data/rails_generators/hobo_subsite/templates/site_taglib.dryml +0 -13
  261. data/rails_generators/hobo_user_controller/USAGE +0 -34
  262. data/rails_generators/hobo_user_controller/hobo_user_controller_generator.rb +0 -65
  263. data/rails_generators/hobo_user_controller/templates/controller.rb +0 -29
  264. data/rails_generators/hobo_user_controller/templates/functional_test.rb +0 -8
  265. data/rails_generators/hobo_user_controller/templates/helper.rb +0 -2
  266. data/rails_generators/hobo_user_model/USAGE +0 -16
  267. data/rails_generators/hobo_user_model/hobo_user_model_generator.rb +0 -46
  268. data/rails_generators/hobo_user_model/templates/fixtures.yml +0 -19
  269. data/rails_generators/hobo_user_model/templates/mailer.rb +0 -29
  270. data/rails_generators/hobo_user_model/templates/unit_test.rb +0 -8
  271. data/script/destroy +0 -14
  272. data/script/generate +0 -14
  273. data/taglibs/rapid_translations.dryml +0 -36
  274. data/tasks/environments.rake +0 -19
  275. data/tasks/hobo_tasks.rake +0 -58
  276. data/test/generators/test_generator_helper.rb +0 -29
  277. data/test/generators/test_helper.rb +0 -1
  278. data/test/generators/test_hobo_model_controller_generator.rb +0 -56
@@ -16,30 +16,31 @@
16
16
  -->
17
17
  <def tag="login-form" attrs="user-model">
18
18
  <% user_model ||= self.try.model -%>
19
- <form action="&request.request_uri" class="login" merge>
19
+ <form action="&request.fullpath" class="login" merge>
20
20
  <labelled-item-list param>
21
21
  <labelled-item>
22
- <item-label param="login-label"><ht key="hobo.login.email"><%= user_model.login_attribute.to_s.titleize %></ht></item-label>
22
+
23
+ <item-label param="login-label"><t key="hobo.login.#{user_model.login_attribute}"><%= user_model.login_attribute.to_s.titleize %></t></item-label>
23
24
  <item-value><input type="text" name="login" id="login" class="string" param="login-input" /></item-value>
24
25
  </labelled-item>
25
-
26
+
26
27
  <labelled-item>
27
- <item-label param="password-label"><ht key="hobo.login.password">Password</ht></item-label>
28
+ <item-label param="password-label"><t key="hobo.login.password">Password</t></item-label>
28
29
  <item-value>
29
30
  <input type="password" name="password" id="password" class="string" param="password-input"/>
30
31
  </item-value>
31
32
  </labelled-item>
32
-
33
+
33
34
  <labelled-item param="remember-me">
34
- <item-label class="field-label" param="remember-me-label"><ht key="hobo.login.remember_me">Remember me:</ht></item-label>
35
+ <item-label class="field-label" param="remember-me-label"><t key="hobo.login.remember_me">Remember me:</t></item-label>
35
36
  <item-value>
36
37
  <input type="checkbox" name="remember_me" id="remember-me" param="remember-me-input" checked/>
37
38
  </item-value>
38
39
  </labelled-item>
39
40
  </labelled-item-list>
40
41
  <div param="actions">
41
- <submit label="#{ht 'hobo.actions.login', :default=>['Log in'] }" param/><if test="&signup_url" class='nav-item'>
42
- <ht key="hobo.support.or">or</ht> <a param="signup" href="&signup_url"><ht key="hobo.login.signup">Sign up</ht></a></if>
42
+ <submit label="#{t 'hobo.actions.login', :default=>['Log in'] }" param/><if test="&signup_url" class='nav-item'>
43
+ <t key="hobo.support.or">or</t> <a param="signup" href="&signup_url"><t key="hobo.login.signup">Sign up</t></a></if>
43
44
  </div>
44
45
  </form>
45
46
  </def>
@@ -47,18 +48,18 @@
47
48
  <!-- Simple log-in page -->
48
49
  <def tag="login-page">
49
50
  <% remember_me = true if remember_me.nil? %>
50
- <simple-page title="#{ht 'hobo.login.title', :default=>['Log in'] }" merge>
51
-
51
+ <simple-page title="#{t 'hobo.login.title', :default=>['Log in'] }" merge>
52
+
52
53
  <body: class="login-page" param/>
53
-
54
+
54
55
  <content: param>
55
56
  <header param="content-header">
56
- <h2 param="heading"><ht key="hobo.login.heading">Log In</ht></h2>
57
+ <h2 param="heading"><t key="hobo.login.heading">Log In</t></h2>
57
58
  </header>
58
-
59
- <section param="content-body">
59
+
60
+ <section param="content-body">
60
61
  <login-form param="form" user-model="&model"/>
61
- <a href="&forgot_password_url" param="forgot-password" if="&forgot_password_url"><ht key="hobo.login.forgot_password">Forgot your password?</ht></a>
62
+ <a href="&forgot_password_url" param="forgot-password" if="&forgot_password_url"><t key="hobo.login.forgot_password">Forgot your password?</t></a>
62
63
  </section>
63
64
  </content:>
64
65
  </simple-page>
@@ -68,35 +69,35 @@
68
69
  <!-- The page that initiates the forgotten password process. Contains a single text-input where the user can provide
69
70
  their email address -->
70
71
  <def tag="forgot-password-page">
71
- <simple-page title="#{ht 'hobo.forgot_password.title', :default=>['Forgotten Password'] }" merge>
72
-
72
+ <simple-page title="#{t 'hobo.forgot_password.title', :default=>['Forgotten Password'] }" merge>
73
+
73
74
  <body: class="forgot-password-page" param/>
74
-
75
+
75
76
  <content: param>
76
77
  <header param="content-header">
77
- <h2 param="heading"><ht key="hobo.forgot_password.heading">Forgotten Password</ht></h2>
78
- <p><ht key="hobo.forgot_password.text">Enter the email address you signed up with. If we have it in
78
+ <h2 param="heading"><t key="hobo.forgot_password.heading">Forgotten Password</t></h2>
79
+ <p><t key="hobo.forgot_password.text">Enter the email address you signed up with. If we have it in
79
80
  our records we'll send you an email allowing you to choose a new
80
- password.</ht></p>
81
+ password.</t></p>
81
82
  </header>
82
83
 
83
84
  <section param="content-body">
84
85
  <form action="" class="forgot-password" param>
85
86
  <labelled-item-list param>
86
87
  <labelled-item>
87
- <item-label param="email-address-label"><ht key="hobo.forgot_password.email">Email Address</ht></item-label>
88
+ <item-label param="email-address-label"><t key="hobo.forgot_password.email_address">Email Address</t></item-label>
88
89
  <item-value>
89
90
  <input type="text" name="email_address" id="email-address" class="email-address" param="email-address-input" />
90
91
  </item-value>
91
92
  </labelled-item>
92
93
  </labelled-item-list>
93
94
  <div param="actions">
94
- <submit label="#{ht 'hobo.actions.send', :default=>['Send'] }" param/>
95
+ <submit label="#{t 'hobo.actions.send', :default=>['Send'] }" param/>
95
96
  </div>
96
97
  </form>
97
98
  </section>
98
99
  </content:>
99
-
100
+
100
101
  </simple-page>
101
102
  </def>
102
103
 
@@ -104,26 +105,26 @@
104
105
  entered is in our records". This is to avoid a privacy concern that the forgotten-password mechanism can be otherwise used to tell
105
106
  if a given email is associated with an account or not. -->
106
107
  <def tag="forgot-password-email-sent-page">
107
- <simple-page title="#{ht 'hobo.forgot_password_sent.title', :default=>['Forgotten Password - Sent'] }" merge>
108
+ <simple-page title="#{t 'hobo.forgot_password_sent.title', :default=>['Forgotten Password - Sent'] }" merge>
108
109
  <body: class="forgot-password-page" param/>
109
-
110
+
110
111
  <content: param>
111
112
  <header param="content-header">
112
- <h2 param><ht key="hobo.forgot_password_sent.heading">Forgotten Password - Sent</ht></h2>
113
+ <h2 param><t key="hobo.forgot_password_sent.heading">Forgotten Password - Sent</t></h2>
113
114
  </header>
114
115
 
115
116
  <section param="content-body">
116
117
  <p param="message">
117
- <ht key="hobo.forgot_password_sent.text" email="#{params[:email_address]}">
118
+ <t key="hobo.forgot_password_sent.text" email-address="#{params[:email_address]}">
118
119
  If the e-mail address you entered, <%= h params[:email_address] %>,
119
120
  is in our records, you will
120
121
  receive an e-mail from us with instructions for resetting your
121
122
  password. If you don't receive this e-mail, please check your
122
- junk mail folder.</ht></p>
123
- <p><a href="#{base_url}/"><ht key="hobo.actions.back">Back to</ht> <app-name/></a></p>
123
+ junk mail folder.</t></p>
124
+ <p><a href="#{base_url}/"><t key="hobo.actions.back">Back to</t> <app-name/></a></p>
124
125
  </section>
125
126
  </content:>
126
-
127
+
127
128
  </simple-page>
128
129
  </def>
129
130
 
@@ -131,17 +132,17 @@ if a given email is associated with an account or not. -->
131
132
  <!-- The page that is displayed on attempting to log in to an account that has been disabled. -->
132
133
  <def tag="account-disabled-page">
133
134
 
134
- <simple-page title="Account not available" merge>
135
-
135
+ <simple-page title="#{t 'hobo.account_disabled_page.title', :default=>['Account Disabled'] }" merge>
136
+
136
137
  <body: class="account-disabled-page" param/>
137
138
 
138
139
  <content: param>
139
140
  <header param="content-header">
140
- <h2 param>Account is not available</h2>
141
+ <h2 param><t key="hobo.account_disabled_page.heading">Account is disabled</t></h2>
141
142
  </header>
142
143
 
143
144
  <section param="content-body">
144
- <p>Your account is not available at this time.</p>
145
+ <p><t key="hobo.account_disabled_page.text">Your account is disabled at this time.</t></p>
145
146
  </section>
146
147
  </content:>
147
148
  </simple-page>
@@ -152,7 +153,7 @@ if a given email is associated with an account or not. -->
152
153
  <!-- Basic account page that provides the ability for the user to change their email address and password. -->
153
154
  <def tag="account-page">
154
155
 
155
- <page title="#{name} - Account" merge>
156
+ <page title="#{t 'hobo.account_page.title', :default=>['Your Account'] }" merge>
156
157
 
157
158
  <body: class="user-account-page #{type_name}" param/>
158
159
 
@@ -165,17 +166,17 @@ if a given email is associated with an account or not. -->
165
166
  <error-messages param/>
166
167
  <form class="change-password" param>
167
168
  <field-list fields="email_address, current_password, password, password_confirmation" param>
168
- <password-label:><ht key="users.new_password">"New Password</ht></password-label:>
169
- <password-confirmation-label:><ht key="users.confirm_new_password">Confirm New Password</ht></password-confirmation-label:>
169
+ <password-label:><t key="hobo.account_page.new_password">New Password</t></password-label:>
170
+ <password-confirmation-label:><t key="hobo.account_page.confirm_new_password">Confirm New Password</t></password-confirmation-label:>
170
171
  </field-list>
171
172
 
172
173
  <div class="actions" param="actions">
173
- <submit label="Save" param/>
174
+ <submit label="#{t 'hobo.actions.save_account', :default=>'Save'}" param/>
174
175
  </div>
175
176
  </form>
176
177
  </section>
177
178
  </content:>
178
-
179
+
179
180
  </page>
180
181
 
181
182
  </def>
@@ -0,0 +1,31 @@
1
+ module Hobo
2
+ module Routes
3
+ extend self
4
+
5
+ def reset_linkables
6
+ @linkable_keys = Set.new
7
+ end
8
+
9
+ def linkable_key(klass, action, options)
10
+ subsite = options[:subsite] || options['subsite']
11
+ method = options[:method] || options['method'] || :get
12
+ [ subsite, klass.name, action, method ].join('/')
13
+ end
14
+
15
+ def linkable!(klass, action, options={})
16
+ @linkable_keys << linkable_key(klass, action, options)
17
+ end
18
+
19
+ def linkable?(klass, action, options={})
20
+ @linkable_keys.member? linkable_key(klass, action, options)
21
+ end
22
+
23
+ def models_with(wanted_action)
24
+ @linkable_keys.map do |k|
25
+ subsite, class_name, action, method = k.split('/')
26
+ (action == wanted_action.to_s) ? class_name.constantize : nil
27
+ end.compact
28
+ end
29
+
30
+ end
31
+ end
@@ -1,19 +1,19 @@
1
- # Hobo::HoboHelper
1
+ # Hobo::Helper
2
2
 
3
3
  Various view helpers
4
4
 
5
5
  doctest_require: 'rubygems'
6
6
  doctest_require: 'active_support'
7
7
  doctest_require: 'mocha'
8
- doctest_require: '../../../hobosupport/lib/hobosupport'
9
- doctest_require: '../../../hobofields/lib/hobofields'
8
+ doctest_require: '../../../hobo_support/lib/hobo_support'
9
+ doctest_require: '../../../hobo_fields/lib/hobo_fields'
10
10
  doctest_require: '../../lib/hobo'
11
11
 
12
12
  Create a mock view layer:
13
13
 
14
- >>
14
+ >>
15
15
  class View
16
- extend Hobo::HoboHelper
16
+ extend Hobo::Helper
17
17
  class << self
18
18
  protected_instance_methods.each {|m| public m }
19
19
 
@@ -22,7 +22,7 @@ Create a mock view layer:
22
22
  def base_url; "" ;end
23
23
  end
24
24
  end
25
- >> RAILS_ROOT = "test-app"
25
+ >> Rails.root = "test-app"
26
26
 
27
27
  Useful stuff
28
28
 
@@ -49,19 +49,19 @@ Something to link to:
49
49
 
50
50
  ### Simple 'show' URLs
51
51
 
52
- >> Hobo::ModelRouter.expects(:linkable?).with(Thing, :show, {:subsite => ''}).returns(true)
52
+ >> Hobo::Routes.expects(:linkable?).with(Thing, :show, {:subsite => ''}).returns(true)
53
53
  >> View.object_url(thing)
54
54
  => "/things/1"
55
55
 
56
- Returns nil if ModelRouter says it's not linkable
56
+ Returns nil if Routes says it's not linkable
57
57
 
58
- >> Hobo::ModelRouter.expects(:linkable?).with(Thing, :show, {:subsite => ''}).returns(false)
58
+ >> Hobo::Routes.expects(:linkable?).with(Thing, :show, {:subsite => ''}).returns(false)
59
59
  >> View.object_url(thing)
60
60
  => nil
61
61
 
62
62
  A URL to the 'edit' page:
63
63
 
64
- >> Hobo::ModelRouter.expects(:linkable?).with(Thing, :edit, {:subsite => ''}).returns(true)
64
+ >> Hobo::Routes.expects(:linkable?).with(Thing, :edit, {:subsite => ''}).returns(true)
65
65
  >> View.object_url(thing, :edit)
66
66
  => "/things/1/edit"
67
67
 
@@ -69,7 +69,7 @@ A URL to the 'edit' page:
69
69
  ### POST URLs for creating new items in collections:
70
70
 
71
71
  >> collection = mock(:origin => thing, :origin_attribute => "parts")
72
- >> Hobo::ModelRouter.expects(:linkable?).with(Thing, :create_part, {:subsite => '', :method => :post}).returns(true)
72
+ >> Hobo::Routes.expects(:linkable?).with(Thing, :create_part, {:subsite => '', :method => :post}).returns(true)
73
73
  >> View.object_url(collection, :method => :post)
74
74
  => "/things/1/parts"
75
75
 
@@ -0,0 +1,27 @@
1
+ require File.expand_path('../helper.rb', __FILE__)
2
+
3
+
4
+ invoke 'hobo:assets', %w[ -q ]
5
+ invoke 'hobo:admin_subsite', %w[ -q ]
6
+ desc "Admin Subsite files exist"
7
+ files_exist? %w[ app/controllers/admin/admin_site_controller.rb
8
+ test/functional/admin_site_controller_test.rb
9
+ public/stylesheets/admin.css
10
+ app/controllers/admin/users_controller.rb
11
+ app/helpers/admin/users_helper.rb
12
+ test/unit/helpers/admin/users_helper_test.rb
13
+ app/views/taglibs/admin_site.dryml
14
+ ]
15
+ test_value_eql? true
16
+
17
+ desc "application.dryml injection matches"
18
+ file_include? "app/views/taglibs/application.dryml",
19
+ %(<extend tag="page">
20
+ <old-page merge>
21
+ <footer:>
22
+ <a href="&admin_users_url" if="&current_user.administrator?">Admin</a>
23
+ </footer:>
24
+ </old-page>
25
+ </extend>
26
+ )
27
+ test_value_eql? true
@@ -0,0 +1,16 @@
1
+ require File.expand_path('../helper.rb', __FILE__)
2
+
3
+
4
+ desc "hobo:assets invoke"
5
+ invoke 'hobo:assets', %w(-q)
6
+
7
+ files_exist? %w[ app/views/taglibs/application.dryml
8
+ public/stylesheets/application.css
9
+ public/javascripts/dryml-support.js
10
+ app/models/guest.rb
11
+ ]
12
+ test_value_eql? true
13
+
14
+ desc "Application.dryml content matches"
15
+ file_include? 'app/views/taglibs/application.dryml', '<set-theme name="clean"/>'
16
+ test_value_eql? true
@@ -0,0 +1,6 @@
1
+ require File.expand_path('../helper.rb', __FILE__)
2
+
3
+
4
+ invoke 'hobo:controller' , %w(houses -q)
5
+
6
+ eval_file '../partials/_house_controller_tests.rb'
@@ -0,0 +1,30 @@
1
+ require File.expand_path('../helper.rb', __FILE__)
2
+
3
+
4
+ invoke 'hobo:front_controller', %w[ -q ]
5
+ desc "All files exist"
6
+ files_exist? %w[ app/controllers/front_controller.rb
7
+ app/helpers/front_helper.rb
8
+ test/unit/helpers/front_helper_test.rb
9
+ test/functional/front_controller_test.rb
10
+ app/views/front/index.dryml ]
11
+ test_value_eql? true
12
+
13
+ desc "public/index.html removed"
14
+ File.exists? 'public/index.html'
15
+ test_value_eql? false
16
+
17
+
18
+ desc "front_controller.rb content matches"
19
+ file_include? 'app/controllers/front_controller.rb',
20
+ 'hobo_controller',
21
+ 'def index',
22
+ 'def search'
23
+ test_value_eql? true
24
+
25
+
26
+ desc "Routes added"
27
+ file_include? 'config/routes.rb',
28
+ %(match 'search' => 'front#search', :as => 'site_search'),
29
+ %(root :to => 'front#index')
30
+ test_value_eql? true
@@ -0,0 +1,31 @@
1
+ irt_at_exit{git_reset_app}
2
+
3
+ def invoke(*args)
4
+ Rails::Generators.invoke *args
5
+ end
6
+
7
+ def files_exist?(paths)
8
+ missing = paths.reject{|f| File.exists?(f)}
9
+ missing.empty? || missing
10
+ end
11
+
12
+ def file_include?(path, *strings)
13
+ file_content path, :select, *strings
14
+ end
15
+
16
+ def file_exclude?(path, *strings)
17
+ file_content path, :reject, *strings
18
+ end
19
+
20
+ def file_content(path, action, *strings)
21
+ f = File.read(path)
22
+ wrong = strings.send(action) do |s|
23
+ re = s.is_a?(Regexp) ? s : /#{Regexp.escape(s)}/
24
+ !(f =~ re)
25
+ end
26
+ wrong.empty? || wrong
27
+ end
28
+
29
+ def git_reset_app
30
+ system %(cd #{Hobo.root} && rake test:prepare_testapp -q)
31
+ end
@@ -0,0 +1,28 @@
1
+ require File.expand_path('../helper.rb', __FILE__)
2
+
3
+
4
+ invoke 'hobo:model', %w(house alpha:string -q)
5
+
6
+ eval_file '../partials/_house_model_tests.rb'
7
+
8
+ invoke 'hobo:model', %w(nest/ed alpha:string -q)
9
+
10
+ desc "Nested files exist"
11
+ files_exist? %w[ app/models/nest/ed.rb
12
+ app/models/nest.rb
13
+ test/unit/nest/ed_test.rb
14
+ test/fixtures/nest/eds.yml
15
+ app/viewhints/nest/ed_hints.rb ]
16
+ test_value_eql? true
17
+
18
+ desc "Nested injection matches"
19
+ file_include? 'app/models/nest/ed.rb',
20
+ 'hobo_model',
21
+ 'fields do',
22
+ /alpha\s+\:string/
23
+ test_value_eql? true
24
+
25
+ desc "Nested hint content matches"
26
+ file_include? 'app/viewhints/nest/ed_hints.rb',
27
+ 'class Nest::EdHints'
28
+ test_value_eql? true
@@ -0,0 +1,21 @@
1
+ desc "Account Model files exist"
2
+ files_exist? %w[ app/models/account.rb
3
+ app/models/account.rb
4
+ test/unit/account_test.rb
5
+ test/fixtures/accounts.yml
6
+ app/viewhints/account_hints.rb
7
+ ]
8
+ test_value_eql? true
9
+
10
+ desc "Account Model injection matches"
11
+ file_include? 'app/models/account.rb',
12
+ 'hobo_user_model',
13
+ 'fields do',
14
+ /name\s+\:string/ ,
15
+ /email_address\s+\:email_address/
16
+ test_value_eql? true
17
+
18
+ desc "Nested hint content matches"
19
+ file_include? 'app/viewhints/account_hints.rb',
20
+ 'class AccountHints'
21
+ test_value_eql? true