Kevin,

thanks a lot !

It works 100% like I wanted. Perfect.

On 19 Apr., 20:15, kevinpfromnm <[email protected]> wrote:
> I don't think you really want that check on the model itself (i.e. in
> the table) as from the sounds of it, you want the checkboxes to be
> able to select multiple records for a particular action.  What I have
> done for a similar situation (I won't post the full code as it's quite
> ugly), was something like this:
>
>   <form name="form_update_letters" #link this to a custom controller
> action>
>     <div class="checkbox-controls">
>       <checkbox-controls form-name="form_update_letters" />
>     </div>
>     <table-plus fields="...">
>       <append-controls:>
>         <p param="checkbox">
>           <em>Select for action:</em>
>           <table-checkbox with="&this" />
>         </p>
>       </append-controls:>
>       <submit-button with="&'SelectToPrint'" /> # I used multiple
> submits with different values to trigger different actions
>     </tabble-plus>
>     <div class="checkbox-controls">
>       <checkbox-controls form-name="form_update_letters" />
>     </div>
>   </form>
>
> the helper tags I wrote:
>
> <def tag="table-checkbox" attrs="checked">
>   <input class="table-checkbox" type="checkbox"
> name="&this.class.to_s.downcase + '[]'" id="&this.class.to_s.downcase
> + '[' + this.id.to_s + ']'" value="&this.id.to_s" checked="&checked" /
>
> </def>
>
> <def tag="checkbox-controls" attrs="form-name">
>   <span param="label">Selections:<br /></span>
>   <span param="invert"><%= link_to_function "Invert",
> "toggleCheckboxes(document.#{form_name}.getElements())" %></span>
>   <span param="clear-all"><%= link_to_function "Clear",
> "clearCheckboxes(document.#{form_name}.getElements())" %></span>
>   <span param="set-all"><%= link_to_function "Check All", "fields =
> document.#{form_name}.getElements(); clearCheckboxes(fields);
> toggleCheckboxes(fields)" %></span>
> </def>
>
> <def tag="submit-button">
>   <input type="submit" name="submit" value="&this.titleize" />
> </def>
>
> Feel free to use as is if it helps.  Basically, adds a regular
> checkbox named after the item.  Submitting I grabbed the submit value
> which is the name and called different actions in the controller:
>
>   def update_letters
>     keys = params[:letter] unless params[:letter].nil?
>     case params[:submit]
>     when "Set As Spam"
>     ...
>
> After looking back at this, it seems there isn't a clean, simple way
> to do this design pattern.  Honestly, I'm not sure how one would even
> go about adding that to hobo.  Maybe a tweaked lifecycle or lifecycle
> like pattern could do it?  Then table-plus or another tag could create
> the checkbox and a link for each mass assignment action.
>
> On Apr 19, 5:14 am, Karsten Redmer <[email protected]> wrote:
>
>
>
> > Thanks Venka!
>
> > Now I have a checkbox, but no chance to do a special action.
>
> > How to solve this?
>
> > On 19 Apr., 11:09, Venka Ashtakala <[email protected]> wrote:
>
> > > If you want to display input fields in table-plus, you'll have to override
> > > the default behaviour which is just to display the values.  To do this, do
> > > the following:
>
> > >  <table-plus fields="checked, lastname, firstname, zipcode, city,
> > > telefon, mobil">
> > >       * <checked-view:><input/></checked-view:>*
> > >        <controls:/>
> > >    <empty-message:>No contacts match your criteria</empty-message:>
> > >  </table-plus>
>
> > > On 18 April 2010 20:51, Karsten Redmer <[email protected]> wrote:
>
> > > > Hi all,
>
> > > > I have a index-page (contacts) with a table-plus tag.
>
> > > > I want to add a check-box to select some or all records in order to
> > > > send them an email/or destroy.
>
> > > > Somewhere I need a select box for my actions....
>
> > > > index.dryml (definition from auto-rapid-pages)
>
> > > > <index-page>
> > > >  <collection: replace>
> > > >    <table-plus fields="checked, lastname, firstname, zipcode, city,
> > > > telefon, mobil">
> > > >        <controls:/>
> > > >    <empty-message:>No contacts match your criteria</empty-message:>
> > > >  </table-plus>
> > > >  </collection:>
> > > > </index-page>
>
> > > > "Checked" is now a boolean field in the model - but I don't see a
> > > > checkbox - just "yes" or "no".
>
> > > > Can you give me a hint?
>
> > > > --
> > > > 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]<hobousers%[email protected]>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/hobousers?hl=en.
>
> > > --
> > > Venka Ashtakala, B.Eng, G.C. Eng
> > > Venka Ashtakala & Associates
> > > Software Development Consultants
> > > Office:  +1-703-596-0287
> > > Fax:     +1-815-550-1356
> > > Mobile: +91 9886304317
> > > [email protected]
>
> > > --
> > > 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 
> > > athttp://groups.google.com/group/hobousers?hl=en.
>
> > --
> > 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 
> > athttp://groups.google.com/group/hobousers?hl=en.
>
> --
> 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 
> athttp://groups.google.com/group/hobousers?hl=en.

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