On Mar 24, 2010, at 11:55 AM, bugaian wrote:
Hello team,
I am new to hobo.
I want to use hobo as plugin and I do have the
app/views/equipment/show.dryml
<show-page>
<collection: replace>
<table-plus:equipment fields="Accepted, Item_Name, IP_Address">
<empty-message:>No equipment match your criteria</empty-message:>
</table-plus>
</collection:>
</show-page>
Note that this is a 'show' page; I'm guessing you're looking to
customize the 'index' page instead. Show pages are intended to show
the fields, etc. of an individual record (a URL like /equipment/5) and
thus don't have a collection section unless you've declared a child
relation in equipment_hints.rb.
A sample index.dryml page would look like:
<index-page>
<collection: replace>
<table-plus fields="Accepted, Item_Name, IP_Address">
<empty-message:>No equipment match your criteria</empty-message:>
</table-plus>
</collection:>
</index-page>
Some other notes:
- "equipment" is not the best model name; it's going to cause Rails
(and Hobo) to sometimes emit weird sentences, as it doesn't
pluralize / singularize cleanly. It's especially going to confuse the
RESTful routing stuff, as the index route (maps to /equipment,
typically named after the plural) and the show route (maps to /
equipment/:id, typically named after the singular) will overwrite each
other. I'm not sure which you'll get if you call
equipment_path(@some_object) in a view.
- unless you're stuck with a legacy DB that *has* to interoperate
against your app's database, it's worthwhile to try to stick to the
field naming conventions (lowercase).
- the table-plus will work better if you reference the object in the
fields list:
fields="Accepted, this, IP_Address"
and indicate which field is the 'name' attribute (likely Item_Name
here) by adding :name => true to that field's declaration. This will
give you a link to the specific item, with the name as the link text.
Hope this helps!
--Matt Jones
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.