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
@@ -0,0 +1,33 @@
1
+ <def tag="card" polymorphic>
2
+ <div class="card" param="default" merge-attrs>
3
+ <header param if-content/>
4
+ <div param="body" if="&all_parameters[:body]"/>
5
+ </div>
6
+ </def>
7
+
8
+
9
+ <def tag="search-card" polymorphic>
10
+ <card/>
11
+ </def>
12
+
13
+
14
+ <def tag="empty-collection-message">
15
+ <p class="empty-collection-message" style="#{'display:none' if !this.empty?}" param="default">
16
+ No <collection-name lowercase/> to display
17
+ </p>
18
+ </def>
19
+
20
+
21
+ <def tag="collection">
22
+ <ul class="collection #{collection_name :dasherize => true}" merge-attrs unless="empty?">
23
+ <li param="item" class="#{scope.even_odd} #{model_id_class}" repeat="&select_viewable">
24
+ <do param="default"><card param/></do>
25
+ </li>
26
+ </ul>
27
+ <empty-collection-message param="empty-message"/>
28
+ </def>
29
+
30
+
31
+ <def tag="field-names-where-true" attrs="fields"><%=
32
+ comma_split(fields).select { |f| this.send(f) }.map { |f| f.titleize }.join(', ')
33
+ %></def>
@@ -0,0 +1,43 @@
1
+ <def tag="start-lifecycle" attrs="model, name, parameters">
2
+ <%
3
+ model = model.constantize if model.is_a?(String)
4
+ creator = model::Lifecycle.creators[name]
5
+ candidate = creator.candidate(current_user, parameters)
6
+ %>
7
+ <if with="&candidate">
8
+ <div class="lifecycle #{name}" merge-attrs>
9
+ <h2 param="heading"><name.titleize/></h2>
10
+
11
+ <form lifecycle="#{name}" method="post" param>
12
+ <field-list fields="&creator.parameters - parameters.keys" param/>
13
+ <submit label="#{name.titleize}" param/>
14
+ </form>
15
+ </div>
16
+ </if>
17
+ </def>
18
+
19
+ <def tag="transition-button" attrs="transition, update, label"><%=
20
+ transition = transition.name unless transition.is_a?(String)
21
+ ajax_attributes, html_attributes = attributes.partition_hash(Hobo::RapidHelper::AJAX_ATTRS)
22
+
23
+ url = object_url(this, transition, :method => :put)
24
+ add_classes!(html_attributes, "transition-button #{transition}-button")
25
+ label ||= transition.titleize
26
+ if update || !ajax_attributes.empty?
27
+ ajax_attributes[:message] ||= label
28
+ func = ajax_updater(url, update, ajax_attributes)
29
+ html_attributes.update(:onclick => "var e = this; " + func, :type =>'button', :value => label)
30
+ element(:input, html_attributes, nil, true, true)
31
+ else
32
+ button_to(label, url, html_attributes)
33
+ end
34
+ %>
35
+ </def>
36
+
37
+ <def tag="transition-buttons">
38
+ <div class="transitions">
39
+ <% this.lifecycle.available_transitions_for(current_user).each do |t| %>
40
+ <transition-button transition="&t"/>
41
+ <% end %>
42
+ </div>
43
+ </def>
@@ -22,30 +22,30 @@
22
22
  </def>
23
23
 
24
24
 
25
- <def tag="main-nav"><magic-nav class="main-nav"/></def>
26
-
27
-
28
25
  <!--- Account Navigation (log in / out / signup) -->
29
26
 
30
27
  <def tag="account-nav">
31
- <ul with="&current_user" class="account-nav" param>
32
- <if test="&logged_in?">
33
- <li class='nav-item' param="logged-in-as"><a to="&current_user">Logged in as <name/></a></li>
34
- <li class='nav-item' param="account"><a action="account">Account</a></li>
35
- <li class='nav-item' param="log-out"><a href="&logout_url">Log out</a></li>
36
- </if>
37
- <else>
38
- <set user="&Hobo::User.default_user_model"/>
39
- <li class='nav-item' param="log-in"><a href="&login_url(user)">Log in</a></li>
40
- <li if="&signup_url(user)" class="nav-item" param="sign-up"><a href="&signup_url(user)">Sign up</a></li>
41
- </else>
42
- </ul>
28
+ <dev-user-changer/>
29
+ <do with="&current_user">
30
+ <ul class="navigation account-nav" param>
31
+ <if test="&logged_in?">
32
+ <li class='nav-item' param="logged-in-as"><a to="&current_user">Logged in as <name/></a></li>
33
+ <li class='nav-item' param="account"><a action="account">Account</a></li>
34
+ <li class='nav-item' param="log-out"><a href="&logout_url">Log out</a></li>
35
+ </if>
36
+ <else>
37
+ <set user="&Hobo::User.default_user_model"/>
38
+ <li class='nav-item' param="log-in"><a href="&login_url(user)">Log in</a></li>
39
+ <li if="&signup_url(user)" class="nav-item" param="sign-up"><a href="&signup_url(user)">Sign up</a></li>
40
+ </else>
41
+ </ul>
42
+ </do>
43
43
  </def>
44
44
 
45
45
 
46
46
  <!--- Pagination Navigation -->
47
47
 
48
- <def tag="page-nav" attrs="params">
48
+ <def tag="page-nav">
49
49
  <%= will_paginate this, attributes.symbolize_keys.reverse_merge(:inner_window => 2, :prev_label => "&laquo; Prev") %>
50
50
  </def>
51
51
 
@@ -87,11 +87,11 @@
87
87
  </def>
88
88
 
89
89
 
90
- <!-- magic nav, just to get you started. Don't try to customise this
91
- but rather write your own navigation using the `<navigation>` tag -->
92
- <def tag="magic-nav">
93
- <navigation merge-attrs>
94
- <nav-item href="#{base_url}/">Home</nav-item>
95
- <nav-item repeat="&front_models[0..5]"><name/></nav-item>
96
- </navigation>
90
+ <def tag="dev-user-changer">
91
+ <set user="&Hobo::User.default_user_model"/>
92
+ <select-menu if="&user && RAILS_ENV == 'development'"
93
+ first-option="Guest" options="&user.all(:limit => 10).*.login"
94
+ onchange="location.href = '/dev/set_current_user?login=' + this.options[this.selectedIndex].value"
95
+ selected="#{current_user.login}"
96
+ class="dev-user-changer"/>
97
97
  </def>
@@ -0,0 +1,183 @@
1
+ <def tag="page" attrs="title, full-title">
2
+ <% full_title ||= "#{title} : #{app_name}" %>
3
+ <html merge-attrs>
4
+ <head param>
5
+ <title param><%= strip_tags full_title %></title>
6
+ <do param="stylesheets">
7
+ <stylesheet name="reset"/>
8
+ <stylesheet name="hobo-rapid"/>
9
+ <theme-stylesheet/>
10
+ <stylesheet name="application"/>
11
+ </do>
12
+
13
+ <do param="scripts">
14
+ <javascript param name="prototype, effects, dragdrop, controls, lowpro, hobo-rapid, application"/>
15
+ <if-ie version="lt IE 7" param="fix-ie6"><javascript name="IE7"/></if-ie>
16
+ </do>
17
+ </head>
18
+
19
+ <body param>
20
+ <set-scoped flash-rendered="&false">
21
+ <ajax-progress param/>
22
+ <header class="page-header" param>
23
+ <h1 param="app-name"><a href="#{base_url}/"><app-name/></a></h1>
24
+ <live-search param if="&defined_route? :site_search"/>
25
+ <account-nav if="&login_url(Hobo::User.default_user_model)" param/>
26
+ <main-nav param/>
27
+ </header>
28
+ <section with-flash-messages param="content"/>
29
+ <footer class="page-footer" param/>
30
+ <page-scripts param/>
31
+ </set-scoped>
32
+ </body>
33
+ </html>
34
+ </def>
35
+
36
+
37
+
38
+ <def tag="page-scripts">
39
+ <script type="text/javascript" param="default">
40
+ <hobo-rapid-javascripts/>
41
+ <part-contexts-storage/>
42
+ </script>
43
+ </def>
44
+
45
+
46
+ <def tag="index-page" polymorphic/>
47
+ <def tag="new-page" polymorphic/>
48
+ <def tag="show-page" polymorphic/>
49
+ <def tag="edit-page" polymorphic/>
50
+
51
+
52
+ <def tag="permission-denied-page" attrs="message">
53
+ <% message ||= "That operation is not allowed" %>
54
+ <page merge>
55
+ <body: class="permission-denied"/>
56
+ <content: param>
57
+ <header param="content-header">
58
+ <h2 param="heading"><message/></h2>
59
+ </header>
60
+ </content:>
61
+ </page>
62
+ </def>
63
+
64
+
65
+ <def tag="not-found-page" attrs="message">
66
+ <% message ||= "The page you were looking for could not be found" %>
67
+ <page merge>
68
+ <body: class="not-found"/>
69
+ <content: param>
70
+ <header param="content-header">
71
+ <h2 param="heading"><message/></h2>
72
+ </header>
73
+ </content:>
74
+ </page>
75
+ </def>
76
+
77
+
78
+ <def tag="doctype" attrs="version"><%=
79
+ case version.upcase
80
+ when "HTML 4.01 STRICT"
81
+ '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ' +
82
+ '"http://www.w3.org/TR/html4/strict.dtd">'
83
+ when "HTML 4.01 TRANSITIONAL"
84
+ '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ' +
85
+ '"http://www.w3.org/TR/html4/loose.dtd">'
86
+ when "XHTML 1.0 STRICT"
87
+ '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ' +
88
+ '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
89
+ when "XHTML 1.0 TRANSITIONAL"
90
+ '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' +
91
+ '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
92
+ when "XHTML 1.1"
93
+ '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" ' +
94
+ '"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'
95
+ end
96
+ %></def>
97
+
98
+ <def tag="html" attrs="doctype">
99
+ <% doctype ||= 'XHTML 1.0 TRANSITIONAL' -%>
100
+ <doctype version="&doctype"/>
101
+ <% attributes.reverse_merge!(:xmlns => "http://www.w3.org/1999/xhtml") if doctype.upcase =~ /^XHTML/ -%>
102
+ <%= "<html#{tag_options(attributes)}>" %>
103
+ <set-scoped xmldoctype="&doctype.upcase =~ /^XHTML/"><do param="default"/></set-scoped>
104
+ <%= "</html>" %>
105
+ </def>
106
+
107
+ <!-- empty tags should be written as <br> in HTML and <br /> in XHTML -->
108
+ <def tag="empty-tag" attrs="tag-name"><%= element(tag_name, attributes, nil, true, true) %></def>
109
+ <def tag="base"><empty-tag tag-name="base" merge/></def>
110
+ <def tag="meta"><empty-tag tag-name="meta" merge/></def>
111
+ <def tag="link"><empty-tag tag-name="link" merge/></def>
112
+ <def tag="img"><empty-tag tag-name="img" merge/></def>
113
+ <def tag="br"><empty-tag tag-name="br" merge/></def>
114
+ <def tag="hr"><empty-tag tag-name="hr" merge/></def>
115
+ <def tag="frame"><empty-tag tag-name="frame" merge/></def>
116
+ <def tag="area"><empty-tag tag-name="area" merge/></def>
117
+ <def tag="param"><empty-tag tag-name="param" merge/></def>
118
+ <def tag="col"><empty-tag tag-name="col" merge/></def>
119
+
120
+ <def tag="if-ie" attrs="version">
121
+ <%= "<!--[if #{version || 'IE'}]>" %><do param="default"/><%= "<![endif]-->" %>
122
+ </def>
123
+
124
+ <def tag="stylesheet" attrs="name">
125
+ <repeat with="&comma_split(name)">
126
+ <%= stylesheet_link_tag name, attributes %>
127
+ </repeat>
128
+ </def>
129
+
130
+
131
+ <def tag="javascript" attrs="name">
132
+ <if test="&name.is_a?(Symbol)">
133
+ <%= javascript_include_tag name %>
134
+ </if>
135
+ <else>
136
+ <repeat with="&comma_split(name)">
137
+ <%= javascript_include_tag this %>
138
+ </repeat>
139
+ </else>
140
+ </def>
141
+
142
+
143
+ <def tag="flash-message" attrs="type">
144
+ <% type = type ? type.to_sym : :notice -%>
145
+ <div class="flash #{type}" if="&flash[type]" merge-attrs><%= flash[type] %></div>
146
+ </def>
147
+
148
+
149
+ <def tag="flash-messages" attrs="names"><%=
150
+ scope.flash_rendered = true
151
+ names = names.nil? ? flash.keys : comma_split(names)
152
+ names.map { |name| flash_message :type => name }
153
+ %></def>
154
+
155
+ <def tag="ajax-progress">
156
+ <div id="ajax-progress">
157
+ <div>
158
+ <span id="ajax-progress-text"></span>
159
+ </div>
160
+ </div>
161
+ </def>
162
+
163
+
164
+ <def tag="default-page-title"><%= t = this.to_s; ; "#{t.blank? ? '' : t + ' - '}#{app_name}" %></def>
165
+
166
+
167
+ <def tag="with-primary-collection" attrs="name"><%
168
+ ivar = "@#{this.class.name.underscore}_#{name}"
169
+
170
+ if (collection = instance_variable_get(ivar))
171
+ %><do with="&collection" param="default"/><%
172
+ else
173
+ %><do field="&name" param="default"/><%
174
+ end
175
+ %></def>
176
+
177
+
178
+ <def tag="or-cancel">
179
+ <if test="&linkable?">or <a>Cancel</a></if>
180
+ <else>
181
+ <if test="&linkable?(this.class)">or <a to="&this.class">Cancel</a></if>
182
+ </else>
183
+ </def>
@@ -30,14 +30,13 @@
30
30
  </if>
31
31
  </th>
32
32
  </with-field-names>
33
- <th if="&all_parameters[:controls]" class="controls"/>
33
+ <th if="&all_parameters[:controls]" class="controls"></th>
34
34
  </field-heading-row>
35
35
  </table>
36
- <do param="empty-message" if="empty?"/>
36
+ <do param="empty-message" if="empty?">No <collection-name lowercase/> to display</do>
37
+
37
38
 
38
- <nav class="page" if="&this.respond_to? :page_count">
39
- <page-nav param/>
40
- </nav>
39
+ <page-nav param if="&this.respond_to? :page_count"/>
41
40
  </div>
42
41
  </def>
43
42
 
@@ -54,3 +53,29 @@
54
53
  </div>
55
54
  </form>
56
55
  </def>
56
+
57
+
58
+ <def tag="sortable-collection" attrs="sortable-options"><%
59
+ singular_name = this.member_class.name.underscore
60
+ attributes[:id] ||= "#{singular_name}_ordering"
61
+ reorder_url = send("reorder_#{singular_name.pluralize}_url")
62
+ %>
63
+ <collection class="sortable" merge>
64
+ <item: id="#{singular_name}_#{this.id}" param>
65
+ <div class="ordering-handle" param="handle">&uarr;<br/>&darr;</div>
66
+ <card param/>
67
+ </item:>
68
+ </collection>
69
+ <%= if Hobo::Dryml.last_if
70
+ opts = { :url => reorder_url,
71
+ :constraint => :vertical,
72
+ :overlap => :vertical,
73
+ :scroll => :window,
74
+ :handle => 'ordering-handle',
75
+ :complete => [visual_effect(:highlight, attributes[:id])]
76
+ }
77
+ opts.update(sortable_options) if sortable_options
78
+ sortable_element attributes[:id], opts
79
+ end # FIXME: Make unobstrusive
80
+ %>
81
+ </def>
@@ -6,8 +6,7 @@
6
6
 
7
7
  elsif fields.nil? || fields == "*" || fields.is_a?(Class)
8
8
  klass = fields.is_a?(Class) ? fields : this.class
9
- columns = klass.content_columns.*.name
10
- columns -= %w{created_at updated_at created_on updated_on} unless include_timestamps
9
+ columns = standard_fields(klass, include_timestamps)
11
10
 
12
11
  if skip_associations == "has_many"
13
12
  assocs = this.class.reflections.values.reject {|r| r.macro == :has_many }.map &its.name.to_s
@@ -36,7 +35,7 @@
36
35
  field_names = if fields.nil? || fields == "*" || fields.is_a?(Class)
37
36
  klass = fields.is_a?(Class) ? fields : this.member_class
38
37
  columns = klass.content_columns.*.name
39
- columns -= %w{created_at updated_at created_on updated_on} unless include_timestamps
38
+ columns -= %w{created_at updated_at created_on updated_on deleted_at} unless include_timestamps
40
39
 
41
40
  if skip_associations == "has_many"
42
41
  assocs = this.reflections.values.reject {|r| r.macro == :has_many }.map &its.name.to_s
@@ -52,7 +51,7 @@
52
51
  end
53
52
 
54
53
  field_names -= comma_split(skip) if skip
55
- scope.new_scope do
54
+ scope.new_scope :field_name => nil, :field_path => nil do
56
55
  field_names.map do |n|
57
56
  scope.field_name = n == "this" ? this.member_class.name : n.to_s.gsub("." , "_")
58
57
  scope.field_path = n
@@ -0,0 +1,179 @@
1
+ <def tag="simple-page">
2
+ <page without-live-search without-account-nav without-main-nav merge/>
3
+ </def>
4
+
5
+
6
+ <def tag="login-page" attrs="remember-me">
7
+ <simple-page title="Log in" merge>
8
+
9
+ <body: class="login-page" param/>
10
+
11
+ <content: param>
12
+ <header param="content-header">
13
+ <h2 param="heading">Log In</h2>
14
+ </header>
15
+
16
+ <section param="content-body">
17
+ <form action="&request.request_uri" class="login" param>
18
+ <labelled-item-list param>
19
+ <labelled-item>
20
+ <item-label param="login-label"><%= model.login_attribute.to_s.titleize %></item-label>
21
+ <item-value><input type="text" name="login" id="login" class="string" param="login-input" /></item-value>
22
+ </labelled-item>
23
+
24
+ <labelled-item>
25
+ <item-label param="password-label">Password</item-label>
26
+ <item-value>
27
+ <input type="password" name="password" id="password" class="string" param="password-input"/>
28
+ </item-value>
29
+ </labelled-item>
30
+
31
+ <labelled-item if="&remember_me">
32
+ <item-label class="field-label" param="remember-me-label">Remember me:</item-label>
33
+ <item-value><input type="checkbox" name="remember_me" id="remember-me" param="remember-me-input"/></item-value>
34
+ </labelled-item>
35
+ </labelled-item-list>
36
+ <div class="actions" param="actions">
37
+ <submit label='Log in' param/><if test="&signup_url" class='nav-item'> or <a href="&signup_url">Sign up</a></if>
38
+ </div>
39
+ </form>
40
+ <a class="forgot-password" href="&forgot_password_url">Forgot your password?</a>
41
+ </section>
42
+ </content:>
43
+ </simple-page>
44
+ </def>
45
+
46
+
47
+ <def tag="forgot-password-page" attrs="remember-me">
48
+ <simple-page title="Forgotten Password" merge>
49
+
50
+ <body: class="forgot-password-page" param/>
51
+
52
+ <content: param>
53
+ <header param="content-header">
54
+ <h2 param="heading">Forgotten Password</h2>
55
+ <p>Enter the email address you signed up with. If we have it in
56
+ our records we'll send you an email allowing you to chose a new
57
+ password.</p>
58
+ </header>
59
+
60
+ <section param="content-body">
61
+ <form action="" class="forgot-password" param>
62
+ <labelled-item-list param>
63
+ <labelled-item>
64
+ <item-label param="email-address-label">Email Address</item-label>
65
+ <item-value>
66
+ <input type="text" name="email_address" id="email-address" class="email-address" param="email-address-input" />
67
+ </item-value>
68
+ </labelled-item>
69
+ </labelled-item-list>
70
+ <div class="actions" param="actions">
71
+ <submit label="Send" param/>
72
+ </div>
73
+ </form>
74
+ </section>
75
+ </content:>
76
+
77
+ </simple-page>
78
+ </def>
79
+
80
+
81
+ <def tag="forgot-password-page" attrs="remember-me">
82
+ <simple-page title="Forgotten Password" merge>
83
+
84
+ <body: class="forgot-password-page" param/>
85
+
86
+ <content: param>
87
+ <header param="content-header">
88
+ <h2 param>Forgotten Password</h2>
89
+ <p>Enter the email address you signed up with. If we have it in
90
+ our records we'll send you an email allowing you to chose a new
91
+ password.</p>
92
+ </header>
93
+
94
+ <section param="content-body">
95
+ <form action="" class="forgot-password" param>
96
+ <labelled-item-list param>
97
+ <labelled-item>
98
+ <item-label param="email-address-label">Email Address</item-label>
99
+ <item-value>
100
+ <input type="text" name="email_address" id="email-address" class="email-address" param="email-address-input" />
101
+ </item-value>
102
+ </labelled-item>
103
+ </labelled-item-list>
104
+ <div class="actions" param="actions">
105
+ <submit label="Send" param/>
106
+ </div>
107
+ </form>
108
+ </section>
109
+
110
+ </content:>
111
+
112
+ </simple-page>
113
+ </def>
114
+
115
+
116
+ <def tag="forgot-password-email-sent-page">
117
+ <simple-page>
118
+ <body: class="forgot-password-page" param/>
119
+
120
+ <content: param>
121
+ <header param="content-header">
122
+ <h2 param>Forgotten Password - Sent</h2>
123
+ </header>
124
+
125
+ <section param="content-body">
126
+ <p param="message">If the e-mail address you entered, <%= h params[:email_address] %>,
127
+ is in our records, you will
128
+ receive an e-mail from us with instructions for resetting your
129
+ password. If you don't receive this e-mail, please check your
130
+ junk mail folder.</p>
131
+ <p><a href="#{base_url}/">Back to <app-name/></a></p>
132
+ </section>
133
+ </content:>
134
+
135
+ </simple-page>
136
+ </def>
137
+
138
+
139
+ <def tag="account-disabled-page">
140
+
141
+ <simple-page title="Account not available" merge>
142
+
143
+ <body: class="account-disabled-page" param/>
144
+
145
+ <content: param>
146
+ <header param="content-header">
147
+ <h2 param>Account is not available</h2>
148
+ </header>
149
+
150
+ <section param="content-body">
151
+ <p>Your account is not available at this time.</p>
152
+ </section>
153
+ </content:>
154
+ </simple-page>
155
+
156
+ </def>
157
+
158
+
159
+ <def tag="account-page">
160
+
161
+ <page title="#{name} - Account" merge>
162
+
163
+ <body: class="user-account-page #{type_name}" param/>
164
+
165
+ <content: param>
166
+ <header param="content-header">
167
+ <h2><name/></h2>
168
+ </header>
169
+
170
+ <section param="content-body">
171
+ <error-messages param/>
172
+ <h2>Change Password</h2>
173
+ <change-password-form/>
174
+ </section>
175
+ </content:>
176
+
177
+ </page>
178
+
179
+ </def>