I'm using the vhochstein rails 3 port. It looks like form_enhancements.js is for prototypes (although I haven't actually looked at the code). It wasn't installed by default, and things got a bit unhappy when I added it manually.
Regardless what I ended up doing was: 1. Implement a custom helper based on active_scaffold_input_plural_association. 2. Change the helper to load the associations I want, then call active_scaffold_checkbox_list to render the checkbox list. 3. I wrote a custom two-list multiple select widget that adds the check box items to the appropriate lists (selected / not selected). The widget has add remove buttons that updates the checkboxes (they are simply hidden). The checkboxes are then submitted with the form as usual and everything seems to work. If I have to come back to this I'll take a look at options_for_association_conditions. Btw - thanks for this project - despite the occasional hiccough it saves a huge amount of time! - L On Apr 19, 10:01 am, "Sergio Cambra .:: entreCables S.L. ::." <[email protected]> wrote: > On Martes, 19 de Abril de 2011 08:17:00 Liehann escribió: > > > Thanks for the response. > > > Draggable lists only works with prototype, I'm using jQuery. I'm > > checking out active_scaffold_sortable which looks like it should do > > the same thing for jQuery. > > rails 2.3 version of active scaffold requires prototype. rails3 version work > with either prototype or jquery, although I'm not sure all features, like > draggable lists, work with jquery. I haven't used rails3 version very much > yet. > > > The second issue is the default form_ui options displays all items, > > whereas I only want to display those that are associated with the > > specific order, or not yet associated with an order. > > Override options_for_association_conditions to search only unassociated items. > Associated items with that record will be added by ActiveScaffold. > > > > > > > > > > > > > My current approach is to do a form override method in the > > OrdersHelper. It looks like is should do the trick. I'll update the > > post once I've determined if it works (or not). > > > - L > > > On Apr 19, 1:51 am, Michael Latta <[email protected]> wrote: > > > From the documentation on the column API when using form_ui = :select > > > > • For plural associations: > > > • :draggable_lists to show two lists, one with available > > > options and the other with selected options; users select them with drag > > > and drop instead of checkboxes. config.columns[:name].options = > > > {:draggable_lists => true} > > > > Michael > > > > On Apr 18, 2011, at 10:03 AM, Liehann wrote: > > > > Hi, > > > > > I'd like to customize an association, but on the has_many side. > > > > > For example we have orders and items. An order has many items, an item > > > > may belong to an order. > > > > > class Order > > > > has_many :items > > > > end > > > > > class Item > > > > belongs_to :order > > > > end > > > > > When adding / editing an order I'd like to display two lists - the > > > > left one shows the items associated with the order, the right the > > > > items not associated with any order. > > > > > if I do "config.columns[:items].form_ui = :select" I get a check box > > > > for each item - not quite what I want. Any suggestions on how to > > > > customize the behavior? > > > > > - Liehann > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en. > > -- > Sergio Cambra .:: entreCables S.L. ::. > Mariana Pineda 23, 50.018 Zaragoza > T) 902 021 404 F) 976 52 98 07 E) [email protected] -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.
