Opened 17 months ago
Closed 17 months ago
#1438 closed enhancement (fixed)
Co-Authors Plus: Drag and drop ordering for authors
| Reported by: | danielbachhuber | Owned by: | danielbachhuber |
|---|---|---|---|
| Priority: | normal | Component: | not-listed |
| Severity: | normal | Keywords: | co-authors-plus |
| Cc: | danielbachhuber |
Description
Per a request in the forums, it would be nice if you could drag and drop order the authors
Attachments (3)
Change History (13)
comment:1 Changed 17 months ago by danielbachhuber
- Summary changed from Co-Author Plus: Drag and drop ordering for authors to Co-Authors Plus: Drag and drop ordering for authors
Changed 17 months ago by kingkool68
comment:2 Changed 17 months ago by kingkool68
Ignore co-author-plus.php.diff. It does nothing. I thought I had a simple fix, but I was wrong.
It is simple to tell when a "save_post" action is being called from the Bulk Edit screen: the variable $_REQUESTbulk_edit? will be true. I tried playing around with this in the coauthors_update_post() method but I got nowhere. After a little more digging it looks like the term order is being reset in the bulk_edit_posts() function defined in /wp-admin/includes/post.php
I think what I need to do is add a filter to wp_get_object_terms and check to see if it's a a bulk_edit save and if we are dealing with the 'author' taxonomy.
I have another patch ready. I'll make a diff and attach it here tomorrow morning.
Changed 17 months ago by kingkool68
Added a filter on the wp_get_object_terms hook to return authors in ther term_order not alphabetical.
comment:3 Changed 17 months ago by danielbachhuber
- Owner set to danielbachhuber
- Status changed from new to assigned
comment:4 Changed 17 months ago by danielbachhuber
In [479380]:
comment:5 Changed 17 months ago by danielbachhuber
Thanks kingkool68, awesome patch. I've applied admin.js.diff and it's a great start. There are a few more minor improvements it would be awesome to have before we close this ticket:
- When dragging a co-author, the cursor should change to 'move' or similar
- You should only be able to drag the co-author name or avatar... not the delete button
- It shouldn't be possible to drag a co-author below the input box for adding a new co-author
Please remember to 'svn up' on trunk before creating patches too :) I'll take a look at your second one next.
comment:6 Changed 17 months ago by danielbachhuber
In [479385]:
Changed 17 months ago by kingkool68
The dragging handle is now set to .coauthor-tag, cursor changes to 'grabbing' when dragging, prevented last coauthor-row item (the auto suggest field) from being sortable
comment:7 Changed 17 months ago by kingkool68
When a co-author is dragged, the cursor changes to 'grabbing' which isn't supported by some browsers. I might need to fall back to loading a custom cursor like so http://uihacker.blogspot.com/2011/01/css-grab-hand-cursor.html
the .coauthor-tag element now acts as the handle for grabbing on to. You can't grab on to the delete button to sort.
I've also restricted the last .coauthor-row from being sortable. This of course assumes the last row will always be the auto complete input field.
Added a drop zone (or as jQuery UI calls it, a placeholder) to visually identify where the object will be dropped. It can be styled with the .ui-state-highlight class. I pulled the blue border color from the border-bottom style on .coauthor-tag
comment:8 Changed 17 months ago by kingkool68
Oh yea I'm really digging the new functionality. It s a lot easier to use now. Good stuff.
comment:9 Changed 17 months ago by danielbachhuber
In [479640]:
comment:10 Changed 17 months ago by danielbachhuber
- Resolution set to fixed
- Status changed from assigned to closed
In [479645]:

Fix to make Co-Author list sortable so an editor can define the order the authors should be displayed.