Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-1.x-dev
Component:
Usability
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
25 Feb 2008 at 23:24 UTC
Updated:
16 Mar 2008 at 23:32 UTC
Jump to comment: Most recent file
Comments
Comment #1
catchComment #2
yched commentedTrue, never occurred to me :-)
tabledrag.js has everything ready for us (see Drupal.tableDrag.prototype.row.prototype.onSwap)
Comment #3
karens commentedComment #4
ximo commentedI've claimed this task, and have made a working patch.
I based my code on block.js, as recommended in tabledrag.js.
onSwap would show the Save button before the warning message was shown, so I used onDrop instead. In order to know that the table really had been changed, I used onSwap to set a variable to true.
So much (relatively) JavaScript was required that it couldn't be easily injected inline, so I made a content.js file and put it there. I don't know if you would want to have a .js file for all CCK's JavaScript. Alternatively, I could compress this JS and include it inline - however it would make maintenance difficult.
The content.js file contains console.log() functions so that you may see when it fires using Firebug.
Btw, I noticed that weight elements in the table are textfields and not selects when JS is turned off... I guess you're not done with the form yet :)
Comment #5
yched commentedThanks ximo !
Adding a new content.js is perfictly fine IMO. It should see other additions shortly anyway.
Is the
tableChanged = true;flag really needed ? Tabledrag.js already sets its own(see
self.changed = true;inDrupal.tableDrag.prototype.dropRow).Strangely enough, the 'Save' button on my 'Manage fields' tab has the id #edit-submit-1, instead of #edit-submit as expected in your patch..
And the search box's 'Search' button is #edit-submit-2.
Are form element id's unpredictable, by any chance ?
If so, we should probably add a specific class to our 'Save' button, and use that class in the jQuery selector instead.
Aside from this, the patch seems to work perfectly well.
Comment #6
catch///Are form element id's unpredictable, by any chance ?
Yep. A patch went in somewhere to ensure unique ids for everything - any chance there's two id="edit-submit" on that page? Class as a selector sounds great to avoid this inconsistency though.
Comment #7
ximo commentedI didn't notice the
self.changedflag - thanks! The JS code looks much better now. I also removed thetablevariable which was left by mistake, as well as theconsole.log().. now that you've seen that it works.A class name of
content-admin-field-overview-submit(long, but precise) has been added to the Save button, and is now used to reference the button from JS.You may also want to place the
drupal_add_js()call that loads content.js somewhere more appropriate if you intend to use the file for other purposes.Comment #8
yched commentedCommitted. I simply moved the line that adds the class into the theme function, since this is also where we add the js calls that use it.
Thanks !
Comment #9
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.