fullname is displayed in the title, so there's no need to duplicate it
in the fields.
Bryan
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.
>
--Matt Jones
On Aug 16, 2011, at 8:11 PM, Arthur Baldwin wrote:
> I would very much like to hear from an expert in regard to this problem. At least let me know if this is considered a bug or not.
> At least that way, I can focus my attention on something else until it is resolved.
>
> Arthur
>
> From: Arthur Baldwin <eeng...@yahoo.com>
> To: "hobo...@googlegroups.com" <hobo...@googlegroups.com>
> Sent: Tuesday, August 16, 2011 2:25 PM
> Subject: Re: [Hobo Users] Possible Bug in Hobo 1.3
>
> If anyone knows of another addition that I can add to the following code in order to make the "show page" display "Arthur E. Baldwin" instead of "Customer"....I would appreciate it very much if you could let me know what that syntax looks like.
>
> fields do
> fullname :string, :name => true
> address :string
> timestamps
> end
>
> My wild guess is something like:
>
> fullname :string, :name => true, :title => true
>
> but I could be way off....please help.
>
> If there is no additional statement like this, then Hobo 1.3 does indeed have a bug.
>
> Arthur
> From: Arthur Baldwin <eeng...@yahoo.com>
> To: "hobo...@googlegroups.com" <hobo...@googlegroups.com>
> Sent: Tuesday, August 16, 2011 10:02 AM
> Subject: Re: [Hobo Users] Possible Bug in Hobo 1.3
>
> Also, the displayed URL is:
>
> http://localhost:3000/customers/1-arthur-e-baldwin
>
> So it is aware of the correct data in a way.
>
> Arthur
>
> From: Arthur Baldwin <eeng...@yahoo.com>
> To: "hobo...@googlegroups.com" <hobo...@googlegroups.com>
> Sent: Tuesday, August 16, 2011 9:53 AM
> Subject: Re: [Hobo Users] Possible Bug in Hobo 1.3
>
> I thought that might be the intention, but that line is displayed as "Customer", not "Arthur E. Baldwin", so it's still not quite right.
>
> Arthur
>
--
You received this message because you are subscribed to the Google Groups "Hobo Users" group.
To post to this group, send email to hobo...@googlegroups.com.
To unsubscribe from this group, send email to hobousers+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
When I started with Rails I really enjoyed "Agile Development with
Rails" 3rd edition. I still consult it from time to time for the
non-hobo doubts :)
I believe the current (fourth) edition has been updated for Rails 3.
Regards,
Ignacio
El 18/08/11 17:55, Arthur Baldwin escribi�:
- --
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Email realizado con software libre
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk5TzfwACgkQBPlUJ6RHaOQ5HgCeOrURGxtwNEpp+Gj6gueCGBc8
EKQAnjNe/TUIcEH9cTMXcWAdSmZltswD
=LpUJ
-----END PGP SIGNATURE-----
> I would very much like to hear from an expert in regard to this problem. At least let me know if this is considered a bug or not.
> At least that way, I can focus my attention on something else until it is resolved.
>
> Arthur
>
> From: Arthur Baldwin <eeng...@yahoo.com>
> To: "hobo...@googlegroups.com" <hobo...@googlegroups.com>
> Sent: Tuesday, August 16, 2011 2:25 PM
> Subject: Re: [Hobo Users] Possible Bug in Hobo 1.3
>
> If anyone knows of another addition that I can add to the following code in order to make the "show page" display "Arthur E. Baldwin" instead of "Customer"....I would appreciate it very much if you could let me know what that syntax looks like.
>
> fields do
> fullname :string, :name => true
> address :string
> timestamps
> end
Alright, got some time to poke around and here's what I found. The generated code (from pages.dryml) looks like this:
<h2 param="heading">
<ht key="<%= model_key %>.show.heading" name="&this.respond_to?(:name) ? this.name : ''">
<name/>
</ht>
</h2>
The relevant part from the generated hobo.en.yml:
show:
title: "%{model}"
heading: "%{model} %{name}"
The first problem is that the code that sets the name attribute being passed to ht isn't nearly as general as the code that <name /> would run in the absence of a translation. (the name tag handles name_attribute correctly)
The second issue is that, even given a model that actually responds to 'name', the translation doesn't match the un-translated version since there's that extra %{model} in there.
To resolve the first problem, I think we need a new helper 'name_for':
def name_for(obj)
if (name_attr = obj.class.try_name_attribute)
obj.send(name_attr)
else
obj.try.name
end
end
This would convert the pages.dryml code to:
<h2 param="heading">
<ht key="<%= model_key %>.show.heading" name="&name_for(this)">
<name/>
</ht>
</h2>
As to the second one, that's mostly a question of style. It would match the code inside the <ht> if we changed en.hobo.show.heading to just '%{name}' - thoughts?
--Matt Jones
Hi,
For the second problem, I believe the nicest default is to keep the
"model name", because it really helps the user to know what kind of
record he is looking at.
I don't know if I understood the problem correctloy, but why don't we
use two different translation tags, instead of a combined one?
Something like:
<ht key="<%= model_key %>.show.title"></ht>
<ht key="<%= model_key %>.show.heading><name/></ht>
What do you think?
Regards,
Ignacio
El 26/08/11 17:36, Matt Jones escribi�:
- --
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Email realizado con software libre
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk5ZBDkACgkQBPlUJ6RHaOSfqQCdEtjZHFp31oSN+kYponwPvnQl
rbwAnjytyro8QXv9Mv6+4v2+UEf3TCpf
=VmcB
-----END PGP SIGNATURE-----
I just realised:
What if we take the name of the record out of the translation?
<ht key="<%= model_key %>.show.title"></ht> <name/>
Regards,
Ignacio
El 27/08/11 16:50, Ignacio Huerta escribi�:
iEYEARECAAYFAk5ZBT4ACgkQBPlUJ6RHaORE0ACgqsnZ7nulWgMuO95viLmko6zu
xh8AnjdCoAY2p3Q3hhaZQXmkBcJ3wucl
=rvdp
-----END PGP SIGNATURE-----