Hi,

Seems to me that the drag/drop sorting does not work properly, as shown in attachment.

1) drag the first image, and swap with the second one.
2) save sorted results.

After saving, the first image becomes the last, which is incorrect.

Any ideas why?

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

justintime’s picture

Priority: Normal » Major

Damn - I was going to rant about the nightmare that is jquery, jquery_ui, and jquery_update, but then I duplicated the bug on two of my instances.

@foredoc - I was unable to duplicate the problem when I hit node/|NID|/sort/no_jquery - can you confirm the same?

@scroogie - you trolling? I'd love your jquery skills on this one.

foredoc’s picture

Thanks. And I confirm that, by using node/|NID|/sort/no_jquery, there is no such problem.

dddave’s picture

Confirmed. Odd that I didn't see this before. Might have been introduced lately.

scroogie’s picture

Apparently this happens when the weights are not sequential and starting from 0 before you order the images (which can easily happen, so it was an oversight). See node_gallery.pages.inc lines 844-858. It wouldn't happen if we would update always every weight, but I guess thats also not really desirable. I'm not yet sure how I can avoid this, though.

scroogie’s picture

FileSize
865 bytes

So theoratically this should be the easy fix. If you can confirm (i've got problems reproducing the error), at least we know that we're talking about the same thing. Then we can think about a better way to fix it, if required.

dddave’s picture

I am going to test this asap. Just for the record I noticed that the sort is completely broken. Instead of makeing the first pic second I put the second one and dragged it to the first spot-> Completely random outcome.

dddave’s picture

Dragged and dropped extensively and the issue seems to be fixed.

justintime’s picture

Title: Drag/Drop Sorting does not work properly » jQuery-based Drag/Drop Sorting broken
Status: Active » Fixed

I didn't test it, but reviewed the code. Now the jquery sort submit handler does the same thing as the no_jquery one, and that's how we did it back in 2.x.

While it may not be the cleanest approach, there's no functional problems with it. Instead of hashing out the best way to deal with it, I just committed @scroogie's patch into 3.x-dev. I'll wait until late today or early tomorrow and release beta3, since this is a fairly impactful issue.

foredoc’s picture

Status: Fixed » Needs work

Hi,

I downloaded a new Node Gallery 6.x-3.0-beta2, and applied the patch on it. However, the drag/drop sorting still does not work. Actually, it simply stick to the original order, no matter how I change them through drag/drop.

When I print out the $new_sort, and $original_sort, they are exactly the same.

Any ideas?

Thanks.

justintime’s picture

Status: Closed (fixed) » Fixed

It's a local issue - the patch fixes http://dev.justintime.gotpantheon.com/ which was broken before the patch - you can test there if you like.

Try clearing your caches. If that doesn't work, it's likely a jquery mess, follow the docs @ http://ng3demo.sysadminsjourney.com/help/node_gallery/jquery-update to make sure things are correct.

foredoc’s picture

Status: Needs work » Fixed

Thanks. By disabling the jquery update module, the drag/drop sorting works.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

thatjustin’s picture

I had this issue. My symptoms were slightly different, I could sort and saving them worked without error, the order was just not ever changed. I had the jquery update module installed, and, following @justintime's and @foredoc's lead, I disabled the module, and all was better. But I needed the jQuery Update module for the plupload module. So, after some poking and prodding, following the instructions here:
http://drupalcode.org/project/jquery_ui.git/blob/refs/heads/6.x-1.x:/REA... on the jquery UI installation page for JQuery UI 1.7 did the trick.

I'm leaving this comment here for others.

justintime’s picture

Status: Fixed » Closed (fixed)

Thanks for the notes. Just to add to it, we cover this a bit in the help within the module, you can see a copy of it here: http://ng3demo.sysadminsjourney.com/help/node_gallery/jquery-update