WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#2803 closed defect (bug) (fixed)

Manage -> Categories Ajax problems

Reported by: davidhouse Owned by: mdawaffe
Milestone: Priority: normal
Severity: normal Version: 2.1
Component: Administration Keywords: ajax admin category bg|has-patch bg|needs-testing
Focuses: Cc:

Description

I tried fixing this but gave up quickly. I think whoever wrote list-manipulation-js.php had a broken spacebar. :)

Anyway, there were two problems I could see:

  • Adding a category which has a parent doesn't add that category to the list beneath its parent, it just adds it at the bottom
  • Adding a category doesn't add it to the 'Category parent:' dropdown. In other words, you can't add a category, then add a second category which is a child of the first without refreshing the page.

Also, perhaps move the ajax-response dialog to above the form itself. I didn't realise it was there when using it! And it might be nice to say 'Successfully added, Jump ...' instead of just posting an anonymous link.

Attachments (2)

2803a.diff (7.6 KB) - added by mdawaffe 9 years ago.
2803b.diff (7.6 KB) - added by mdawaffe 9 years ago.
Simpler. Fixes typo.

Download all attachments as: .zip

Change History (8)

comment:1 @mdawaffe9 years ago

  • Milestone set to 2.2

The dropdown should be straightforward. That we can do for 2.1. See wp-admin/custom-fields.js for an example of listMan::addComplete (to abuse notation).

Currently, listMan can only add to the top or the bottom. Arbitrary insertion is doable: add a new XML tag in the response that specifies the insert position. That said, I'd leave this for 2.2. Perhaps in the interim, we can have the new category row show

parent_name - new_cat_name

instead of just

- new_cat_name

Thoughts?

comment:2 @mdawaffe9 years ago

  • Milestone 2.2 deleted

Huh. I do not remember hitting the milestone. Clearly I have a bad memory.

@mdawaffe9 years ago

comment:3 @mdawaffe9 years ago

  • Keywords ajax admin category bg|has-patch bg|needs-testing added
  • Owner changed from anonymous to mdawaffe
  • Status changed from new to assigned

First pass: 2803a.diff

  1. Splits cat_rows() into cat_rows() and _cat_row() to eliminate code duplication.
  2. In wp_insert_category(), make sure parent category exists.
  3. When AJAX adding category, display name as "parent - cat" instead of "- cat" (the quick fix mentioned above to this larger problem).
  4. When AJAX adding, add to dropdown.
  5. When AJAX deleting, remove from dropdown.

comment:4 @mdawaffe9 years ago

Works in Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4

Please test in other browsers.

@mdawaffe9 years ago

Simpler. Fixes typo.

comment:5 @mdawaffe9 years ago

2308b.diff

  1. Simplifies.
  2. Removes typo.

comment:6 @ryan9 years ago

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

(In [4041]) Category Ajax improvements from mdawaffe. fixes #2803

Note: See TracTickets for help on using tickets.