hobo 0.7.5 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (212) hide show
  1. data/{hobo_files/plugin/CHANGES.txt → CHANGES.txt} +391 -0
  2. data/Manifest +146 -0
  3. data/{hobo_files/plugin/README → README} +0 -0
  4. data/bin/hobo +13 -26
  5. data/dryml_generators/rapid/cards.dryml.erb +55 -0
  6. data/dryml_generators/rapid/forms.dryml.erb +43 -0
  7. data/dryml_generators/rapid/pages.dryml.erb +284 -0
  8. data/hobo.gemspec +168 -0
  9. data/init.rb +9 -0
  10. data/lib/action_view_extensions/helpers/tag_helper.rb +7 -0
  11. data/lib/active_record/association_collection.rb +54 -0
  12. data/{hobo_files/plugin/lib → lib}/active_record/association_proxy.rb +12 -4
  13. data/{hobo_files/plugin/lib → lib}/active_record/association_reflection.rb +7 -1
  14. data/{hobo_files/plugin/lib → lib}/extensions/test_case.rb +17 -17
  15. data/{hobo_files/plugin/lib → lib}/hobo.rb +193 -100
  16. data/{hobo_files/plugin/lib → lib}/hobo/authentication_support.rb +8 -8
  17. data/{hobo_files/plugin/lib → lib}/hobo/bundle.rb +90 -89
  18. data/{hobo_files/plugin/lib → lib}/hobo/composite_model.rb +21 -21
  19. data/{hobo_files/plugin/lib → lib}/hobo/controller.rb +38 -25
  20. data/{hobo_files/plugin/lib → lib}/hobo/dev_controller.rb +10 -6
  21. data/lib/hobo/dryml.rb +167 -0
  22. data/{hobo_files/plugin/lib → lib}/hobo/dryml/dryml_builder.rb +28 -25
  23. data/lib/hobo/dryml/dryml_generator.rb +210 -0
  24. data/{hobo_files/plugin/lib → lib}/hobo/dryml/dryml_support_controller.rb +1 -1
  25. data/lib/hobo/dryml/parser.rb +3 -0
  26. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/attribute.rb +6 -6
  27. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/base_parser.rb +16 -16
  28. data/lib/hobo/dryml/parser/document.rb +57 -0
  29. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/element.rb +7 -7
  30. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/elements.rb +9 -9
  31. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/source.rb +3 -3
  32. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/text.rb +3 -3
  33. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/tree_parser.rb +3 -3
  34. data/{hobo_files/plugin/lib → lib}/hobo/dryml/part_context.rb +26 -26
  35. data/{hobo_files/plugin/lib → lib}/hobo/dryml/scoped_variables.rb +15 -15
  36. data/{hobo_files/plugin/lib → lib}/hobo/dryml/tag_parameters.rb +10 -10
  37. data/{hobo_files/plugin/lib → lib}/hobo/dryml/taglib.rb +43 -37
  38. data/{hobo_files/plugin/lib → lib}/hobo/dryml/template.rb +290 -208
  39. data/{hobo_files/plugin/lib → lib}/hobo/dryml/template_environment.rb +173 -115
  40. data/{hobo_files/plugin/lib → lib}/hobo/dryml/template_handler.rb +19 -24
  41. data/lib/hobo/find_for.rb +95 -0
  42. data/{hobo_files/plugin/lib → lib}/hobo/generator.rb +2 -1
  43. data/{hobo_files/plugin/lib → lib}/hobo/guest.rb +12 -4
  44. data/{hobo_files/plugin/lib → lib}/hobo/hobo_helper.rb +146 -117
  45. data/lib/hobo/include_in_save.rb +43 -0
  46. data/lib/hobo/lifecycles.rb +94 -0
  47. data/lib/hobo/lifecycles/actions.rb +73 -0
  48. data/lib/hobo/lifecycles/creator.rb +76 -0
  49. data/lib/hobo/lifecycles/lifecycle.rb +205 -0
  50. data/lib/hobo/lifecycles/state.rb +23 -0
  51. data/lib/hobo/lifecycles/transition.rb +66 -0
  52. data/{hobo_files/plugin/lib → lib}/hobo/model.rb +306 -217
  53. data/{hobo_files/plugin/lib → lib}/hobo/model_controller.rb +342 -213
  54. data/{hobo_files/plugin/lib → lib}/hobo/model_router.rb +151 -120
  55. data/{hobo_files/plugin/lib → lib}/hobo/model_support.rb +9 -9
  56. data/{hobo_files/plugin/lib → lib}/hobo/rapid_helper.rb +30 -23
  57. data/{hobo_files/plugin/lib → lib}/hobo/scopes.rb +22 -68
  58. data/{hobo_files/plugin/lib → lib}/hobo/scopes/apply_scopes.rb +5 -5
  59. data/lib/hobo/scopes/association_proxy_extensions.rb +47 -0
  60. data/{hobo_files/plugin/lib → lib}/hobo/scopes/automatic_scopes.rb +104 -79
  61. data/lib/hobo/scopes/named_scope_extensions.rb +27 -0
  62. data/{hobo_files/plugin/lib → lib}/hobo/static_tags +1 -11
  63. data/{hobo_files/plugin/lib → lib}/hobo/undefined.rb +1 -1
  64. data/{hobo_files/plugin/lib → lib}/hobo/undefined_access_error.rb +0 -0
  65. data/{hobo_files/plugin/lib → lib}/hobo/user.rb +27 -25
  66. data/{hobo_files/plugin/lib → lib}/hobo/user_controller.rb +80 -34
  67. data/{hobo_files/plugin/generators → rails_generators}/hobo/hobo_generator.rb +7 -7
  68. data/rails_generators/hobo/templates/application.css +0 -0
  69. data/{hobo_files/plugin/generators → rails_generators}/hobo/templates/application.dryml +0 -2
  70. data/{hobo_files/plugin/generators → rails_generators}/hobo/templates/dryml-support.js +0 -0
  71. data/{hobo_files/plugin/generators → rails_generators}/hobo/templates/guest.rb +0 -0
  72. data/rails_generators/hobo/templates/initializer.rb +9 -0
  73. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/USAGE +0 -0
  74. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/hobo_front_controller_generator.rb +1 -3
  75. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/templates/controller.rb +1 -1
  76. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/templates/functional_test.rb +0 -0
  77. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/templates/helper.rb +0 -0
  78. data/rails_generators/hobo_front_controller/templates/index.dryml +25 -0
  79. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/USAGE +0 -0
  80. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/hobo_model_generator.rb +0 -0
  81. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/templates/fixtures.yml +0 -0
  82. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/templates/model.rb +0 -0
  83. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/templates/unit_test.rb +0 -0
  84. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/USAGE +0 -0
  85. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/hobo_model_controller_generator.rb +0 -7
  86. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/templates/controller.rb +0 -0
  87. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/templates/functional_test.rb +0 -0
  88. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/templates/helper.rb +0 -0
  89. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/hobo_model_resource_generator.rb +0 -0
  90. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/templates/controller.rb +0 -0
  91. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/templates/functional_test.rb +0 -0
  92. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/templates/helper.rb +0 -0
  93. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/hobo_rapid_generator.rb +21 -11
  94. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/IE7.js +1 -1
  95. data/rails_generators/hobo_rapid/templates/blank.gif +0 -0
  96. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/hobo-rapid.css +0 -0
  97. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/hobo-rapid.js +175 -104
  98. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/lowpro.js +0 -0
  99. data/rails_generators/hobo_rapid/templates/nicEditorIcons.gif +0 -0
  100. data/rails_generators/hobo_rapid/templates/nicedit.js +91 -0
  101. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/reset.css +0 -0
  102. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/fieldbg.gif +0 -0
  103. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/pencil.png +0 -0
  104. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/small_close.png +0 -0
  105. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/spinner.gif +0 -0
  106. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/stylesheets/clean.css +80 -71
  107. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/stylesheets/rapid-ui.css +6 -1
  108. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/views/clean.dryml +4 -4
  109. data/rails_generators/hobo_subsite/hobo_subsite_generator.rb +73 -0
  110. data/rails_generators/hobo_subsite/templates/application.dryml +1 -0
  111. data/rails_generators/hobo_subsite/templates/controller.rb +5 -0
  112. data/rails_generators/hobo_subsite/templates/site_taglib.dryml +13 -0
  113. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/USAGE +0 -0
  114. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/hobo_user_controller_generator.rb +0 -0
  115. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/templates/controller.rb +0 -0
  116. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/templates/functional_test.rb +0 -0
  117. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/templates/helper.rb +0 -0
  118. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_model/USAGE +0 -0
  119. data/rails_generators/hobo_user_model/hobo_user_model_generator.rb +30 -0
  120. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_model/templates/fixtures.yml +0 -0
  121. data/rails_generators/hobo_user_model/templates/forgot_password.erb +10 -0
  122. data/rails_generators/hobo_user_model/templates/mailer.rb +14 -0
  123. data/rails_generators/hobo_user_model/templates/model.rb +55 -0
  124. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_model/templates/unit_test.rb +0 -0
  125. data/script/destroy +14 -0
  126. data/script/generate +14 -0
  127. data/{hobo_files/plugin/taglibs → taglibs}/core.dryml +6 -7
  128. data/{hobo_files/plugin/taglibs → taglibs}/rapid.dryml +36 -67
  129. data/{hobo_files/plugin/taglibs → taglibs}/rapid_document_tags.dryml +7 -24
  130. data/{hobo_files/plugin/taglibs → taglibs}/rapid_editing.dryml +51 -50
  131. data/{hobo_files/plugin/taglibs → taglibs}/rapid_forms.dryml +62 -56
  132. data/taglibs/rapid_generics.dryml +33 -0
  133. data/taglibs/rapid_lifecycles.dryml +43 -0
  134. data/{hobo_files/plugin/taglibs → taglibs}/rapid_navigation.dryml +23 -23
  135. data/taglibs/rapid_pages.dryml +183 -0
  136. data/{hobo_files/plugin/taglibs → taglibs}/rapid_plus.dryml +30 -5
  137. data/{hobo_files/plugin/taglibs → taglibs}/rapid_support.dryml +3 -4
  138. data/taglibs/rapid_user_pages.dryml +179 -0
  139. data/{hobo_files/plugin/tasks → tasks}/environments.rake +0 -0
  140. data/{hobo_files/plugin/tasks → tasks}/fix_dryml.rake +0 -0
  141. data/{hobo_files/plugin/tasks → tasks}/generate_tag_reference.rb +21 -22
  142. data/tasks/hobo_tasks.rake +32 -0
  143. data/test/test_generator_helper.rb +29 -0
  144. data/test/test_helper.rb +1 -0
  145. data/test/test_hobo_model_controller_generator.rb +56 -0
  146. data/{hobo_files/plugin/uninstall.rb → uninstall.rb} +0 -0
  147. metadata +240 -225
  148. data/README.txt +0 -18
  149. data/hobo_files/plugin/LICENSE.txt +0 -22
  150. data/hobo_files/plugin/Rakefile +0 -96
  151. data/hobo_files/plugin/generators/hobo_front_controller/templates/index.dryml +0 -24
  152. data/hobo_files/plugin/generators/hobo_front_controller/templates/search.dryml +0 -19
  153. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/banner.gif +0 -0
  154. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-bodytop.gif +0 -0
  155. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-01.gif +0 -0
  156. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-02.gif +0 -0
  157. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-03.gif +0 -0
  158. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-04.gif +0 -0
  159. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-bottom.gif +0 -0
  160. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-left.gif +0 -0
  161. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-right.gif +0 -0
  162. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-top.gif +0 -0
  163. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-blue.gif +0 -0
  164. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-dblue.gif +0 -0
  165. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-green.gif +0 -0
  166. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-purple.gif +0 -0
  167. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-red.gif +0 -0
  168. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/logo.gif +0 -0
  169. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/plus.png +0 -0
  170. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/spinner.gif +0 -0
  171. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-dblue.gif +0 -0
  172. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-green.gif +0 -0
  173. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-purple.gif +0 -0
  174. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-red.gif +0 -0
  175. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-01.gif +0 -0
  176. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-02.gif +0 -0
  177. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-03.gif +0 -0
  178. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-04.gif +0 -0
  179. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-bottom.gif +0 -0
  180. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-left.gif +0 -0
  181. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-right.gif +0 -0
  182. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-top.gif +0 -0
  183. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/stylesheets/application.css +0 -400
  184. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/views/application.dryml +0 -96
  185. data/hobo_files/plugin/generators/hobo_user_model/hobo_user_model_generator.rb +0 -25
  186. data/hobo_files/plugin/generators/hobo_user_model/templates/model.rb +0 -56
  187. data/hobo_files/plugin/init.rb +0 -101
  188. data/hobo_files/plugin/lib/action_view_extensions/base.rb +0 -15
  189. data/hobo_files/plugin/lib/active_record/has_many_association.rb +0 -55
  190. data/hobo_files/plugin/lib/active_record/has_many_through_association.rb +0 -20
  191. data/hobo_files/plugin/lib/hobo/dryml.rb +0 -165
  192. data/hobo_files/plugin/lib/hobo/dryml/parser/document.rb +0 -53
  193. data/hobo_files/plugin/lib/hobo/scopes/association_proxy_extensions.rb +0 -33
  194. data/hobo_files/plugin/lib/hobo/scopes/defined_scope_proxy_extender.rb +0 -90
  195. data/hobo_files/plugin/lib/hobo/scopes/scope_reflection.rb +0 -18
  196. data/hobo_files/plugin/lib/hobo/scopes/scoped_proxy.rb +0 -55
  197. data/hobo_files/plugin/taglib-docs/core.markdown +0 -165
  198. data/hobo_files/plugin/taglib-docs/rapid.markdown +0 -677
  199. data/hobo_files/plugin/taglib-docs/rapid_document_tags.markdown +0 -240
  200. data/hobo_files/plugin/taglib-docs/rapid_editing.markdown +0 -418
  201. data/hobo_files/plugin/taglib-docs/rapid_forms.markdown +0 -562
  202. data/hobo_files/plugin/taglib-docs/rapid_generics.markdown +0 -187
  203. data/hobo_files/plugin/taglib-docs/rapid_navigation.markdown +0 -214
  204. data/hobo_files/plugin/taglib-docs/rapid_pages.markdown +0 -530
  205. data/hobo_files/plugin/taglib-docs/rapid_plus.markdown +0 -65
  206. data/hobo_files/plugin/taglib-docs/rapid_support.markdown +0 -50
  207. data/hobo_files/plugin/taglib-docs/rapid_user_pages.markdown +0 -129
  208. data/hobo_files/plugin/taglibs/rapid_generics.dryml +0 -117
  209. data/hobo_files/plugin/taglibs/rapid_pages.dryml +0 -359
  210. data/hobo_files/plugin/taglibs/rapid_user_pages.dryml +0 -104
  211. data/hobo_files/plugin/tasks/dump_fixtures.rake +0 -70
  212. data/hobo_files/plugin/tasks/hobo_tasks.rake +0 -17
File without changes
data/bin/hobo CHANGED
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- HOBO_VERSION = "0.7.4"
1
+ #!/usr/bin/env ruby
4
2
 
5
3
  require 'fileutils'
6
4
  Signal.trap("INT") { puts; exit }
@@ -11,14 +9,11 @@ USAGE = "USAGE: hobo <options> <app-path>
11
9
 
12
10
  Options:
13
11
  --user-model <model-name-or-false>
14
- --svn # Use 'svn co' to checkout Hobo trunk
15
- --create-dbs # Run rake db:create:all
12
+ --db-create # Run rake db:create:all
16
13
  --hobo-src <path to hobo src>
17
14
  -d | --database <database> # e.g. mysql, sqlite
18
15
  "
19
16
 
20
- HOBO_REPO = "svn://hobocentral.net/hobo/trunk/hobo"
21
-
22
17
 
23
18
  ### Nasty stuff needed for Windows :-( ###
24
19
  require 'rbconfig'
@@ -28,12 +23,14 @@ if Config::CONFIG["arch"] =~ /win32/
28
23
  def system(command)
29
24
  win = Win32API.new("crtdll", "system", ['P'], 'L').Call(command)
30
25
  end
31
- end
26
+ end
32
27
  ### end nasty stuff ###
33
28
 
34
29
 
35
30
  def command(*s)
36
- ok = system(s.join(' '))
31
+ com = s.join(' ')
32
+ puts "--> #{com}"
33
+ ok = system(com)
37
34
  exit(1) unless ok
38
35
  end
39
36
 
@@ -44,17 +41,15 @@ end
44
41
 
45
42
  app_path = ARGV.pop
46
43
 
47
- user_model = "user"
48
- hobo_svn = create_db = false
44
+ user_model = "user"
45
+ create_db = false
49
46
 
50
47
  until ARGV.empty?
51
48
  case ARGV.shift
52
49
  when "--user-model"
53
50
  arg = ARGV.shift
54
51
  user_model = arg == "false" ? nil : arg
55
- when "--svn"
56
- hobo_svn = true
57
- when "--create-dbs"
52
+ when "--db-create"
58
53
  create_db = true
59
54
  when "--hobo-src"
60
55
  hobo_src = "../" + ARGV.shift
@@ -63,7 +58,7 @@ until ARGV.empty?
63
58
  else
64
59
  puts USAGE
65
60
  exit 1
66
- end
61
+ end
67
62
  end
68
63
 
69
64
  puts "\nGenerating Rails app...\n"
@@ -78,15 +73,7 @@ Dir.chdir(app_path) do
78
73
 
79
74
  FileUtils.touch("public/stylesheets/application.css")
80
75
 
81
- if hobo_svn
82
- puts "\nInstalling Hobo plugin via svn checkout...\n"
83
- command("svn co #{HOBO_REPO} vendor/plugins/hobo")
84
- else
85
- puts "\nInstalling Hobo plugin...\n"
86
- FileUtils.cp_r hobo_src, "vendor/plugins/hobo"
87
- end
88
-
89
- puts "\nInitialising Hobo...\n"
76
+ puts "\nInitialising Hobo...\n"
90
77
  command(gen, "hobo --add-routes")
91
78
 
92
79
  puts "\nInstalling Hobo Rapid and default theme...\n"
@@ -97,10 +84,10 @@ Dir.chdir(app_path) do
97
84
  command("#{gen} hobo_user_model #{user_model}")
98
85
  command("#{gen} hobo_user_controller #{user_model}")
99
86
  end
100
-
87
+
101
88
  puts "\nCreating standard pages...\n"
102
89
  command("#{gen} hobo_front_controller front --delete-index --add-routes")
103
-
90
+
104
91
  if create_db
105
92
  puts "\nCreating databases"
106
93
  command("rake db:create:all")
@@ -0,0 +1,55 @@
1
+ <% each_model do -%>
2
+ <%
3
+ name_attribute = model.name_attribute
4
+ content_attribute = model.primary_content_attribute
5
+ creator_attribute = model.creator_attribute
6
+ primary_collection = primary_collection_name
7
+
8
+ if creator_attribute
9
+ creator_refl = model.reflections[creator_attribute]
10
+ creator_link = creator_refl && linkable?(creator_refl.klass, :show)
11
+ end
12
+
13
+ show_link = linkable?(:show)
14
+ edit_link = !show_link && linkable?(:edit)
15
+ delete_button = !show_link && !edit_link && linkable?(:destroy, :method => :delete)
16
+
17
+ has_actions = edit_link || delete_button
18
+ has_body = (!show_link && content_attribute) || creator_link || creator_attribute || primary_collection
19
+ -%>
20
+ <def tag="card" for="<%= model.name %>">
21
+ <card class="<%= model_name :dashed %>" param="default" merge>
22
+ <% if name_attribute || show_link || has_actions || !has_body -%>
23
+ <header: param>
24
+ <h4 param="heading"><% if show_link %><a><name/></a><% else %><name/><% end %></h4>
25
+ <% if has_actions -%>
26
+ <div param="actions">
27
+ <% if edit_link -%>
28
+ <a action="edit" if="&can_edit?" param="edit-link">Edit</a>
29
+ <% end -%>
30
+ <% if delete_button -%>
31
+ <delete-button label="X" param/>
32
+ <% end -%>
33
+ </div>
34
+ <% end -%>
35
+ </header:>
36
+ <% end -%>
37
+ <% if has_body -%>
38
+ <body: param>
39
+ <% if !show_link && content_attribute -%>
40
+ <view:<%= content_attribute %> param="description"/>
41
+ <% end -%>
42
+ <% if creator_link -%>
43
+ <a:<%= creator_attribute %> param="creator-link"/>
44
+ <% elsif creator_attribute -%>
45
+ <view:<%= creator_attribute %> param="creator"/>
46
+ <% end -%>
47
+ <% if primary_collection -%>
48
+ <count:<%= primary_collection%> param/>
49
+ <% end -%>
50
+ </body:>
51
+ <% end -%>
52
+ </card>
53
+ </def>
54
+
55
+ <% end -%>
@@ -0,0 +1,43 @@
1
+ <% each_controller do -%>
2
+ <%
3
+ form_fields = standard_fields :belongs_to, :has_many
4
+ -%>
5
+ <def tag="form" for="<%= model.name %>">
6
+ <form merge param="default">
7
+ <error-messages/>
8
+ <field-list fields="<%= form_fields * ', ' %>" param/>
9
+ <div param="actions">
10
+ <submit label="Save" param/>
11
+ <do param="cancel">or <a param="cancel-link">Cancel</a></do>
12
+ </div>
13
+ </form>
14
+ </def>
15
+
16
+ <% if defined? model::Lifecycle -%>
17
+ <% model::Lifecycle.creators.values.where.publishable?.each do |creator| -%>
18
+ <def tag="<%= creator.name.dasherize %>-form" polymorphic/>
19
+ <def tag="<%= creator.name.dasherize %>-form" for="<%= model.name %>">
20
+ <form lifecycle="<%= creator.name %>">
21
+ <field-list fields="<%= creator.parameters * ', ' %>" param/>
22
+ <div param="actions">
23
+ <submit label="<%= creator.name.titleize %>" param/><do param="back-link"> or <a>Cancel</a></do>
24
+ </div>
25
+ </form>
26
+ </def>
27
+ <% end -%>
28
+
29
+ <% model::Lifecycle.transitions.where.publishable?.each do |transition| -%>
30
+ <def tag="<%= transition.name.dasherize %>-form" polymorphic/>
31
+ <def tag="<%= transition.name.dasherize %>-form" for="<%= model.name %>">
32
+ <form lifecycle="<%= transition.name %>">
33
+ <input type="hidden" name="key" value="&this.lifecycle.provided_key" if="&this.lifecycle.provided_key"/>
34
+ <field-list fields="<%= transition.parameters * ', ' %>" param/>
35
+ <div param="actions">
36
+ <submit label="<%= transition.name.titleize %>" param/><do param="back-link"> or <a>Cancel</a></do>
37
+ </div>
38
+ </form>
39
+ </def>
40
+ <% end -%>
41
+ <% end # of if defined? model::Lifecycle -%>
42
+
43
+ <% end # of each_model do -%>
@@ -0,0 +1,284 @@
1
+ <!-- ====== Main Navigation ====== -->
2
+
3
+ <def tag="main-nav">
4
+ <navigation class="main-nav" merge-attrs>
5
+ <nav-item href="#{base_url}/">Home</nav-item>
6
+ <% models.select { |m| linkable?(m, :index) }[0..4].each do |m| -%>
7
+ <nav-item with="&<%= m.name %>"><%= m.name.titleize.pluralize %></nav-item>
8
+ <% end -%>
9
+ </navigation>
10
+ </def>
11
+
12
+
13
+
14
+ <% each_controller do -%>
15
+
16
+ <!-- ====== <%= model.name %> Pages ====== -->
17
+ <%
18
+ new_link = linkable?(:new)
19
+ -%>
20
+
21
+
22
+ <def tag="index-page" for="<%= model.name %>">
23
+ <page merge title="<%= model_name :title, :plural %>">
24
+ <body: class="index-page <%= model_class %>" param/>
25
+
26
+ <content: param>
27
+ <header param="content-header">
28
+ <h2 param="heading"><%= model_name :title, :plural %></h2>
29
+
30
+ <p param="count" if>There <count prefix="are"/></p>
31
+ </header>
32
+
33
+ <section param="content-body">
34
+ <% if new_link -%>
35
+
36
+ <a action="new" to="&model" merge-params/>
37
+ <% end -%>
38
+
39
+ <page-nav param="top-page-nav"/>
40
+
41
+ <collection param/>
42
+
43
+ <page-nav param="bottom-page-nav"/>
44
+ </section>
45
+ </content:>
46
+ </page>
47
+ </def>
48
+
49
+
50
+ <def tag="new-page" for="<%= model.name %>">
51
+ <page merge title="New <%= model_name :title %>">
52
+ <body: class="new-page <%= model_class %>" param/>
53
+
54
+ <content: param>
55
+ <section param="content-header">
56
+ <h2 param="heading">New <%= model_name :title %></h2>
57
+ </section>
58
+
59
+ <section param="content-body">
60
+ <form param/>
61
+ </section>
62
+ </content:>
63
+ </page>
64
+ </def>
65
+
66
+
67
+ <%
68
+ back_link = model.dependent_on.detect { |x| !(model.reflections[x].klass < Hobo::User) }
69
+ boolean_fields = model.columns.select { |c| c.type == :boolean }.*.name
70
+ creator = model.creator_attribute
71
+ creator_link = creator && model.reflections[creator] && linkable?(model.reflections[creator].klass, :show)
72
+ edit_link = linkable?(:edit)
73
+ main_content = model.primary_content_attribute
74
+ show_fields = standard_fields(:belongs_to).*.to_s - [model.name_attribute, main_content, creator, back_link, *boolean_fields].*.to_s
75
+ collection = model.dependent_collections.sort_by(&:to_s).first
76
+ if collection
77
+ collection_class = model.reflections[collection].klass
78
+ owner = model.reverse_reflection(collection).name
79
+ add_link = collection &&linkable?(collection_class, :"new_for_#{owner}")
80
+ add_form = !add_link && linkable?(collection_class, :"create_for_#{owner}", :method => :post)
81
+ end
82
+ -%>
83
+ <def tag="show-page" for="<%= model.name %>">
84
+ <page merge title="<%= model_name :title %>">
85
+
86
+ <body: class="show-page <%= model_class %>" param/>
87
+
88
+ <content: param>
89
+ <header param="content-header">
90
+ <% if back_link -%>
91
+ <a:<%= back_link %> param="parent-link">&laquo; <name/></a>
92
+ <% end -%>
93
+ <h2 param="heading"><name/></h2>
94
+ <% if boolean_fields.any? -%>
95
+
96
+ <field-names-where-true fields="<%= boolean_fields * ', ' %>"/>
97
+ <% end -%>
98
+ <% if creator_link -%>
99
+
100
+ <a:<%= model.creator_attribute %> param="creator-link"/>
101
+ <% elsif creator -%>
102
+
103
+ <view:get-creator param="creator-name"/>
104
+ <% end -%>
105
+ <% if edit_link -%>
106
+
107
+ <a action="edit" if="&can_edit?" param="edit-link">Edit <%= model_name :title %></a>
108
+ <% end -%>
109
+ </header>
110
+
111
+ <section param="content-body">
112
+ <% if main_content -%>
113
+ <view:<%= main_content %>/>
114
+ <% end -%>
115
+ <% if show_fields.any? -%>
116
+ <field-list fields="<%= show_fields * ', ' %>" param/>
117
+ <% end -%>
118
+ <% if collection -%>
119
+ <section param="collection-section">
120
+ <h3 param="collection-heading"><%= collection.to_s.titleize %></h3>
121
+
122
+ <% if sortable_collection?(collection) -%>
123
+ <sortable-collection:<%= collection %> param="collection"/>
124
+ <% else -%>
125
+ <collection:<%= collection %> param/>
126
+ <% end -%>
127
+ <% if add_link -%>
128
+
129
+ <a:<%= collection %> action="new" if="&can_create?" param="new-link">New <%= collection.to_s.singularize.titleize %></a>
130
+ <% elsif add_form -%>
131
+
132
+ <section param="add-to-collection" if="&can_create?(@<%= model_name.underscore %>.<%= collection %>)">
133
+ <h3 param="add-form-heading">Add <%= a_or_an collection.to_s.singularize.titleize %></h3>
134
+ <form with="&@<%= collection_class.name.underscore %> || @<%= model_name.underscore %>.<%= collection %>.new" owner="<%= owner %>" method="post" without-or-cancel param>
135
+ <field-list: skip="<%= owner %>"/>
136
+ <submit: label="Add"/>
137
+ </form>
138
+ </section>
139
+ <% end -%>
140
+ </section>
141
+ <% end -%>
142
+ </section>
143
+ </content:>
144
+
145
+ </page>
146
+ </def>
147
+
148
+
149
+ <%
150
+ name_attribute = model.name_attribute
151
+ -%>
152
+ <def tag="edit-page" for="<%= model.name %>">
153
+ <page merge title="Edit <%= model_name :title %>">
154
+
155
+ <body: class="edit-page <%= model_class %>" param/>
156
+
157
+ <content:>
158
+ <section param="content-header">
159
+ <h2 param="heading"><name/></h2>
160
+ <delete-button label="Remove This <%= model_name :title %>" param/>
161
+ </section>
162
+
163
+ <section param="content-body">
164
+ <form param/>
165
+ </section>
166
+ </content:>
167
+
168
+ </page>
169
+ </def>
170
+
171
+ <% controller.owner_actions.each_pair do |owner, actions| -%>
172
+ <%
173
+ collection_name = model.reverse_reflection(owner).name.to_s
174
+ owner_model = model.reflections[owner].klass
175
+ owner_tag = linkable?(owner_model) ? "a" : "name"
176
+ owner = owner.to_s
177
+ -%>
178
+ <% if :index.in? actions -%>
179
+ <%
180
+ new_link = :new.in?(actions)
181
+ -%>
182
+ <def tag="index-for-<%= owner.dasherize %>-page" polymorphic/>
183
+ <def tag="index-for-<%= owner.dasherize %>-page" for="<%= model.name %>">
184
+ <page merge title="<%= model_name :title, :plural %> for #{name :with => @<%= owner %>}">
185
+ <body: class="index-for-owner-page <%= owner.dasherize %> <%= model_class %>" param/>
186
+
187
+ <content: param>
188
+ <header param="content-header">
189
+ <div param="back-to">Back to <a with="&@<%= owner %>"/></div>
190
+ <h2 param="heading"><%= model_name :title, :plural %></h2>
191
+
192
+ <p param="count" if>There <count prefix="are"/></p>
193
+ </header>
194
+
195
+ <section param="content-body">
196
+ <% if new_link -%>
197
+
198
+ <a action="new" to="&model" merge-params/>
199
+ <% end -%>
200
+
201
+ <page-nav param="top-page-nav"/>
202
+
203
+ <collection param/>
204
+
205
+ <page-nav param="bottom-page-nav"/>
206
+ </section>
207
+ </content:>
208
+ </page>
209
+ </def>
210
+ <% end -%>
211
+
212
+
213
+ <% if :new.in? actions -%>
214
+ <def tag="new-for-<%= owner.dasherize %>-page" polymorphic/>
215
+ <def tag="new-for-<%= owner.dasherize %>-page" for="<%= model.name %>">
216
+ <page merge title="New <%= model_name :title %> for #{name :with => @<%= owner %>}">
217
+
218
+ <body: class="new-for-owner-page <% owner.dasherize %> <%= model_class %>" param/>
219
+
220
+ <content: param>
221
+ <header param="content-header">
222
+ <h2 param="heading">New <%= collection_name.singularize.titleize %></h2>
223
+ <h3 class="subheading" param>For: <<%= owner_tag %> with="&@<%= owner %>"/></h3>
224
+ </header>
225
+
226
+ <section param="content-body">
227
+ <form owner="<%= owner %>" method="post" param>
228
+ <field-list: skip="<%= owner %>"/>
229
+ </form>
230
+ </section>
231
+ </content:>
232
+ </page>
233
+ </def>
234
+ <% end -%>
235
+
236
+ <% end # of owner_actions.each_pair -%>
237
+
238
+ <% if defined? model::Lifecycle -%>
239
+ <% model::Lifecycle.creators.values.where.publishable?.*.name.each do |creator| -%>
240
+ <def tag="<%= creator.dasherize %>-page" polymorphic/>
241
+ <def tag="<%= creator.dasherize %>-page" for="<%= model.name %>">
242
+
243
+ <page title="<%= creator.titleize %>" merge>
244
+
245
+ <body: class="lifecycle-start-page <%= creator.dasherize %>-page" param/>
246
+
247
+ <content: param>
248
+ <header param="content-header">
249
+ <h2 param="heading"><%= creator.titleize %></h2>
250
+ </header>
251
+
252
+ <section param="content-body">
253
+ <<%= creator.dasherize %>-form param="form"/>
254
+ </section>
255
+ </content:>
256
+
257
+ </page>
258
+ </def>
259
+ <% end -%>
260
+
261
+ <% model::Lifecycle.transitions.where.publishable?.*.name.each do |transition| -%>
262
+ <def tag="<%= transition.dasherize %>-page" polymorphic/>
263
+ <def tag="<%= transition.dasherize %>-page" for="<%= model.name %>">
264
+ <page title="<%= transition.titleize %>" merge>
265
+
266
+ <body: class="lifecycle-transition-page #{transition.dasherize}-page" param/>
267
+
268
+ <content:>
269
+ <header param="content-header">
270
+ <h2 param="heading"><%= transition.titleize %></h2>
271
+ </header>
272
+
273
+ <section param="content-body">
274
+ <<%= transition.dasherize %>-form param="form"/>
275
+ </section>
276
+ </content:>
277
+
278
+ </page>
279
+ </def>
280
+
281
+ <% end -%>
282
+ <% end # of if defined? model::Lifecycle -%>
283
+
284
+ <% end # of each_model do -%>