On Jan 23, 2011, at 1:12 PM, Peter Booth wrote:

> I'm wondering if anyone can help with the following?
> 
> I am trying to build a form that will allow a user to view a grid of scraped 
> image thumbnails,
>  and delete a subset of these.
> 
> I am stuck trying to understand how to wire the form. I'm wondering if there 
> is an example that 
> shows how to select a subset of has_many associations to delete?
> 
>  My app has two models: ScrapeJob and Scrape
> 
> 
> ScrapeJob represents an entire page
> 
> Scrape holds a single image (using paperclip) 
> 
> has_attached_file :photo,
>        :styles => {
>          :thumb=> "100x100#",
>          :small  => "400x400>" }
> 
> ScrapeJob  has_many :scrapes
> 
> When a ScrapeJob is created it uses a callback to scrape the chosen page 
> after the model object is written to the DB
> 
> after_save :start_scraping
> 
> I have extended the Card for Scrape so that the ScrapeJob show page shows the 
> images 
> 
> <extend tag="card" for="Scrape" >
>   <old-card merge>
>     <heading: param> 
>         <img src="#{this.photo(:thumb)}"  />         
>     </heading:>
>   </old-card>
> </extend>
> 
> 
> My challenge is making the edit page work.
> 
> I understand that <select-many> and <check-many> work with existing objects, 
> whilst the tag <input-many> is intended for new objects.
> 
> 
> When my edit page looks like this
> 
> <def tag="edit-page-new">
>   <edit-page merge>
>     <content-body:>
>       < select-many:scrapes><img src="#{this.photo(:thumb)}"  /> 
> </select-many>
>     </content-body:>   
>   </edit-page>
> </def>
> <edit-page-new/>


The form here has vanished because you asked it to. :)

The content-body param here blows away *everything* inside it, including the 
form tag. Doing this:

<edit-page merge>
  <form:>
    <field-list: replace>
      ...content here...
    </field-list:>
  </form:>
</edit-page>

will leave the form tag alone, along with the submit button and the 
error-messages bit.

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

Reply via email to