-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drag-and-drop ordering #41
Labels
Comments
jefflunt
added a commit
that referenced
this issue
Jun 6, 2012
- Added needed scopes for ordering of thoughts - Inserted some ruby 1.9 style hashes
jefflunt
added a commit
that referenced
this issue
Jun 6, 2012
…value on the Thoughts in a ThoughtWall.
jefflunt
added a commit
that referenced
this issue
Jun 6, 2012
…er` value that should be assigned. Re-worked a bug in the `highest_manual_order_value` method.
jefflunt
added a commit
that referenced
this issue
Jun 6, 2012
jefflunt
added a commit
that referenced
this issue
Jun 6, 2012
…der is not yet persisted, nor reflected to all clients.
jefflunt
added a commit
that referenced
this issue
Jun 7, 2012
…hm for re-numbering the sibling thoughts is slightly different depending on whether or not you're moving an item up the list, or down the list.
jefflunt
added a commit
that referenced
this issue
Jun 7, 2012
… Tried moving javascript loading to the end of the page, but this doesn't work because (at least for now) there is some JavaScript in the main view that depends on jQuery and cortex_core having been loaded.
jefflunt
added a commit
that referenced
this issue
Jun 7, 2012
jefflunt
added a commit
that referenced
this issue
Jun 7, 2012
… of the page. This gets us <100ms load times (at least locally). This is about a 50% decrease.
jefflunt
added a commit
that referenced
this issue
Jun 7, 2012
…the UI now successfully blocks updates under the user's foot while dragging things around the screen.
jefflunt
added a commit
that referenced
this issue
Jun 7, 2012
jefflunt
added a commit
that referenced
this issue
Jun 7, 2012
… manual order values, in order to correct data issues that were caused before the latest version of drag-and-drop support were added.
jefflunt
added a commit
that referenced
this issue
Jun 8, 2012
jefflunt
added a commit
that referenced
this issue
Jun 8, 2012
… refactored the slide in (and new slide out) animations into their own functions.
jefflunt
added a commit
that referenced
this issue
Jun 9, 2012
…Thought(from, to)` function, which takes the thought nearest the specified `from` index, and inserts it at the `to` index.
jefflunt
added a commit
that referenced
this issue
Jun 9, 2012
…or so. So long as you don't sort things too quickly, it works very reliably. - Further refactored javascript used to slide things in and out. - The new thought box uses the `slideThoughtIn`, so I made it accessible on the window object. - Verified that dynamic sliding works for moving objects both forward and backward in the list, from any position to any other position, including the very front and end of the list. - Rebuilt assets for deploy. - Re-worked the way that the thoughts are ordered in the `ThoughtWalls#show` action, so the reflected shifts in position get replayed in the same order in which they occured. This isn't perfect because if multiple people reorder things simultaneously, the order in which they get applied is ambiguous, and might not be correct for everyone. Long term I'll have to fix this via a periodic "refresh all positions" lookup that goes through the entire list, and moves things such that all clients are guaranteed to be in a consistent state. - Changed when the `safe-to-alter-layout` value is changed, so to address an issue the was causing updates on a client browser to permanently stall.
jefflunt
added a commit
that referenced
this issue
Jun 10, 2012
…rsion still does not have 100% correct syncing, but I believe the next version will, and I want to commit the code as-is.
jefflunt
added a commit
that referenced
this issue
Jun 10, 2012
…r, it only works well when moving an item up in the list. When moving an item down in the list, the code winds up moving all the intermediate elements instead of just the one that actually shifted.
jefflunt
added a commit
that referenced
this issue
Jun 10, 2012
jefflunt
added a commit
that referenced
this issue
Jun 10, 2012
jefflunt
added a commit
that referenced
this issue
Jun 10, 2012
…the list. This is to combat an issue whereby duplicates are mistakenly created when elements are dragged while the DOM is being manipulated.
jefflunt
added a commit
that referenced
this issue
Jun 10, 2012
jefflunt
added a commit
that referenced
this issue
Jun 10, 2012
jefflunt
added a commit
that referenced
this issue
Jun 11, 2012
…more efficient. So, in using cortex, something that I observed was that if you moved an item up in the order everything was fine; it would find that out of order item in the client first, and move it. However, when moving items DOWN in the order, instead of just moving that one item, it would instead move all the intermediate items to acheive consistency with the server, even though the net effect was the same. That meant, when moving items down in the list, you'd move lots more thought boxes a short dista nce in order to acheive consistency, instead of a few boxes a large distance. This was terribly inefficient for two reasons. First, every shift requires a server request, so the number of requests to the server was significantly higher than the most efficient move possible. Second, it was inefficient for the client because it meant more total moves (and more time the user spends watching the screen, waiting for it to become consistent). When thinking about how to solve this problem I originally thought that I would need to implement the diff algorithm to find the differences between client and server, and then perform the first move in the diff list with each server request. This seemed like a complex solution to what seemed like a pretty simple problem, so I punted on the solution and waited to see if I could come up with something better. It turns out that, instead of calculating the diff for the whole list, that you could instead take the client list and the server list, and calculate an array of integers that represent the distance between elements. So, if the client and server lists were identical, you'd have an array of zeroes - meaning that nothing was out of order on the client, when compared to the server ordering. However, in the case that you move something down in the visual ordering, say by seven spaces, you'd get an array of distances that contained seven 1s, and one 7. Once you have that array of distances, instead of trying to move all the items that are out of order, you simply move the one that is furthest out of order. To say it another way - instead of moving the seven items that were off by one, you could achieve the same result by moving the one item that was off by seven. The net effect is that, whenever the client can shift just one item in order to make many items consistent in their ordering with the server, it will prefer to move that one item by a larger amount one time, rather than move a lot of items a smaller amount over several server requests. So far this has proven to be both effective, and much less complicated a solution when compared to implementing a diff.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Kyle requested the ability to re-order items via drag-and-drop.
The text was updated successfully, but these errors were encountered: