hobo 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/CHANGES.txt +330 -0
  2. data/Manifest +12 -4
  3. data/Rakefile +4 -6
  4. data/dryml_generators/rapid/cards.dryml.erb +5 -1
  5. data/dryml_generators/rapid/forms.dryml.erb +8 -10
  6. data/dryml_generators/rapid/pages.dryml.erb +65 -36
  7. data/hobo.gemspec +28 -15
  8. data/lib/active_record/association_collection.rb +3 -22
  9. data/lib/hobo.rb +25 -258
  10. data/lib/hobo/accessible_associations.rb +131 -0
  11. data/lib/hobo/authentication_support.rb +15 -9
  12. data/lib/hobo/composite_model.rb +1 -1
  13. data/lib/hobo/controller.rb +7 -8
  14. data/lib/hobo/dryml.rb +9 -10
  15. data/lib/hobo/dryml/dryml_builder.rb +7 -1
  16. data/lib/hobo/dryml/dryml_doc.rb +161 -0
  17. data/lib/hobo/dryml/dryml_generator.rb +18 -9
  18. data/lib/hobo/dryml/part_context.rb +76 -42
  19. data/lib/hobo/dryml/tag_parameters.rb +1 -0
  20. data/lib/hobo/dryml/taglib.rb +2 -1
  21. data/lib/hobo/dryml/template.rb +39 -29
  22. data/lib/hobo/dryml/template_environment.rb +79 -37
  23. data/lib/hobo/dryml/template_handler.rb +66 -21
  24. data/lib/hobo/guest.rb +2 -10
  25. data/lib/hobo/hobo_helper.rb +125 -53
  26. data/lib/hobo/include_in_save.rb +0 -1
  27. data/lib/hobo/lifecycles.rb +54 -24
  28. data/lib/hobo/lifecycles/actions.rb +95 -31
  29. data/lib/hobo/lifecycles/creator.rb +18 -23
  30. data/lib/hobo/lifecycles/lifecycle.rb +86 -62
  31. data/lib/hobo/lifecycles/state.rb +1 -2
  32. data/lib/hobo/lifecycles/transition.rb +22 -28
  33. data/lib/hobo/model.rb +64 -176
  34. data/lib/hobo/model_controller.rb +67 -54
  35. data/lib/hobo/model_router.rb +5 -2
  36. data/lib/hobo/permissions.rb +397 -0
  37. data/lib/hobo/permissions/associations.rb +167 -0
  38. data/lib/hobo/scopes.rb +15 -38
  39. data/lib/hobo/scopes/association_proxy_extensions.rb +15 -5
  40. data/lib/hobo/scopes/automatic_scopes.rb +43 -18
  41. data/lib/hobo/scopes/named_scope_extensions.rb +2 -2
  42. data/lib/hobo/user.rb +10 -4
  43. data/lib/hobo/user_controller.rb +6 -5
  44. data/lib/hobo/view_hints.rb +58 -0
  45. data/rails_generators/hobo/hobo_generator.rb +7 -3
  46. data/rails_generators/hobo/templates/guest.rb +1 -13
  47. data/rails_generators/hobo_front_controller/hobo_front_controller_generator.rb +1 -1
  48. data/rails_generators/hobo_model/hobo_model_generator.rb +4 -2
  49. data/rails_generators/hobo_model/templates/hints.rb +4 -0
  50. data/rails_generators/hobo_model/templates/model.rb +8 -8
  51. data/rails_generators/hobo_model_controller/hobo_model_controller_generator.rb +10 -0
  52. data/rails_generators/hobo_model_controller/templates/controller.rb +1 -1
  53. data/rails_generators/hobo_rapid/templates/hobo-rapid.js +91 -56
  54. data/rails_generators/hobo_rapid/templates/lowpro.js +15 -15
  55. data/rails_generators/hobo_rapid/templates/reset.css +36 -3
  56. data/rails_generators/hobo_rapid/templates/themes/clean/public/stylesheets/clean.css +13 -17
  57. data/rails_generators/hobo_user_controller/templates/controller.rb +1 -1
  58. data/rails_generators/hobo_user_model/templates/model.rb +18 -16
  59. data/taglibs/core.dryml +60 -18
  60. data/taglibs/rapid.dryml +8 -401
  61. data/taglibs/rapid_core.dryml +586 -0
  62. data/taglibs/rapid_document_tags.dryml +28 -10
  63. data/taglibs/rapid_editing.dryml +92 -55
  64. data/taglibs/rapid_forms.dryml +406 -87
  65. data/taglibs/rapid_generics.dryml +1 -1
  66. data/taglibs/rapid_navigation.dryml +2 -1
  67. data/taglibs/rapid_pages.dryml +7 -16
  68. data/taglibs/rapid_plus.dryml +39 -14
  69. data/taglibs/rapid_support.dryml +1 -1
  70. data/taglibs/rapid_user_pages.dryml +14 -4
  71. data/tasks/{generate_tag_reference.rb → generate_tag_reference.rake} +49 -18
  72. data/tasks/hobo_tasks.rake +16 -0
  73. data/test/permissions/models/models.rb +134 -0
  74. data/test/permissions/models/schema.rb +55 -0
  75. data/test/permissions/models/test.sqlite3 +0 -0
  76. data/test/permissions/test_permissions.rb +436 -0
  77. metadata +27 -14
  78. data/lib/hobo/mass_assignment.rb +0 -64
  79. data/rails_generators/hobo/templates/patch_routing.rb +0 -30
  80. data/uninstall.rb +0 -1
@@ -1,3 +1,333 @@
1
+ === Hobo 0.8.4 ===
2
+
3
+ Rails 2.2 compatible. Rails 2.1 support dropped.
4
+
5
+ Removing the Rails routing patch (from the hobo generator) that is no longer needed.
6
+ Existing apps can delete this from config/initializers/patch_routing.rb
7
+
8
+ BREAKING: New permission system
9
+
10
+ This is the major feature of this release. The big change is that we now use the dirty tracking features
11
+ of Active Record for update permission, rather than passing that weird 'new' object. We also use the
12
+ acting_user method throughout, rather than passing the user as an argument.
13
+
14
+ See the docs online: http://cookbook.hobocentral.net/manual/permissions
15
+
16
+
17
+ Removing special Hobo semantics for association.new which was breaking the Rails API, and added
18
+ #new_candidate
19
+
20
+ association.new_candidate instantiates the record but does not add it to the collection.
21
+
22
+ Fix to linkable? helpers when context responds to origin but is not a collection
23
+
24
+ POSSIBLY BREAKING: Improved multi-model form support
25
+
26
+ has_many and belongs_to now support the :accessible => true option, which allows mass-asssignment of
27
+ attributes to work with sub-hashes that correspond to associations. Docs to follow!
28
+
29
+ BREAKING: Lifecycle improvements
30
+
31
+ The lifecycle DSL has been tidied up. Various changes to the semantics.
32
+
33
+ Lifecycle validations are now supported (e.g. validates_presence_of :foo, :on => :my_transition)
34
+
35
+ Also small improvements to the controller layer lifecycles support
36
+
37
+ See: http://cookbook.hobocentral.net/manual/lifecycles
38
+
39
+ New ViewHints mechanism
40
+
41
+ Classes in app/viewhints are a place to declare things about your models that are view layer concerns.
42
+ For example, you can give the presenation name for a field if this should be different from the back-end
43
+ name. You can give "field help" for each field. You can specify which collections are the "children" of a
44
+ model from a UI point of view.
45
+
46
+ Rapid <select-many> -- removed use of <a-or-an> as it gets some words wrong (e.g. "an user")
47
+
48
+ Rapid -- moved <or-cancel> to rapid_forms.dryml
49
+
50
+ Model controller fix -- owner instance variable should be named after the association, not the class (e.g.
51
+ @author, not @user)
52
+
53
+ View hints fix -- inconsistent results due to class reloading problem in dev mode (was causing inconsistent
54
+ Rapid pages to be generated)
55
+
56
+ Hobo Models -- added support for 1-to-1 relationships to Hobo::Model.reverse_reflection
57
+
58
+ This puts us a step closer to better support for 1-to-1 relationships in various places, e.g. for owner
59
+ actions
60
+
61
+ Improved error message when declaring auto_actions_for on an association that doesn't have the
62
+ corresponding reverse-reflection
63
+
64
+ Fixed query_params helper -- should URI decode the parameters
65
+
66
+ Rapid -- simplified <filter-menu> (no need for a hidden tag)
67
+
68
+ Rapid pages -- added <heading:> parameter to account page
69
+
70
+ DRYML -- fix to merge-attrs="a, b, c"
71
+
72
+ Rapid <input-many> -- added support for disable attribute
73
+
74
+ Fix to <hobo-rapid-javascripts> when forgery protection is disabled
75
+
76
+ User model - validates_presence_of password confirmation, in addition to validates_confirmation_of
77
+
78
+ Fixes #310 - thanks to Jaub Suder
79
+
80
+ BREAKING: Rapid page generators -- Renamed 'primary-content' parameter in <show-page> to 'description'
81
+
82
+ User controller -- made account action follow the auto_actions declaration
83
+
84
+ Changed hobo->hobofields->hobosupport gem dependency rules to require the exact version
85
+
86
+ User model generator -- Hobo apps now have people log in with their email address by default, and the user
87
+ has a 'name' field rather than 'username'.
88
+
89
+ Note this will not effect existing apps
90
+
91
+ Clean theme - fix to styling of login page in IE6
92
+
93
+ Rapid javascripts -- fix to in-place-editor errors not showing up properly (#324). Thanks to Jakub Suder
94
+
95
+ DRYML -- fixed duplicate ID bug with ajax parts (#326)
96
+
97
+ POSSIBLY BREAKING: Models -- removed support for chronic parsing of times / dates.
98
+
99
+ Was wrong to hardwire this support in for every date/time field. Will be added back in as a rich type
100
+ at some point
101
+
102
+ Scopes - Fixed association.conditions with scopes for has_many :through
103
+
104
+ Rapid <hidden-fields> -- now honours the 'skip' attribute under all circumstances
105
+
106
+ Rapid <page> -- app-stylesheet param, to make it easier to add in custom stylesheets, but have them
107
+ *before* application.css
108
+
109
+ Rapid <stylesheet> -- call stylesheet_link_tag once only so that asset combining is supported
110
+
111
+ DRYML -- allow <include plugin="foo"/> as a shorthand for <include src="foo" plugin="foo"/>
112
+
113
+ Removed super_user? and adminstrator? from Hobo::Guest, and added administrator? to Guest generator
114
+
115
+ administrator? should not be present at all in core Hobo, it's just a default starting point
116
+
117
+ Rapid <input for='boolean'> -- don't add the hidden field if the checkbox is disabled - thanks to Tola.
118
+
119
+ Rapid <nav-item> -- Fix to 'current' CSS class when a body is not given
120
+
121
+ Rapid pages -- fix to selecting current nav item
122
+
123
+ Added hobo:run_standard_generators task (*NIX only)
124
+
125
+ Guest - changed default #to_s and #login to use lower case
126
+
127
+ Rapid <remote-method-button> -- allow method name to use dashes, and raise an error if there's no such web
128
+ method
129
+
130
+ DRYML -- never run DRYML generators in production mode. Instead run
131
+
132
+ rake hobo:generate_taglibs
133
+
134
+ Rapid JavaScripts -- adding custom events to <select-many>
135
+
136
+ Rapid JavaScript -- added option to specify { message: false } on ajaxRequest to disable the spinner
137
+
138
+ Model Controller -- fix to re_render_form when in a subsite
139
+
140
+ hobo_model_controller generator -- adding support for generating subsite controllers
141
+
142
+ HoboSupport -- adding remove and remove_all (plus mutating versions with a !) to string - better name for
143
+ sub(x, '')
144
+
145
+ DRYML -- added support for scope.even_odd to the attribute version of repeat (was only on the tag version)
146
+
147
+ DRYML -- improved error message for mixed param / non-param tags
148
+
149
+ Model controller -- fix to index actions on non-paginated formats (was passing will-paginate options to a
150
+ regular find)
151
+
152
+ Migration generator -- adding option: --force-drop-yes-i-really-mean-it-i-know-what-i-am-doing-dammit
153
+
154
+ Not really, it's actually just --force-drop
155
+
156
+ With this option it won't ask you "drop or rename?" it will just drop
157
+
158
+ HoboFields -- fix to EnumString when values are not valid contant names
159
+
160
+ Rapid -- added support for 'disabled' to <select-many>
161
+
162
+ Enhanced ajax mechanism so that it can refresh form inputs (was previously not able to figure out the name
163
+ attributes)
164
+
165
+ Rapid -- adding support for 'disabled' attribute to <select-one>
166
+
167
+ Rapid -- added a 'no-edit' attribute to <input> and <field-list>. Gives control over how
168
+ non-editable fields are handled.
169
+
170
+ - view: render the current value using the `<view>` tag
171
+ - disable: render the input as normal, but add HTML's `disabled` attribute
172
+ - skip: render nothing at all
173
+ - ignore: render the input normally. That is, don't even perform the edit check.
174
+
175
+
176
+ Added <dev-user-changer> to the user 'simple pages' (login, signup...)
177
+
178
+ User conrtroller -- redirect to home_page if a logged-in user visits the login page
179
+
180
+ Model controller -- fix to lifecycle form inputs not showing up after a validation error
181
+
182
+ Rapid -- changed rules for <delete-button> chosing whether to be in-place or not
183
+
184
+ BREAKING (minor): removed 'type' attribute from <type-name>
185
+
186
+ BREAKING (minor): Rapid -- renamed 'separator' attribute of <comma-list> to 'join'
187
+
188
+ Rapid -- moved live-search and filter-menu tags into rapid_plus
189
+
190
+ Rapid -- removed unused <belongs-to-view>. Renamed <has-many-view> to <collection-view>, made it
191
+ polymorphic, and extracted the default definition as <links-for-collection>
192
+
193
+ Rapid -- tweak to behaviour of <name>. Is now more sensible when called on a non-AR class
194
+
195
+ Re-organisation and documentation for Rapid Document Tags
196
+
197
+ BREAKING: Deleted <panel> tag.
198
+
199
+ Models - fix to overriding of not_found and permission_denied in applicatin controller. Also fix to bug in
200
+ permission denied
201
+
202
+ Models -- fix to preceding dashes in to_param (sometimes showed up in the URL)
203
+
204
+ DRYML -- allow - instead of _ in repeat/if/unless, when not code attribute
205
+
206
+ HoboSupport - re-org of the file layout
207
+
208
+ HoboFields -- new rich type :serialized (HoboFields::SerializedObject)
209
+
210
+ example usage: foo :serialized, :class => Array
211
+
212
+ Also some fixes to wrapping of rich types that were needed
213
+
214
+ HoboFields -- adding 'declared' callback to rich types. Called whenever a field of that type is declared
215
+
216
+ See HoboFields::HtmlString for an example
217
+
218
+ HoboFields -- new types RawHtmlString and RawMarkdownString that are not sanitized. Plus fix to sanitizing
219
+
220
+ DRYML -- new DrymlDoc facility. Starting point for a roll-your-own documentation generator
221
+
222
+ Used to generate the cookbook taglib API reference.
223
+
224
+ hobo_front_controller generator -- use map.root for adding the root route
225
+
226
+ Model controller -- can call #re_render_form without an arg (for when you know params[:page_path] is set)
227
+
228
+ Support for non-numeric model IDs
229
+
230
+ Rails has no problems with these but Hobo was assuming integer IDs in a few places.
231
+
232
+ Fix to default ApplicationController#home_page -- was broken when the app lives in a sub-directory
233
+
234
+ Rapid -- allow '-' instead of '_' in <with-fields> (and therefore, <field-list> and <table field='...'>)
235
+
236
+ Rapid -- made <select-many> submit IDs instead of names, so that it also works with models that don't have a
237
+ unique name
238
+
239
+ Cleanup of dom_id / typed_id.
240
+
241
+ We now use the term "typed id" throughout to refer to a string that includes a model name and an ID.
242
+
243
+ These now use ':' instead of '_' as the model-name/id separator, which has the benefit of allowing
244
+ non-integer keys
245
+
246
+ HoboSupport -- adding String#safe_constantize. Returns nil (instead of raising a NameError) the constant
247
+ does not exist and cannot be loaded by ActiveSupport
248
+
249
+ BREAKING. Rapid pages -- separated out application.js from other JS includes and added a <custom-scripts:>
250
+ parameter
251
+
252
+ Adding extra scripts using this new parameter will ensure application.js comes last and can thus override
253
+ behaviour of custom scripts.
254
+
255
+ This is a breaking change because apps that have customised the list of JS includes might not now have
256
+ the set of scripts they expect
257
+
258
+ Rapid - adding polymorphic <collection-input> tag as a place to define the kind of input you want used for
259
+ collections of a given model
260
+
261
+ Rapid javascripts -- making non-ajax HTML Editor pluggable
262
+
263
+ Plugins assign a function to Hobo.makeHtmlEditor. See hoboyui plugin for an example (github.com/tablatom)
264
+
265
+ Adding XSS protection to HoboFields rich types (Sanitizing)
266
+
267
+ Rapid -- new tag <check-many>. Add remove items to a has_many :through by checking the ones you want. Obviously
268
+ this is only suitable when the number of items in the target model is small. (e.g. blog post categories)
269
+
270
+ Page generators -- better titles for collection previews in aside on a user's page
271
+
272
+ Page generators -- improved collection heading on show-page for a user
273
+
274
+ Fixes to "remember me"
275
+
276
+ Card generator -- observe view-hints when putting a count on the card
277
+
278
+ Rapid -- change to css classes on new-object forms (was 'new-post' now 'new post')
279
+
280
+ Rapid -- workaround for the fact that Maruku defines a to_html method on String
281
+
282
+ Page generators -- changed heading used on <edit-page>
283
+
284
+ HoboSupport -- added Object#present? that is on it's way from edge Rails (will remove when Rails provides
285
+ this)
286
+
287
+ User pages:
288
+
289
+ Added editing of email address to user's account page
290
+
291
+ Got rid of <change-password-form>
292
+
293
+ Rapid plus -- added <preview-with-more> and <gravatar> tags
294
+
295
+ Rapid -- removed unimplemented if-content attribute from base <card>
296
+
297
+ Rapid -- fixed class name dash problem in <name-one>
298
+
299
+ User model generator -- allow users to change their email address by default
300
+
301
+ Automatic scopes
302
+
303
+ extended with_things and without_things automatic scopes so that they work without arguments.
304
+
305
+ e.g. Question.with_answers and Question.without_answers
306
+
307
+ Automatic scopes -- have 'recent' scope just do a 'limit x' if there is no created_at column (used to
308
+ blow up)
309
+
310
+ Model Controller, allow :scope => :some_scope_name on index_action
311
+
312
+ Made object_url handle a scoped class (gives the index url, e.g. /posts)
313
+
314
+ Rapid generators -- fixed bug where some cards had title when they should not have
315
+
316
+ Rapid generators -- smarter index-for-owner page when the owner is a user
317
+
318
+ Rapid generators -- fixed wrongly named param in for new-for-ower pages
319
+
320
+ User controller generator -- remove :new action by default
321
+
322
+ DRYML - fixed problem where parameters where conflicting rather than merging
323
+
324
+ Improvements to reset stylesheet - strong, em and code now render as expetced
325
+
326
+ Moved all the tags defined in rapid.dryml into a new included file rapid_core.dryml to make it easier to
327
+ include only parts of the tag library if required
328
+
329
+
330
+
1
331
  === Hobo 0.8.3 ===
2
332
 
3
333
  Hobo models -- improvements to logic for validating passwords. Closes #281
data/Manifest CHANGED
@@ -9,12 +9,14 @@ lib/active_record/association_collection.rb
9
9
  lib/active_record/association_proxy.rb
10
10
  lib/active_record/association_reflection.rb
11
11
  lib/extensions/test_case.rb
12
+ lib/hobo/accessible_associations.rb
12
13
  lib/hobo/authentication_support.rb
13
14
  lib/hobo/bundle.rb
14
15
  lib/hobo/composite_model.rb
15
16
  lib/hobo/controller.rb
16
17
  lib/hobo/dev_controller.rb
17
18
  lib/hobo/dryml/dryml_builder.rb
19
+ lib/hobo/dryml/dryml_doc.rb
18
20
  lib/hobo/dryml/dryml_generator.rb
19
21
  lib/hobo/dryml/dryml_support_controller.rb
20
22
  lib/hobo/dryml/parser/attribute.rb
@@ -45,11 +47,12 @@ lib/hobo/lifecycles/lifecycle.rb
45
47
  lib/hobo/lifecycles/state.rb
46
48
  lib/hobo/lifecycles/transition.rb
47
49
  lib/hobo/lifecycles.rb
48
- lib/hobo/mass_assignment.rb
49
50
  lib/hobo/model.rb
50
51
  lib/hobo/model_controller.rb
51
52
  lib/hobo/model_router.rb
52
53
  lib/hobo/model_support.rb
54
+ lib/hobo/permissions/associations.rb
55
+ lib/hobo/permissions.rb
53
56
  lib/hobo/rapid_helper.rb
54
57
  lib/hobo/scopes/apply_scopes.rb
55
58
  lib/hobo/scopes/association_proxy_extensions.rb
@@ -61,6 +64,7 @@ lib/hobo/undefined.rb
61
64
  lib/hobo/undefined_access_error.rb
62
65
  lib/hobo/user.rb
63
66
  lib/hobo/user_controller.rb
67
+ lib/hobo/view_hints.rb
64
68
  lib/hobo.rb
65
69
  LICENSE.txt
66
70
  Manifest
@@ -70,7 +74,6 @@ rails_generators/hobo/templates/application.dryml
70
74
  rails_generators/hobo/templates/dryml-support.js
71
75
  rails_generators/hobo/templates/guest.rb
72
76
  rails_generators/hobo/templates/initializer.rb
73
- rails_generators/hobo/templates/patch_routing.rb
74
77
  rails_generators/hobo_front_controller/hobo_front_controller_generator.rb
75
78
  rails_generators/hobo_front_controller/templates/controller.rb
76
79
  rails_generators/hobo_front_controller/templates/functional_test.rb
@@ -79,6 +82,7 @@ rails_generators/hobo_front_controller/templates/index.dryml
79
82
  rails_generators/hobo_front_controller/USAGE
80
83
  rails_generators/hobo_model/hobo_model_generator.rb
81
84
  rails_generators/hobo_model/templates/fixtures.yml
85
+ rails_generators/hobo_model/templates/hints.rb
82
86
  rails_generators/hobo_model/templates/model.rb
83
87
  rails_generators/hobo_model/templates/unit_test.rb
84
88
  rails_generators/hobo_model/USAGE
@@ -127,6 +131,7 @@ script/destroy
127
131
  script/generate
128
132
  taglibs/core.dryml
129
133
  taglibs/rapid.dryml
134
+ taglibs/rapid_core.dryml
130
135
  taglibs/rapid_document_tags.dryml
131
136
  taglibs/rapid_editing.dryml
132
137
  taglibs/rapid_forms.dryml
@@ -139,9 +144,12 @@ taglibs/rapid_support.dryml
139
144
  taglibs/rapid_user_pages.dryml
140
145
  tasks/environments.rake
141
146
  tasks/fix_dryml.rake
142
- tasks/generate_tag_reference.rb
147
+ tasks/generate_tag_reference.rake
143
148
  tasks/hobo_tasks.rake
144
149
  test/generators/test_generator_helper.rb
145
150
  test/generators/test_helper.rb
146
151
  test/generators/test_hobo_model_controller_generator.rb
147
- uninstall.rb
152
+ test/permissions/models/models.rb
153
+ test/permissions/models/schema.rb
154
+ test/permissions/models/test.sqlite3
155
+ test/permissions/test_permissions.rb
data/Rakefile CHANGED
@@ -2,8 +2,6 @@ require 'rake'
2
2
  require 'rake/rdoctask'
3
3
  require 'rake/testtask'
4
4
 
5
- load "tasks/generate_tag_reference.rb"
6
-
7
5
  desc "Default Task"
8
6
  task :default => [ :test ]
9
7
 
@@ -42,12 +40,12 @@ Echoe.new('hobo') do |p|
42
40
  p.project = "hobo"
43
41
 
44
42
  p.changelog = "CHANGES.txt"
45
- p.version = "0.8.3"
43
+ p.version = "0.8.4"
46
44
 
47
45
  p.dependencies = [
48
- 'hobosupport >=0.8.3',
49
- 'hobofields >=0.8.3',
50
- 'rails >=2.1',
46
+ 'hobosupport =0.8.4',
47
+ 'hobofields =0.8.4',
48
+ 'rails >=2.2.2',
51
49
  'mislav-will_paginate >=2.2.1']
52
50
 
53
51
  p.development_dependencies = []
@@ -3,7 +3,7 @@
3
3
  name_attribute = model.name_attribute
4
4
  content_attribute = model.primary_content_attribute
5
5
  creator_attribute = model.creator_attribute
6
- primary_collection = primary_collection_name
6
+ primary_collection = model.view_hints.primary_children
7
7
 
8
8
  if creator_attribute
9
9
  creator_refl = model.reflections[creator_attribute]
@@ -16,12 +16,16 @@ delete_button = !show_link && !edit_link && linkable?(:destroy, :method => :dele
16
16
 
17
17
  has_actions = edit_link || delete_button
18
18
  has_body = (!show_link && content_attribute) || creator_link || creator_attribute || primary_collection
19
+
20
+ show_title = !show_link && (name_attribute || !has_body)
19
21
  -%>
20
22
  <def tag="card" for="<%= model.name %>">
21
23
  <card class="<%= model_name :dashed %>" param="default" merge>
22
24
  <% if name_attribute || show_link || has_actions || !has_body -%>
23
25
  <header: param>
26
+ <% if show_link || show_title -%>
24
27
  <h4 param="heading"><% if show_link %><a><name/></a><% else %><name/><% end %></h4>
28
+ <% end -%>
25
29
  <% if has_actions -%>
26
30
  <div param="actions">
27
31
  <% if edit_link -%>