Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
ajax system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 May 2007 at 09:10 UTC
Updated:
16 Jan 2011 at 15:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
jpetso commentedWording consistency: I wanted to use "...until you save this post" instead of "...unless you save this post", but somehow missed it. Fixed in this reroll of the patch.
Comment #2
joshk commentedThis applies clean and works as advertised. Usability ++
We may want to tinker with the language here, but it works well. I would think UnConeD may want to review your javascript (I have a feeling it might be implemented with less code), but the theory of what's going on here is sound.
Comment #3
jpetso commentedDrupal.uploadAutoAttach() is called at the end of both the 'if' and the 'else' branch, and the previous version of my patch only extended the 'else' branch with restoring the previous 'delete' status. Which does not come with any bugs, because the 'if' branch only covers the case when no item was uploaded before, so nothing needs to be restored either way.
Nevertheless, with regards to readability, I think it might be a good idea to extract Drupal.uploadAutoAttach() out of both if/else branches and place it after the condition, together with the 'delete' status restore statement. So, here is a new version of the patch, functionally equivalent to the previous one.
Comment #4
jpetso commentedFor layouting purposes (I needed to get imagefield to work with this), it seems better to assign the "form-item" class to the button, just as the original Delete checkbox belongs to this class as well. This updated patch just adds the class to the button creation code.
Comment #5
jpetso commentedBeginner's mistake: of course, the "xxx.txt is scheduled for deletion." text needs to be done with t(). (Doh!)
Also, update the patch to apply cleanly to current HEAD, as the JavaScript aggregation patch added a few semicolons to upload.js. (They are now also at the end of the new functions.)
Comment #6
jpetso commentedPer Steef's suggestion, use a CSS class instead of an inline style="display: none;" for initial hiding of yet hidden stuff. Also, the checkbox can automatically be hidden by assigning it the "js-hide" class. Rename the "-hide" and "-show" classes to "-visible" and "-hidden", which hopefully makes for better understanding. Finally, use fadeIn('fast') instead of plain fadeIn().
Free for another round of reviews!
Comment #7
drewish commentedsubscribing, sounds like a cool change
Comment #8
jpetso commentedI put up a demo site where you can try how this patch feels like. Log in with "files" as username and "delete" as password, and delete files like there is no tomorrow.
Comment #9
AjK commentedTried this on IE6 (as requested) and it works a treat. Rather nice actually, well done guys!
Comment #10
jpetso commentedFor the record, I tested it on Firefox and Konqueror, where it also works just fine. Konqueror of course doesn't do transparency for fadeIn(), but if you don't know how it should look like you won't even notice.
Comment #11
dldege commentedTested and worked as advertised on current Drupal head with no other patches in play.
Very nice feature but I think the status text needs a little work.
"fade.png" is scheduled for deletion. Mind that it will not be deleted until you save this post.IMO that could just be
"fade.png" is marked for deletion.The rest is redundant as the whole upload form fieldset contains
Changes made to the attachments are not permanent until you save this post.No functional issues were found in my testing (FF 2.0 only).
Comment #12
jpetso commentedYes, I think you're right. The additional text came from the patch's filefield origins, where the additional help text above is not included.
Here's an updated patch with the proposed text change.
Comment #13
jpetso commentedw00t! We can now do t() in JavaScript! Saves 3 lines, including an ugly PHP->JavaScript data transfer. Updated patch attached, please review.
Comment #14
nedjoThis is a worthwhile usability improvement.
The approach seems generally well done. I haven't tested. Some comments on the code:
1.
Drupal.getFileDeleteDatashould create an object. Javascript doesn't really support associative arrays, see this article. Try switching to e.g.Then you can create like:
Here as well an array is incorrect:
Consider
2. Also consider converting the
initFileDeleteandDrupal.updateFileDeletemethods into methods of thefileDeleteDataobject.3. Several variables are used without being declared.
4. This seems a bit awkward:
Can't/shouldn't these wrappers be added to the form elements before theming?
Comment #15
jpetso commentedThanks for the review, nedjo. I'll look into fixing the points 1, 2 and 3.
As for 4, it would be absolutely no problem to include this in the original form declaration, but I feel that this logically belongs to theming. If others disagree with that, you can most certainly have all those divs in _upload_form(), and it will probably look cleaner.
Comment #16
lilou commentedComment #17
jpetso commentedHaving rewritten it for FileField v6 (even if that code is mostly gone again, due to *cough* unexpected circumstances), I would think that this should be redone with much less JavaScript and more form state awareness - not the JS should remember the deletion status, but the deleted files should probably not be shown at all and remembered as deleted in the form state only, until the node is submitted.
No motivation to work on this for the time being, let's unassign this from me.
Comment #18
sutharsan commentedMoving this issue to the Usability component for more usability focus.
Comment #19
aspilicious commentedWe have a remove button! :p