Help adding table-plus to a collection-section

28 views
Skip to first unread message

Raklet

unread,
Aug 5, 2011, 11:45:33 PM8/5/11
to hobo...@googlegroups.com
I'm trying to add table plus to a "child" collection section.  I have the following code in application.dryml

<extend tag="show-page" for="WoPlant">
  <old-show-page merge>
    <collection:wo_plant_times replace>
      <div>
        <table-plus fields="start_time, end_time, acres_planted, note"/>
      </div>
    </collection>
  </old-show-page>
</extend>

But the extension is not being applied.  It still shows the auto-generated code from pages.dryml.

Any help would be greatly appreciated.

Thanks, 

Tyler

Tomas

unread,
Aug 6, 2011, 4:43:38 AM8/6/11
to Hobo Users
Hi,
I am a beginner with Hobo so my answer might be completely wrong :-)

I managed to do what you want by following tutorials 12/13/14 in the
beta book.

I have a child model "transaction" that belongs to the model "rental".

app/views/taglibs/application.dryml

----snip---
<def tag="show-page" for="Rental">
<page merge title="#{ht
'rental.show.title', :default=>['Rental'] }">

<body: class="show-page rental" param/>

<content: param>
<header param="content-header">
<h2 param="heading">
<ht key="rental.show.heading" name="&this.respond_to?
(:name) ? this.name : ''">
<name/>
</ht>
</h2>

<record-flags fields="" param/>

<a action="edit" if="&can_edit?" param="edit-link">
<ht key="rental.actions.edit" name="&this.respond_to?
(:name) ? this.name : ''">
Edit Rental
</ht>
</a>
</header>

<section param="content-body">
<field-list fields="firstname, lastname, email, country,
phone, personalid" param/>
<a:transaction action="new" if="&can_create?
(@rental.transaction)" param="new-link">
<ht key="transaction.actions.new" count="1">
Add Transaction
</ht>
</a:transaction>
<div/>
<section param="collection-section">
<collection:transaction param/>
</section>
</section>
</content:>

</page>
</def>
----snip---

app/views/rentals/show.dryml
<show-page>
<collection: replace>
<div>
<table-plus:transaction
fields="this,start,stop,transtype,amount,comment">
<start-view:><view format="%F %R"/></start-view:>
<stop-view:><view format="%F %R"/></stop-view:>
<empty-message:>No transactions yet</empty-message:>
<controls:/>
</table-plus>
</div>
</collection:>
</show-page>


So when I look at a rental I get a list of all the transactions.


/TC

Raklet

unread,
Aug 6, 2011, 9:16:53 AM8/6/11
to Hobo Users
Thank you! That was the solution.

Tyler

kevinpfromnm

unread,
Aug 8, 2011, 2:01:24 PM8/8/11
to hobo...@googlegroups.com
Your problem is from using <collection:wo_plant_times replace>...

Instead try
<collection: replace>
  <table-plus:wo_plant_times ... />
</collection:>

The difference is that the first is really a shortcut to writing <collection field="wo_plant_times" replace>.  Since that's not a parameter, it tries to put it in the default parameter which is undefined for show-page and thus, gets silently dropped.
Reply all
Reply to author
Forward
0 new messages