krlucas has an interesting sandbox project called field_edit. He was nice enough to send me an email and point me to the code. We talked a bit more about it and I think it makes sense to adapt the code from his sandbox to the 3.x branch of EF (I don't think there is a need to have a 4.x branch - that would be too confusing).

Credit needs to go also to ygerasimov as he came up with the CTools idea/patch.

I'll soon push some new things into the 3.x branch :)

CommentFileSizeAuthor
#2 editablefields.ctools_ajax_1.patch9.76 KBandreiashu

Comments

andreiashu’s picture

Status: Active » Needs work
andreiashu’s picture

StatusFileSize
new9.76 KB

First patch attached.

It supports adding and removing (not just replacing values) on top of what we had initially.

I tried to continue on the direction that the sandbox code took: replace individual values in the UI. This seems to be pretty fragile because we can't render 1 value of a multivalued field along with it's wrapper divs (please correct me if I'm wrong!).
In EF we don't have this issue as we just wrap the whole field in a known div (think #id) and then render and replace the whole thing. This has it's drawbacks too (afaik something to do with the field's label) but it seems to me better than trying to handle the values individually.

Thoughts are welcomed.

andreiashu’s picture

I forgot to mention: I didn't yet include the views hooks. I'll do that in the future, once we figure out which way to go with the normal node view.

krlucas’s picture

I just did a brain dump here of my ideas regarding CTools integration at #1040592: Edit in modal frame/pop-up via jQuery ?.

but we should probably continue the conversation here.

One caveat to my thoughts there is we'll also need to write plug-ins for any other fields currently supported by 6.x-2.0

krlucas’s picture

Here's another version of my brain dump!

/**
 *
 * editablefields.module // api declarations, legacy formatter handling, everything else
 * includes
 *  plugins
 *    editables     // responsible for form (element) generation, validation and submission
 *                  // responsible for "extra" formatter form_elements settings supplied to 
 *                  // Views 2 UI and Panels' content_type plugins (?).
 *
 *      cck.inc           // heavily relies on the formatter/widget api
 *
 *      node.inc          // title, body -- whatever else node.module insists upon
 *                        // or whatever page_manager/panels provides as node content_type plugins
 *
 *      node_taxonomy.inc // taxonomy selections as rendered on node forms
 *
 *    responders      // kinda like ctools' modal.inc declares 
 *                    // ctools commands and js include functions and form wrappers
 *                    // basically does whatever the editable tells it to
 *                    // an abstraction of:
 *                    // http://www.angrydonuts.com/ctools-presentation-slides-and-example-code
 * 
 *      editable_inline.inc         // handles form consolidation logic?? (i.e. as few
 *                                  // forms per page render?)
 *                                  // abstracts js/non-js form handling?   
 *      editable_ctools_modal.inc   // not sure if this is necessary or maybe it can be one line
 *                                  // wraps CTools Modal; the specifics of ttp://www.angrydonuts.com/ctools-presentation-slides-and-example-code
 *                     
 *  content_types
 *    editable_node_taxonomy.inc  // panel pane for providing taxonomy widgets in node context?
 *                                // ???
 *
 *
 * js
 *  editables.responder.js  // provides the js api implementations necessary for responders
 *                          // kinda like CTools.AJAX.Responder?
 *                          // also responsible for js event binding/delegation for other responders
 *    
 *   editables.inline.js    // implementation of reponder.js kinda like Ctools.AJAX.modal is a sort
 *                          // of implementation of CTools.AJAX.Responder 
 *   editables.ctools-modal.js  // unnecessary or wrapper functions
 *
 *
 *
 * EXAMPLE EXAMPLE EXAMPLE companion/sub- module structure
 * uc_editablefields.module // Ubercart editables
 * includes
 *  plugins
 *    editables // _form, _form_submit, _form_validate ++
 *      product.inc   // product node editables like price and stuff
 *      order.inc     // order fields
 *  responders
 *      // above could just specify ctools_modal or editable_inline?
 *      // so below would not be necessary.
 *      order.inc  // specialized ctools js command implementations, 
 *                    special includes, unexpected UI needs
 * js
 *    // js implementations for any responders
 *
 *
 * EXAMPLE EXAMPLE EXAMPLE companion/sub- module structure
 * date_editable.module   // CCK Date Field Editables  
 *                        // A super editable that for some reason doesn't 
 *                        // makes sense on the normal form node edit page 
 *                        // and thus can't be (completely) handled through CCK API.
 *                        // Like a multi-step form to submit from and to dates
 *                        // of a date.module field separately.
 *                         
 * includes
 *  plugins
 *    cck_date.inc
 *    
 *  responders
 *      // Multi-step shouldn't require anything special if they want to use modal or inline.
 *    calendar.inc  // some sort of wacky handler; probably a companion to a Views style plugin
 *                  // renders an editable calendar where you can edit the dates on events
 *
 */

So possibly two new plug-in types--editable and responder. The responder is about reducing the duplicate php code required to render and repsond to form rendered in a modal, an inline or some custom AJAX/JS responder using the ctools form and ajax command apis--anticipating that modal and inline will be able to handle many forms provided by most "editable" plug-ins. That said, to reduce the complexity of THIS module, we could treat "responder" as a pattern within an editable plug-in. Each editable plug-in would be larger, doing a lot of the same ctools_includes and and commands and stuff.

joelpittet’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Last update was 2011, going to close as outdated because it's against 6.x branch.