hobo 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/bin/hobo +24 -7
  2. data/hobo_files/plugin/CHANGES.txt +501 -0
  3. data/hobo_files/plugin/generators/hobo/hobo_generator.rb +8 -6
  4. data/hobo_files/plugin/generators/hobo/templates/application.dryml +3 -0
  5. data/hobo_files/plugin/generators/hobo/templates/dryml-support.js +132 -0
  6. data/hobo_files/plugin/generators/hobo_front_controller/hobo_front_controller_generator.rb +4 -5
  7. data/hobo_files/plugin/generators/hobo_model_resource/hobo_model_resource_generator.rb +75 -0
  8. data/hobo_files/plugin/generators/hobo_model_resource/templates/controller.rb +7 -0
  9. data/hobo_files/plugin/generators/hobo_model_resource/templates/functional_test.rb +8 -0
  10. data/hobo_files/plugin/generators/hobo_model_resource/templates/helper.rb +2 -0
  11. data/hobo_files/plugin/generators/hobo_rapid/templates/hobo-rapid.js +30 -11
  12. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/clean/public/stylesheets/application.css +149 -92
  13. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/clean/public/stylesheets/rapid-ui.css +0 -48
  14. data/hobo_files/plugin/init.rb +45 -13
  15. data/hobo_files/plugin/lib/action_view_extensions/base.rb +4 -3
  16. data/hobo_files/plugin/lib/active_record/association_proxy.rb +18 -0
  17. data/hobo_files/plugin/lib/active_record/association_reflection.rb +5 -0
  18. data/hobo_files/plugin/lib/active_record/has_many_association.rb +7 -11
  19. data/hobo_files/plugin/lib/active_record/has_many_through_association.rb +8 -0
  20. data/hobo_files/plugin/lib/extensions/test_case.rb +1 -1
  21. data/hobo_files/plugin/lib/hobo.rb +38 -60
  22. data/hobo_files/plugin/lib/hobo/authentication_support.rb +1 -1
  23. data/hobo_files/plugin/lib/hobo/bundle.rb +131 -34
  24. data/hobo_files/plugin/lib/hobo/composite_model.rb +1 -1
  25. data/hobo_files/plugin/lib/hobo/controller.rb +7 -8
  26. data/hobo_files/plugin/lib/hobo/dev_controller.rb +21 -0
  27. data/hobo_files/plugin/lib/hobo/dryml/dryml_builder.rb +14 -8
  28. data/hobo_files/plugin/lib/hobo/dryml/dryml_support_controller.rb +13 -0
  29. data/hobo_files/plugin/lib/hobo/dryml/taglib.rb +6 -7
  30. data/hobo_files/plugin/lib/hobo/dryml/template.rb +207 -73
  31. data/hobo_files/plugin/lib/hobo/dryml/template_environment.rb +67 -55
  32. data/hobo_files/plugin/lib/hobo/dryml/template_handler.rb +53 -3
  33. data/hobo_files/plugin/lib/hobo/hobo_helper.rb +75 -107
  34. data/hobo_files/plugin/lib/hobo/model.rb +236 -429
  35. data/hobo_files/plugin/lib/hobo/model_controller.rb +277 -437
  36. data/hobo_files/plugin/lib/hobo/model_router.rb +62 -29
  37. data/hobo_files/plugin/lib/hobo/rapid_helper.rb +48 -9
  38. data/hobo_files/plugin/lib/hobo/scopes.rb +98 -0
  39. data/hobo_files/plugin/lib/hobo/scopes/association_proxy_extensions.rb +31 -0
  40. data/hobo_files/plugin/lib/hobo/scopes/automatic_scopes.rb +282 -0
  41. data/hobo_files/plugin/lib/hobo/scopes/defined_scope_proxy_extender.rb +88 -0
  42. data/hobo_files/plugin/lib/hobo/scopes/scope_reflection.rb +18 -0
  43. data/hobo_files/plugin/lib/hobo/scopes/scoped_proxy.rb +59 -0
  44. data/hobo_files/plugin/lib/hobo/undefined.rb +2 -0
  45. data/hobo_files/plugin/lib/hobo/user.rb +31 -14
  46. data/hobo_files/plugin/lib/hobo/user_controller.rb +41 -27
  47. data/hobo_files/plugin/taglibs/core.dryml +9 -11
  48. data/hobo_files/plugin/taglibs/rapid.dryml +51 -108
  49. data/hobo_files/plugin/taglibs/rapid_editing.dryml +25 -25
  50. data/hobo_files/plugin/taglibs/rapid_forms.dryml +111 -79
  51. data/hobo_files/plugin/taglibs/rapid_generics.dryml +74 -0
  52. data/hobo_files/plugin/taglibs/rapid_navigation.dryml +23 -21
  53. data/hobo_files/plugin/taglibs/rapid_pages.dryml +83 -169
  54. data/hobo_files/plugin/taglibs/rapid_plus.dryml +16 -2
  55. data/hobo_files/plugin/taglibs/rapid_support.dryml +3 -3
  56. data/hobo_files/plugin/taglibs/rapid_user_pages.dryml +104 -0
  57. metadata +60 -55
  58. data/hobo_files/plugin/generators/hobo_migration/hobo_migration_generator.rb +0 -276
  59. data/hobo_files/plugin/generators/hobo_migration/templates/migration.rb +0 -9
  60. data/hobo_files/plugin/lib/active_record/table_definition.rb +0 -34
  61. data/hobo_files/plugin/lib/extensions.rb +0 -375
  62. data/hobo_files/plugin/lib/hobo/email_address.rb +0 -12
  63. data/hobo_files/plugin/lib/hobo/enum_string.rb +0 -50
  64. data/hobo_files/plugin/lib/hobo/field_declaration_dsl.rb +0 -43
  65. data/hobo_files/plugin/lib/hobo/field_spec.rb +0 -68
  66. data/hobo_files/plugin/lib/hobo/html_string.rb +0 -7
  67. data/hobo_files/plugin/lib/hobo/lazy_hash.rb +0 -40
  68. data/hobo_files/plugin/lib/hobo/markdown_string.rb +0 -11
  69. data/hobo_files/plugin/lib/hobo/migrations.rb +0 -12
  70. data/hobo_files/plugin/lib/hobo/model_queries.rb +0 -117
  71. data/hobo_files/plugin/lib/hobo/password_string.rb +0 -7
  72. data/hobo_files/plugin/lib/hobo/percentage.rb +0 -14
  73. data/hobo_files/plugin/lib/hobo/predicate_dispatch.rb +0 -78
  74. data/hobo_files/plugin/lib/hobo/proc_binding.rb +0 -32
  75. data/hobo_files/plugin/lib/hobo/text.rb +0 -3
  76. data/hobo_files/plugin/lib/hobo/textile_string.rb +0 -25
  77. data/hobo_files/plugin/lib/hobo/where_fragment.rb +0 -28
@@ -0,0 +1,74 @@
1
+ <def tag="creation-details">
2
+ <span class="creation-details">
3
+ <view field="&this.class.creator_attribute" class="creator" if="&this.class.creator_attribute" />
4
+ <view:created_at class="created-at" if="&this.respond_to?(:created_at)"/>
5
+ </span>
6
+ </def>
7
+
8
+ <def tag="primary-content">
9
+ <view class="primary-content" field="&this.class.primary_content_attribute" if="&this.class.primary_content_attribute" merge/>
10
+ </def>
11
+
12
+ <def tag="association-count">
13
+ <a class="association-count #{this_field.to_s.underscore}" href="##{this_field.to_s.underscore}" merge>
14
+ <count/>
15
+ </a>
16
+ </def>
17
+
18
+ <def tag="base-card">
19
+ <if test="&can_view?">
20
+ <div class="card #{linkable? ? 'linkable' : 'content'} #{type_name :dasherize => true}" merge-attrs>
21
+ <h3 param="title"><a if="&linkable?"/></h3>
22
+ <div class="content" param="content" if="&!linkable?">
23
+ <primary-content/>
24
+ </div>
25
+ <creation-details param/>
26
+ <do param="counter">
27
+ <set primary-collection="&primary_collection_name"/>
28
+ <if test="&primary_collection">
29
+ <span class="dependents"><count field="&primary_collection"/></span>
30
+ </if>
31
+ </do>
32
+ <delete-button label="X" unless="&linkable?(this, :edit)" param/>
33
+ </div>
34
+ </if>
35
+ </def>
36
+
37
+ <def tag="card">
38
+ <if test="&can_view?">
39
+ <%= poly = call_polymorphic_tag('card', attributes, parameters) %>
40
+ <base-card unless="&poly" merge/>
41
+ </if>
42
+ </def>
43
+
44
+ <def tag="search-card">
45
+ <%= poly = call_polymorphic_tag('search-card', attributes, parameters) %>
46
+ <card unless="&poly"/>
47
+ </def>
48
+
49
+ <def tag="collection">
50
+ <%= poly = call_polymorphic_tag('collection', attributes, parameters) %>
51
+ <ul class="collection" merge-attrs unless="&poly">
52
+ <li:><card param/></li:>
53
+ </ul>
54
+ <p class="empty-collection-message" if="&this.empty?" param="empty-message">
55
+ <% label = if (refl = this.try.proxy_reflection)
56
+ refl.association_name.to_s.humanize.downcase
57
+ elsif (klass = this.try.member_class)
58
+ klass.name.humanize.downcase.pluralize
59
+ else
60
+ type_name(:plural => true).pluralize.humanize.downcase.to_s
61
+ end %>
62
+ There are no <%= label.pluralize %>
63
+ </p>
64
+ </def>
65
+
66
+ <def tag="collection-preview" attrs="limit">
67
+ <% limit ||= 6 %>
68
+ <div class="collection-preview" merge-attrs>
69
+ <h2><do param="heading"><this-field.titleize/></do> <span param="show-all-link" if="&linkable?">(<a>show all</a>)</span></h2>
70
+ <collection with="&this.limit(limit)" merge-params>
71
+ <card: class="small"/>
72
+ </collection>
73
+ </div>
74
+ </def>
@@ -5,7 +5,7 @@
5
5
  <!--- General Navigation -->
6
6
 
7
7
  <def tag="navigation" attrs="current">
8
- <ul merge-attrs>
8
+ <ul class="navigation" merge-attrs>
9
9
  <set-scoped current-navigation="&current">
10
10
  <do param="default"/>
11
11
  </set-scoped>
@@ -24,15 +24,16 @@
24
24
  <!--- Account Navigation (log in / out / signup) -->
25
25
 
26
26
  <def tag="account-nav">
27
- <ul class="account-nav">
27
+ <ul with="&current_user" class="account-nav" param>
28
28
  <if test="&logged_in?">
29
- <li class='nav-item'>Logged in as <view:login with="&current_user"/></li>
30
- <li class='nav-item'><a href="&logout_url">Log out</a></li>
29
+ <li class='nav-item' param="logged-in-as">Logged in as <view:login/></li>
30
+ <li class='nav-item' param="account"><a action="account">Account</a></li>
31
+ <li class='nav-item' param="log-out"><a href="&logout_url">Log out</a></li>
31
32
  </if>
32
33
  <else>
33
- <set user="&Hobo::UserController.user_models.first"/>
34
- <li class='nav-item'><a href="&login_url(user)">Log in</a></li>
35
- <li if="&signup_url(user)" class='nav-item'><a href="&signup_url(user)">Sign up</a></li>
34
+ <set user="&Hobo::User.default_user_model"/>
35
+ <li class='nav-item' param="log-in"><a href="&login_url(user)">Log in</a></li>
36
+ <li if="&signup_url(user)" class="nav-item" param="sign-up"><a href="&signup_url(user)">Sign up</a></li>
36
37
  </else>
37
38
  </ul>
38
39
  </def>
@@ -41,52 +42,53 @@
41
42
  <!--- Pagination Navigation -->
42
43
 
43
44
  <def tag="page-nav" attrs="params">
44
- <if test="&@pages && @pages.length > 1">
45
+ <if test="&this.try.page_count._? > 1">
45
46
  <page-n-of-count/> -
46
- <first-page-link params="&params">|&lt;</first-page-link>
47
- <previous-page-link params="&params">Previous</previous-page-link>
48
- <next-page-link params="&params">Next</next-page-link>
49
- <last-page-link params="&params">&gt|</last-page-link>
47
+ <first-page-link params="&params" param>|&lt;</first-page-link>
48
+ <previous-page-link params="&params" param>Previous</previous-page-link>
49
+ <next-page-link params="&params" param>Next</next-page-link>
50
+ <last-page-link params="&params" param>&gt|</last-page-link>
50
51
  </if>
51
52
  </def>
52
53
 
53
54
 
54
55
  <def tag="page-n-of-count">
55
- Page <%= @pages.current_page.number %> of <%= @pages.length %>
56
+ Page <%= this.current_page %> of <%= this.page_count %>
56
57
  </def>
57
58
 
58
59
 
59
60
  <def tag="previous-page-link">
60
- <a if="&@pages && @pages.current.previous"
61
- href="&url_for(params.merge(:page => @pages.current.previous))">
61
+ <a if="&this.try.previous_page"
62
+ href="&url_for(params.merge(:page => this.previous_page))">
62
63
  <do param="default">&laquo; Previous page</do>
63
64
  </a>
64
65
  </def>
65
66
 
66
67
 
67
68
  <def tag="next-page-link">
68
- <a if="&@pages && @pages.current.next"
69
- href="&url_for(params.merge(:page => @pages.current.next))">
69
+ <a if="&this.try.next_page"
70
+ href="&url_for(params.merge(:page => this.next_page))">
70
71
  <do param="default">Next page &raqou;</do>
71
72
  </a>
72
73
  </def>
73
74
 
74
75
 
75
76
  <def tag="first-page-link">
76
- <a if="&@pages && @pages.first_page && @pages.current != @pages.first_page"
77
- href="&url_for(params.merge(:page => @pages.first_page))">
77
+ <a if="&this.try.current_page && this.current_page != 1"
78
+ href="&url_for(params.merge(:page => 1))">
78
79
  <do param="default">&laquo; First page</do>
79
80
  </a>
80
81
  </def>
81
82
 
82
83
 
83
84
  <def tag="last-page-link">
84
- <a if="&@pages && @pages.last_page && @pages.current != @pages.last_page"
85
- href="&url_for(params.merge(:page => @pages.last_page))">
85
+ <a if="&this.try.current_page && this.current_page != this.page_count"
86
+ href="&url_for(params.merge(:page => this.page_count))">
86
87
  <do param="default">Last page &raquo;</do>
87
88
  </a>
88
89
  </def>
89
90
 
91
+
90
92
  <!-- magic nav, just to get you started -->
91
93
  <!-- write your own navigation using the <navigation> tag -->
92
94
  <def tag="magic-nav">
@@ -26,11 +26,11 @@
26
26
  <body: param>
27
27
  <ajax-progress/>
28
28
  <header class="page-header" param>
29
- <heading param="app-name"><a href="/#{base_url}"><app-name/></a></heading>
30
- <live-search param if="&defined_route? :search"/>
29
+ <heading param="app-name"><a href="#{base_url}/"><app-name/></a></heading>
30
+ <live-search param if="&defined_route? :site_search"/>
31
31
  <nav param>
32
- <account-nav if="&Hobo::UserController.user_models.first" param/>
33
- <magic-nav class="main-nav" param="main-nav"/>
32
+ <account-nav if="&Hobo::User.default_user_model" param/>
33
+ <do param="main-nav"><magic-nav class="main-nav"/></do>
34
34
  </nav>
35
35
  </header>
36
36
  <section class="page-content" param="content">
@@ -53,7 +53,7 @@
53
53
  <section class="main-content" param="main-content">
54
54
  <param-content for="content"/>
55
55
  </section>
56
- <aside class="aside-content" param/>
56
+ <aside class="aside-content" empty param/>
57
57
  </content:>
58
58
  </simple-layout>
59
59
  </def>
@@ -63,13 +63,14 @@
63
63
 
64
64
 
65
65
  <def tag="index-page">
66
- <% model_name = @model.name.titleize %>
67
- <page title="All #{model_name.pluralize}" merge>
68
- <body: class="index-page #{@model.name.underscore}" param/>
66
+ <set model="&this.try.member_class || self.model"/>
67
+ <set model-name="&model.name.titleize"/>
68
+ <page title="All #{type_name :with => model, :pluralize => true}" merge>
69
+ <body: class="index-page #{type_id model}" param/>
69
70
  <content-header: param>
70
- <heading param><%= model_name.pluralize %></heading>
71
- <p class="note" param>There <do with="&@model"><count part="item-count" prefix="are"/></do></p>
72
- </content-header>
71
+ <heading param><type-name with="&model"/></heading>
72
+ <p class="note" if param>There <count part="item-count" prefix="are"/></p>
73
+ </content-header:>
73
74
 
74
75
  <content-body: param>
75
76
  <nav param="top-pagination-nav"><page-nav/></nav>
@@ -80,16 +81,16 @@
80
81
  </content-body>
81
82
 
82
83
  <content-footer: param>
83
- <a to="&@model" action="new" param="new-link" if="&linkable?(@model, :new)"/>
84
+ <a to="&model" action="new" param="new-link"/>
84
85
  <else>
85
- <do with="&new_for_current_user @model">
86
- <section class="create-new" if="&can_create?">
86
+ <if with="&model.user_new current_user">
87
+ <section class="create-new">
87
88
  <h2>New <type-name/></h2>
88
89
  <form><field-list/><submit label="Create #{type_name}"/></form>
89
90
  </section>
90
- </do>
91
+ </if>
91
92
  </else>
92
- </content-footer>
93
+ </content-footer:>
93
94
  </page>
94
95
  </def>
95
96
 
@@ -115,14 +116,10 @@
115
116
  </def>
116
117
 
117
118
 
118
- <def tag="show-page">
119
- <% has_many_assocs = this.class.reflections.values.map do |refl|
120
- this.send(refl.name) if Hobo.simple_has_many_association?(refl)
121
- end.compact
122
- dependent_collection = this.class.dependent_collections.first if this.class.dependent_collections.length == 1
123
- %>
119
+ <def tag="show-page" attrs="primary-collection">
120
+ <set primary-collection-name="&(primary_collection || self.primary_collection_name).to_s"/>
124
121
  <page merge title="#{name :no_wrapper => true}">
125
- <body: class="show-page #{type_name.underscore}" param/>
122
+ <body: class="show-page #{type_name :dasherize => true}" param/>
126
123
  <content-header: param>
127
124
  <if with="&this.dependent_on.reject{|x| x.is_a?(Hobo::User)}.first">
128
125
  <div class="container"><a/></div>
@@ -130,8 +127,12 @@
130
127
 
131
128
  <heading param><%= this %></heading>
132
129
  <creation-details param/>
133
- <do param="dependent-collection-count"><a class="dependent-collection-count" href="##{dependent_collection.to_s.underscore}" part="dependent-collection-count" part-locals="dependent_collection" if="&dependent_collection"><count-dependents/></a></do>
134
- <a action="edit" if="&can_edit?" class="edit">Edit <type-name/></a>
130
+
131
+ <do field="&primary_collection_name" if="&primary_collection_name" param="primary-collection-count">
132
+ <association-count class="primary-collection-count" part="primary-collection-count"/>
133
+ </do>
134
+
135
+ <a action="edit" class="edit" if="&can_edit?" param="edit-link">Edit <type-name/></a>
135
136
  </content-header>
136
137
 
137
138
  <content-body: param>
@@ -140,58 +141,47 @@
140
141
  <field-list skip="&[this.class.name_attribute, this.class.primary_content_attribute, this.class.creator_attribute, this.class.dependent_on.first].compact "
141
142
  skip-associations="has_many" param/>
142
143
 
143
- <if test="&dependent_collection">
144
- <section class="dependent-collection" field="&dependent_collection">
145
- <a name="#{dependent_collection.to_s.underscore}"/>
146
- <h2 param="dependent-collection-title"><%= dependent_collection.to_s.titleize %></h2>
147
-
148
- <do param="collection">
149
- <collection part="dependent-collection" part-locals="dependent_collection">
150
- <empty-message:>No <%= dependent_collection.to_s %> have been added yet.</empty-message>
151
- </collection>
152
- </do>
153
-
154
- <do with="&new_for_current_user">
155
- <section class="create-new" if="&!linkable?(:new) && can_create?">
156
- <h2>Add <A-or-An word="&dependent_collection.to_s.singularize.titleize"/></h2>
157
- <form update="dependent-collection, dependent-collection-count" message="Adding #{dependent_collection.to_s.singularize.titleize}..." reset-form>
158
- <field-list skip="#{@this.class.reverse_reflection(@this.send(dependent_collection).proxy_reflection.name).name}"
159
- skip-associations="has_many" param="dependent-collection-field-list"/>
160
- <submit label="Create #{dependent_collection.to_s.singularize.titleize}"/>
144
+ <section class="primary-collection" field="&primary_collection_name" if="&primary_collection_name">
145
+ <h2 param="primary-collection-title"><%= primary_collection_name.titleize %></h2>
146
+
147
+ <do param="primary-collection">
148
+ <collection part="primary-collection"/>
149
+ </do>
150
+
151
+ <if test="can_create?">
152
+ <nav class="new-link"><a action="new" if="&linkable?(:new) && can_create?"/></nav>
153
+ <else>
154
+ <section class="create-new" with="&new_for_current_user">
155
+ <h2>Add <A-or-An word="&primary_collection_name.singularize.titleize"/></h2>
156
+ <form update="primary-collection, primary-collection-count"
157
+ message="Adding #{primary_collection_name.singularize.titleize}..." reset-form>
158
+ <field-list skip="#{@this.class.reverse_reflection(@this.send(primary_collection_name).proxy_reflection.name).name}"
159
+ skip-associations="has_many" param="primary-collection-field-list"/>
160
+ <submit label="Create #{primary_collection_name.singularize.titleize}"/>
161
161
  </form>
162
162
  </section>
163
- </do>
164
- </section>
165
- </if>
166
- <else>
167
- <section class="preview-collections">
168
- <with-fields associations="has_many">
169
- <section class="#{this_field.dasherize}">
170
- <h2>Recent <this-field.titleize/></h2>
171
- <collection with="&this.recent"/>
172
- <a class="more">More... (<count/>)</a>
173
- </section>
174
- </with-fields>
175
- </section>
176
- </else>
177
-
178
- <nav class="new-links" param="new-links">
179
- <ul with="&has_many_assocs">
180
- <li: replace><li if="&can_create? && linkable?(:new)"><a action="new"/></li></li>
181
- </ul>
182
- </nav>
163
+ </else>
164
+ </if>
165
+ </section>
183
166
 
184
- </content-body>
167
+ </content-body:>
168
+ <aside: param>
169
+ <section class="preview-collections">
170
+ <with-fields fields="&non_through_collections - [primary_collection_name._?.to_sym]">
171
+ <collection-preview class="#{this_field.dasherize}"/>
172
+ </with-fields>
173
+ </section>
174
+ </aside:>
185
175
  </page>
186
176
  </def>
187
177
 
188
178
 
189
179
  <def tag="edit-page">
190
180
  <page merge>
191
- <body: class="edit-page #{this.class.name.underscore}" param/>
181
+ <body: class="edit-page #{type_name :dasherize => true}" param/>
192
182
  <content-header: param>
193
- <heading><if test="&this.respond_to? :name"><name/></if><else><type-name/></else></heading>
194
- <delete-button in-place="&false" label="Remove This #{this.class.name}" param/>
183
+ <heading param><if test="&this.respond_to? :name"><name/></if><else><type-name/></else></heading>
184
+ <delete-button label="Remove This #{type_name}" param/>
195
185
  </content-header>
196
186
 
197
187
  <content-body: param>
@@ -209,22 +199,23 @@
209
199
 
210
200
 
211
201
  <def tag="new-in-collection-page">
212
- <set association-name="&@association.proxy_reflection.name.to_s.singularize.titleize"/>
202
+ <set association-name="&@association.origin_attribute.to_s"/>
213
203
  <page title="New #{type_name}" merge>
214
- <body: class="new-in-collection-page #{type_name(:with => @owner)} #{type_name}" param/>
204
+ <body: class="new-in-collection-page #{association_name.underscore.dasherize} #{type_name :dasherize => true}" param/>
215
205
  <content-header: param>
216
- <heading param>New <association-name/></heading>
217
- <sub-heading param>For: <a with="&@owner" /></sub-heading>
206
+ <heading param>New <association-name.singularize.titleize/></heading>
207
+ <sub-heading param>For: <a with="&@association.origin"/></sub-heading>
218
208
  </content-header>
219
209
 
220
210
  <content-body: param>
221
211
  <error-messages/>
222
212
 
223
213
  <form param>
224
- <field-list skip="#{@owner.class.reverse_reflection(@association.proxy_reflection.name).name}"
214
+ <field-list skip="#{@association.origin.class.reverse_reflection(association_name.to_sym).name}"
225
215
  skip-associations="has_many" param/>
226
216
  <div class="actions" param="actions">
227
- <submit label="Create #{association_name}" param/><do param="back-link"> or <a with="&@owner">Cancel</a></do>
217
+ <submit label="Create #{association_name.singularize.titleize}" param/>
218
+ <do param="back-link"> or <a with="&@association.origin">Cancel</a></do>
228
219
  </div>
229
220
  </form>
230
221
  </content-body>
@@ -233,14 +224,14 @@
233
224
 
234
225
 
235
226
  <def tag="show-collection-page">
236
- <% title = "#{@reflection.name.to_s.titleize} for #{name(:with => @owner)}" %>
227
+ <% title = "#{this.origin_attribute.to_s.titleize} for #{name(:with => this.origin)}" %>
237
228
  <page title="&title" merge>
238
- <body: class="show-collection-page #{type_name(:with => @owner)} #{type_name(:pluralize => true)}"
229
+ <body: class="show-collection-page #{type_name(:with => this.origin)} #{type_name(:pluralize => true) rescue debugger}"
239
230
  param/>
240
231
  <content-header: param>
241
- <nav>Back to <a with="&@owner"/></nav>
232
+ <nav>Back to <a:origin/></nav>
242
233
  <heading><%= title %></heading>
243
- <sub-heading><count with="&@pages.item_count" label="&@reflection.klass.name.titleize"/></sub-heading>
234
+ <sub-heading><count/></sub-heading>
244
235
  </content-header>
245
236
 
246
237
  <content-body: param>
@@ -250,114 +241,35 @@
250
241
 
251
242
  <nav param="bottom-pagination-nav"><page-nav param/></nav>
252
243
 
253
- <nav if="&Hobo.simple_has_many_association?(@association)" param="new-link">
254
- <a to="&@association" action="new"/>
244
+ <nav if="&Hobo.simple_has_many_association?(this)" param="new-link">
245
+ <a action="new"/>
255
246
  </nav>
256
247
  </content-body>
257
248
  </page>
258
249
  </def>
259
250
 
260
251
 
261
- <def tag="signup-page">
262
- <page layout="simple" title="Sign up to #{app_name}" merge>
263
- <body: class="signup-page" param/>
264
-
265
- <live-search: replace/>
266
- <nav: replace/>
267
-
268
- <content-header: param>
269
- <heading param>Sign Up</heading>
270
- </content-header>
271
-
272
- <content-body: param>
273
- <error-messages/>
274
- <form action="&request.request_uri" param>
275
- <field-list fields="login, password, password_confirmation" param>
276
- <password-confirmation-label:>Confirm Password</password-confirmation-label>
277
- </field-list>
278
-
279
- <div class="actions" param="actions">
280
- <submit label='Sign Up'/>
281
- </div>
282
- </form>
283
- </content-body>
284
-
285
- </page>
286
- </def>
287
-
288
-
289
- <def tag="login-page" attrs="remember-me">
290
- <page layout="simple" title="Log in to #{app_name}" merge>
291
-
292
- <body: class="login-page" param/>
293
-
294
- <live-search: replace/>
295
- <nav: replace/>
296
-
252
+ <def tag="permission-denied-page" attrs="message">
253
+ <% message ||= "That operation is not allowed" %>
254
+ <page merge>
255
+ <body: class="permission-denied"/>
297
256
  <content-header: param>
298
- <heading param>Log In</heading>
257
+ <heading param><message/></heading>
299
258
  </content-header>
300
-
301
- <content-body: param>
302
- <form action="&request.request_uri" class="login" param>
303
- <labelled-item-list>
304
- <labelled-item>
305
- <item-label param="login-label"><%= model.login_attr.to_s.titleize %></item-label>
306
- <item-value><input type="text" name="login" id="login" class="string" param="login-input" /></item-value>
307
- </labelled-item>
308
-
309
- <labelled-item>
310
- <item-label param="password-label">Password</item-label>
311
- <item-value><input type="password" name="password" id="password" class="string" param="password-input"/></item-value>
312
- </labelled-item>
313
-
314
- <labelled-item if="&remember_me">
315
- <item-label class="field-label" param="remember-me-label">Remember me:</item-label>
316
- <item-value><input type="checkbox" name="remember_me" id="remember-me" param="remember-me-input"/></item-value>
317
- </labelled-item>
318
- </labelled-item-list>
319
- <set user="&Hobo::UserController.user_models.first"/>
320
- <div class="actions" param="actions">
321
- <submit label='Log in' param/><if test="&signup_url(user)" class='nav-item'> or <a href="&signup_url(user)">Sign up</a></if>
322
- </div>
323
- </form>
324
- </content-body>
325
- </page>
326
- </def>
327
-
328
-
329
- <def tag="account-disabled-page">
330
-
331
- <page layout="simple" title="#{app_name} - account not available" merge>
332
-
333
- <body: class="account-disabled-page" param/>
334
-
335
- <content-header: param><heading param>Account is not available</heading></content>
336
-
337
- <content-body: param>
338
- <p>Your account is not available at this time.</p>
339
- </content-body>
340
259
  </page>
341
-
342
260
  </def>
343
-
344
261
 
345
262
 
346
- <def tag="permission-denied-page">
263
+ <def tag="not-found-page" attrs="message">
264
+ <% message ||= "The page you were looking for could not be found" %>
347
265
  <page merge>
266
+ <body: class="not-found"/>
348
267
  <content-header: param>
349
- <heading param>That operation is not allowed</heading>
268
+ <heading param><message/></heading>
350
269
  </content-header>
351
270
  </page>
352
271
  </def>
353
272
 
354
- <def tag="not-found-page">
355
- <page merge>
356
- <content-header: param>
357
- <heading param>The page you were looking for could not be found</heading>
358
- </content-header>
359
- </page>
360
- </def>
361
273
 
362
274
  <def tag="doctype" attrs="version"><%=
363
275
  case version.upcase
@@ -379,6 +291,7 @@
379
291
  end
380
292
  %></def>
381
293
 
294
+
382
295
  <def tag="stylesheet" attrs="name, media">
383
296
  <repeat with="&comma_split(name)">
384
297
  <link href="#{base_url}/stylesheets/#{this}.css" media="#{ media || 'all' }"
@@ -386,6 +299,7 @@
386
299
  </repeat>
387
300
  </def>
388
301
 
302
+
389
303
  <def tag="javascript" attrs="name">
390
304
  <if test="&name.is_a?(Symbol)">
391
305
  <%= javascript_include_tag name %>
@@ -397,11 +311,13 @@
397
311
  </else>
398
312
  </def>
399
313
 
314
+
400
315
  <def tag="flash-message" attrs="type">
401
316
  <% type = type ? type.to_sym : :notice %>
402
317
  <div class="flash #{type}" if="&flash[type]" merge-attrs><%= flash[type] %></div>
403
318
  </def>
404
319
 
320
+
405
321
  <def tag="ajax-progress">
406
322
  <div id="ajax-progress">
407
323
  <div>
@@ -411,7 +327,5 @@
411
327
  </def>
412
328
 
413
329
 
414
- <def tag="app-name"><%= @hobo_app_name ||= File.basename(Dir.chdir(RAILS_ROOT) { Dir.getwd }).strip.titleize %></def>
415
-
416
330
  <def tag="default-page-title"><%= t = this.to_s; ; "#{t.blank? ? '' : t + ' - '}#{app_name}" %></def>
417
331