Table-plus doesn't use view hints
Reported by Iain | July 1st, 2009 @ 11:40 PM
Currently in rapid doesn't use view hints (if they are available) to determine column headers.
For example, given a model with two fields:
class Example < ActiveRecord::Base
hobo_model
fields do
foo :string
bar :string
timestamps
end
# Permissions etc...
end
And a view hint that changes the name for one of them:
class ExampleHints < Hobo::ViewHints
field_names :bar => "Something Else"
end
Then if you display a of "Example" objects () then the column
headers will appear as "Foo" and "Bar" rather than "Foo" and
"Something Else". This seems to have been fixed for
<table>
but not for . Here's the code for
<table>
to generate the headers:
<with-field-names merge-attrs='&all_attributes & attrs_for(:with_fields)'>
<th param='#{scope.field_name}-heading'><%= this.member_class.try.view_hints.try.field_name(scope.field_name) if scope %></th>
</with-field-names>
Whereas here it is for :
<with-field-names merge-attrs='&all_attributes & attrs_for(:with_fields)'>
<!-- Stuff for sorting by a particular column... -->
<th param='#{scope.field-name}-heading'>
<a href='&sort_url' class='column-sort' param='#{scope.field-name}-heading-link'><%= scope.field_name.titleize %></a>
<!-- More sorting stuff -->
</th>
</with-field-names>
I'd have thought that the code to output the header should be the same for both? Also, because the parameter names are generated dynamically (and there's additional logic inside the tag) it's hard to correct this at the application level.
Comments and changes to this ticket
-
Owen August 17th, 2009 @ 05:28 PM
- Assigned user set to Bryan Larsen
Bryam/Tom,
How hard would this be to fix? It is a very visible issue I am running into in my tutorials...
-
Bryan Larsen August 28th, 2009 @ 10:22 PM
- State changed from new to resolved
Thanks, Iain -- I've pulled your patch and patched it to retain compatibility with old behaviour.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป