Here is my data  model

project
name :string
has_many :sites
has_many :task

task
description :string
belongs_to :project
belongs_to :sites

site  (unique to each project )
name  :string
belongs_to :project
has_many :task

In fact, each task associate with 1 site.  And this site must tied to
the single project and should not be seen by other project.

I want to use the dynamic site selection inside show-page.

cookbook example only works for edit and new page
http://cookbook.hobocentral.net/recipes/33-ajax-filtering-on-a-partially

I define a show inside controller,and make a  show task page ,
show_task.dryml,
<show-page>
...
<table-plus:task fields="sites,description" >
     <description-view:/><editor/></description-view:>
      <site-view:>
          <select-site-editor include-none="&false"
options="&@project.sites" />
      </site-view:>
</table-plus>
....
</show-page>

And I hack into rapid-editing.dryml , copy the tag select-one-editor
and customise a new tag for my own use.

<def tag="select-site-editor" attrs="include-none, blank-message,
sort, update, options">......
...
  <select onchange="#{f}" merge-attrs>
     <%= options_from_collection_for_select(@sites, "id",
"name",this ? this.id : "") %>
  </select>
</def>

So when I go to the show_task page,  I can change "sites"  value via
table-plus.

Any other better way to do this beside hacking into rapid-
editing.dryml?

-- 
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.

Reply via email to