WordPress.org

Plugin Directory

Opened 2 years ago

Closed 2 years ago

#1438 closed enhancement (fixed)

Co-Authors Plus: Drag and drop ordering for authors

Reported by: danielbachhuber Owned by: danielbachhuber
Priority: normal Severity: normal
Plugin: not-listed 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)

admin.js.diff (489 bytes) - added by kingkool68 2 years ago.
Fix to make Co-Author list sortable so an editor can define the order the authors should be displayed.
co-author-plus.php.diff (4.0 KB) - added by kingkool68 2 years ago.
Added a filter on the wp_get_object_terms hook to return authors in ther term_order not alphabetical.
sortable-coauthor-fixes.patch (1.1 KB) - added by kingkool68 2 years ago.
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

Download all attachments as: .zip

Change History (13)

comment:1 danielbachhuber2 years ago

  • Summary changed from Co-Author Plus: Drag and drop ordering for authors to Co-Authors Plus: Drag and drop ordering for authors

kingkool682 years ago

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

comment:2 kingkool682 years ago

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.

kingkool682 years ago

Added a filter on the wp_get_object_terms hook to return authors in ther term_order not alphabetical.

comment:3 danielbachhuber2 years ago

  • Owner set to danielbachhuber
  • Status changed from new to assigned

comment:4 danielbachhuber2 years ago

In [479380]:

Co-Authors Plus: First pass at sortable co-authors. props kingkool68

See #1438

comment:5 danielbachhuber2 years ago

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 danielbachhuber2 years ago

In [479385]:

Co-Authors Plus: String change to reflect changing order

See #1438

kingkool682 years ago

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 kingkool682 years ago

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 kingkool682 years ago

Oh yea I'm really digging the new functionality. It s a lot easier to use now. Good stuff.

comment:9 danielbachhuber2 years ago

In [479640]:

Co-Authors Plus: When bulk editing, don't allow WordPress to blow away the order of the author terms. props kingkool68

See #1438

comment:10 danielbachhuber2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In [479645]:

Co-Authors Plus: 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. props kingkool68

Closes #1438

Note: See TracTickets for help on using tickets.