[wp-trac] [WordPress Trac] #22938: Presentation of hierarchical taxonomy in Media modal should be checkboxes rather than comma-separated tag list

WordPress Trac noreply at wordpress.org
Mon Oct 27 03:16:53 UTC 2014


#22938: Presentation of hierarchical taxonomy in Media modal should be checkboxes
rather than comma-separated tag list
-------------------------------------------------+-------------------------
 Reporter:  yeswework                            |       Owner:
     Type:  enhancement                          |  wonderboymusic
 Priority:  normal                               |      Status:  assigned
Component:  Media                                |   Milestone:  4.1
 Severity:  normal                               |     Version:  3.5
 Keywords:  has-patch dev-feedback needs-        |  Resolution:
  testing                                        |     Focuses:  ui,
                                                 |  javascript
-------------------------------------------------+-------------------------
Changes (by jessepollak):

 * keywords:  needs-patch => has-patch dev-feedback needs-testing


Comment:

 I'm attaching a patch & screenshot of an MVP of the fix for this. Right
 now, it displays the categories for a media item as a list of checkboxes
 and saves them. I have a few questions and TODOs:

 1. I use `wp_terms_checklist()` which in turn relies on
 `Walker_Category_Checklist` which is relatively inflexible. Primarily, it
 can only output inputs of the form `name=post_category[]` or
 `tax_input[$taxonomy]`. That's a different form than what's used to saved
 `AttachmentCompat`'s in Backbone, so I have to `str_replace` to get it in
 the correct form. I know this is horrible, but I'm not sure what the best
 way to proceed is — should I rewrite `Walker_Category_Checklist`, so it
 can be more modular?

 2. `wp_terms_checklist()` outputs to the buffer, so I use `ob_start()` etc
 to get the content which is passed via AJAX. Is this acceptable or — again
 — should I refactor to make it possible to get it as a string rather than
 output?

 3. In the `media.view.AttachmentCompat` class, I add an if statement in
 the `save` method that handles the case where the input is a series of
 checkboxes (before this, they were always a single input of `type=text` or
 `type=hidden`). Is this acceptable or should I subclass
 `media.view.AttachmentCompat` specifically for ones that are taxonomies of
 some sort.

 4. I've only been testing this in the Attachment Edit & Create pages and
 with the `category` taxonomy. Can anyone think of other objects and/or
 taxonomies I should be testing on?

 5. I have done zero styling of the check box. Right now, on my checklist
 is: restrict height of container and add `overflow: scroll` and indent
 child categories. Any other thoughts?

 Appreciate any and all feedback :)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/22938#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list