#21776 closed task (blessed) (fixed)
Integrate featured images with new media workflow
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.5 |
| Component: | Media | Version: | 3.5 |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: | scribu, xoodrew@…, brady@… |
Description
Fairly self-explanatory. I'd like featured images to be one of the first workflows integrated, as it is one of the simplest.
Attached is a patch that mirrors the current workflow (but does not remove/alter the code). It is certainly not perfect; I'd like to build up some methods to make a few of these tasks simpler. Moving forward, I also plan on adding a dropzone directly to the featured image metabox. This may turn out to be a common pattern (as we use a similar UI in the customizer), in which case we should consider abstracting it.
Attachments (10)
Change History (58)
koopersmith
— 10 months ago
comment:3
nacin
— 10 months ago
I think a different Ajax endpoint is preferred due to the change in return values, but we'll probably want to keep the existing meta box, and simply replace the contents of post_thumbnail_meta_box(). This is mainly to keep consistency with a plugin that might replace or remove that box.
We might want to just do a ?return=json and keep the same endpoint.
koopersmith
— 10 months ago
comment:4
koopersmith
— 10 months ago
21776.2.diff replaces the AJAX endpoint with code in edit_post(), as the thumbnail should update when the publish/update button is clicked (rather than instantly). It does not, however merge the meta box functions.
comment:5
nacin
— 10 months ago
Marked #17100 and #12922 as duplicates, as 21776.2.diff would no longer save the thumbnail instantly, instead requiring a save.
comment:6
koopersmith
— 10 months ago
Marked #14762 as a duplicate, as 21776.2.diff eliminates the ambiguity between choosing a featured image and inserting an image into a post.
comment:7
koopersmith
— 10 months ago
In [21770]:
comment:3
koopersmith
— 10 months ago
In [21771]:
SergeyBiryukov
— 10 months ago
comment:4
SergeyBiryukov
— 10 months ago
Non-images should be filtered out when selecting a featured image: 21776.non-image.png.
comment:5
dosboy
— 9 months ago
When adding a featured image with the current codebase, the lightbox appears, throws a JS error, then fails to let me do anything.
Uncaught ReferenceError: type is not defined (anonymous function) b.template.c load-scripts.php:423 _.extend.template load-scripts.php:466 e.view.Attachment.Backbone.View.extend.render load-scripts.php:468 e.view.Attachments.Backbone.View.extend.add load-scripts.php:468 e.view.Attachments.Backbone.View.extend.initialize.list load-scripts.php:468 g.Events.trigger load-scripts.php:435 f.extend._onModelEvent load-scripts.php:450 g.Events.trigger load-scripts.php:435 f.extend.add load-scripts.php:445 media.model.Attachments.Backbone.Collection.extend._mirrorAdd load-scripts.php:466 g.Events.trigger load-scripts.php:435 f.extend._onModelEvent load-scripts.php:450 g.Events.trigger load-scripts.php:435 f.extend.add load-scripts.php:445 f.extend.fetch.a.success load-scripts.php:449 p.Callbacks.k load-scripts.php:2 p.Callbacks.l.fireWith load-scripts.php:2 _.extend.ajax load-scripts.php:466 p.Callbacks.k load-scripts.php:2 p.Callbacks.l.fireWith load-scripts.php:2 y load-scripts.php:2 p.support.ajax.p.ajaxTransport.send.d load-scripts.php:2
comment:6
dosboy
— 9 months ago
Ignore previous error report. It seems to be resolved as of this morning.
comment:7
koopersmith
— 9 months ago
In [22021]:
comment:18
koopersmith
— 9 months ago
In [22022]:
comment:19
koopersmith
— 9 months ago
In [22044]:
comment:20
follow-up:
↓ 24
ocean90
— 9 months ago
comment:21
ocean90
— 9 months ago
Featured images are attached to the post in 3.4, in trunk this behavior is gone.
comment:22
scribu
— 9 months ago
If I understood it correctly, we are de-emphasising the post_parent field for attachments, in the sense that it now only keeps a record of which post you were on when you originally uploaded the image.
comment:23
nacin
— 9 months ago
If the featured image is uploaded against that post, then it will be attached to the post. Otherwise, it won't be. Pretty sure that's the same behavior in 3.4 too.
comment:24
in reply to:
↑ 20
TomAuger
— 8 months ago
Replying to ocean90:
See http://wordpress.org/support/topic/post-feature-image-bug-in-wordpress-35-beta-1
I can confirm this behaviour. It should be noted that selecting an _already uploaded_ image WILL correctly update the featured image.
comment:25
koopersmith
— 8 months ago
In [22175]:
comment:26
follow-up:
↓ 31
DrewAPicture
— 8 months ago
- Cc xoodrew@… added
Does this ticket cover actually setting the Featured image from the modal after upload? After a post in the alpha/beta forum I realized this isn't currently possible.
comment:27
koopersmith
— 8 months ago
In 22321:
comment:28
follow-up:
↓ 30
georgestephanis
— 7 months ago
Current status in trunk looks like a minor regression from a couple days ago. A couple days ago (Monday?), when clicking "Choose a Featured Image" the button was initially labeled appropriately as "Set As Featured Image" -- however in current trunk, that button is no longer available -- it starts out as "Set as Featured Image".
Also -- as of Monday's trunk, when changing from "Upload Files" to "Media Library" and back, the button changed verbiage to "Insert into Post" -- rather than "Set as Featured Image".
comment:29
koopersmith
— 7 months ago
- Resolution set to fixed
- Status changed from new to closed
In 22496:
comment:30
in reply to:
↑ 28
koopersmith
— 7 months ago
Replying to georgestephanis:
Current status in trunk looks like a minor regression from a couple days ago. A couple days ago (Monday?), when clicking "Choose a Featured Image" the button was initially labeled appropriately as "Set As Featured Image" -- however in current trunk, that button is no longer available -- it starts out as "Set as Featured Image".
Also -- as of Monday's trunk, when changing from "Upload Files" to "Media Library" and back, the button changed verbiage to "Insert into Post" -- rather than "Set as Featured Image".
Yep, featured images got a little out of sync as we shifted around the pieces. Should be all set now.
comment:31
in reply to:
↑ 26
koopersmith
— 7 months ago
Replying to DrewAPicture:
Does this ticket cover actually setting the Featured image from the modal after upload? After a post in the alpha/beta forum I realized this isn't currently possible.
It did, in a way — the original plan for 3.5 was to omit this feature entirely. I think 3.5 has evolved to the point where a "Featured Image" tab might feel at home the "Add Media" modal (as opposed to feeling jammed in, as it previously did). That said, this is something that will have to wait until 3.6 (and should move to a new ticket).
comment:32
koopersmith
— 7 months ago
In 22500:
comment:33
koopersmith
— 7 months ago
In 22561:
comment:34
nacin
— 7 months ago
- Resolution fixed deleted
- Status changed from closed to reopened
I think 3.5 has evolved to the point where a "Featured Image" tab might feel at home the "Add Media" modal (as opposed to feeling jammed in, as it previously did).
After quite a bit of feedback from the WordPress.com support forums, it seems the lack of a button here has put a severe cramp in many people's workflows. We should aim to work something in.
comment:35
nacin
— 7 months ago
If there is anything we can do in the process to greatly simplify the JS in the post thumbnail meta box, that would be good, because plugins are inevitably going to copy it. Right now it has no semblance of being an API, unfortunately.
Related: #22636, restoring an old filter. Might be worth re-tying the rendering back into an ajax request like send-attachment-to-editor.
comment:36
ryan
— 7 months ago
Based on wordpress.com feedback, it seems that almost no one notices the "Featured Image" metabox.
comment:37
bradyvercher
— 7 months ago
- Cc brady@… added
koopersmith
— 7 months ago
comment:38
koopersmith
— 7 months ago
attachment:21776.6.diff enables the old featured images meta box, but rigs it up to a new featured image panel in the media modal.
It also:
- Converts the modal view to use the view manager, which means that a call to open() will automatically call render and attach if necessary.
- Doesn't automatically set a state in wp.media, to allow code to customize the states to be added before activation.
comment:39
koopersmith
— 7 months ago
- Keywords has-patch needs-testing added
comment:40
follow-up:
↓ 42
DrewAPicture
— 7 months ago
Testing 21776.6.diff:
Initially setting the featured image via both the main and featured image modals works as expected. Beyond that, there are a couple of problems.
- If you click the 'Remove Featured Image' link via the metabox, the image disappears (as expected) but that leaves the Featured Image metabox empty, e.g. the 'Set Featured image' link isn't restored.
- Once you've set the Featured image, clicking Add Media opens into the >Featured Image tab instead of >Upload Images
- If the featured image is already set, you can't always change it. Sometimes the image gets replaced with the new one in the metabox, sometimes the image disappears and the 'set' link is restored, sometimes nothing happens at all.
comment:41
koopersmith
— 7 months ago
Note that this will also fix #22636.
comment:42
in reply to:
↑ 40
;
follow-up:
↓ 43
koopersmith
— 7 months ago
Thanks, DrewAPicture, this is all very helpful.
Replying to DrewAPicture:
- If the featured image is already set, you can't always change it. Sometimes the image gets replaced with the new one in the metabox, sometimes the image disappears and the 'set' link is restored, sometimes nothing happens at all.
Can you elaborate on this point? Any JS errors? Can you isolate any actions that cause the featured image to always update successfully or always break?
comment:43
in reply to:
↑ 42
DrewAPicture
— 7 months ago
Replying to koopersmith:
Replying to DrewAPicture:
- If the featured image is already set, you can't always change it. Sometimes the image gets replaced with the new one in the metabox, sometimes the image disappears and the 'set' link is restored, sometimes nothing happens at all.
Can you elaborate on this point? Any JS errors? Can you isolate any actions that cause the featured image to always update successfully or always break?
Per my revelation in IRC, seems like replacing the featured image via Add Media works as expected, replacing via clicking the already-set featured image in the metabox doesn't work.
I also noticed that if I click the "Remove featured image" link and attempt to set a new one via Add Media, it doesn't load anything in the metabox, but that may be related to the first bullet point in comment:40.
koopersmith
— 7 months ago
comment:44
follow-up:
↓ 46
koopersmith
— 7 months ago
This patch should fix all 3 issues.
comment:45
nacin
— 7 months ago
#22636 was marked as a duplicate.
comment:46
in reply to:
↑ 44
DrewAPicture
— 7 months ago
Replying to koopersmith:
This patch should fix all 3 issues.
21776.7-refresh.diff fixes all three for me.
comment:47
koopersmith
— 7 months ago
Thanks for the refresh. Looks good.
comment:48
DrewAPicture
— 7 months ago
Noticed two issues testing 21776.7-refresh with QuickPress:
- Clicking Add Media, the 'Select Files' button is missing, a la http://cl.ly/image/3t1P461P3s1s . Switching tabs and back again shows the button.
- Once you've selected a featured image and clicked the 'Set Featured image' button, you're sent to wp-admin/index.php# which jumps you to the bottom of the page forcing you to scroll back up.
comment:49
nacin
— 7 months ago
- Resolution set to fixed
- Status changed from reopened to closed
In 22979:
koopersmith
— 7 months ago
comment:50
koopersmith
— 7 months ago
Patch updates gallery editing to work with the modal changes. Also adds nice handling for default states.
comment:51
nacin
— 7 months ago
21776.galleries.diff looks good.
comment:52
ryan
— 7 months ago
In 22984:
comment:53
nacin
— 7 months ago
In 23058:
Related: #14762