Commit Graph

214 Commits

Author SHA1 Message Date
Andrew Nacin
a5d83b489b Fix JSHint errors in media-views.js.
props kadamwhite.
fixes #25974.

Built from https://develop.svn.wordpress.org/trunk@26161


git-svn-id: http://core.svn.wordpress.org/trunk@26072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-14 05:54:10 +00:00
Andrew Nacin
622709076b Media: Fix embedding of audio/video players when the file was just uploaded.
While uploading, we know an attachment's filename but not its mime type. Check specifically for extensions. Check for type as a convenience when it is available.

fixes #24449.



git-svn-id: http://core.svn.wordpress.org/trunk@24784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-23 17:29:55 +00:00
Andrew Nacin
2c67dea9bc Media: Add awareness to Attachment Display Settings that audio and video can be embedded.
Also:
 * Add file length metadata to Attachment Details.
 * Round the kb/s bitrate on post.php.

fixes #24449.



git-svn-id: http://core.svn.wordpress.org/trunk@24777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-23 05:39:08 +00:00
Daryl Koopersmith
452c0f4166 Add Backbone property to the wp-backbone namespace. See #24424.
git-svn-id: http://core.svn.wordpress.org/trunk@24367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-26 06:34:33 +00:00
Daryl Koopersmith
b8ce442044 Update the subview controller for the patterns found in Backbone 1.0.
Fixes #24424.


git-svn-id: http://core.svn.wordpress.org/trunk@24361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-25 21:38:12 +00:00
Daryl Koopersmith
56a6cac328 Extract the base views from media.
See #24424.


git-svn-id: http://core.svn.wordpress.org/trunk@24360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-25 21:03:04 +00:00
Mark Jaquith
262b3bd9b1 Don't allow images to be set as featured image until they have been processed.
props kadamwhite. fixes #23317.

git-svn-id: http://core.svn.wordpress.org/trunk@23956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-10 22:26:55 +00:00
Daryl Koopersmith
2798e396e3 Media: Reset modal after gallery insertion.
Removes hardcoded (and vestigial) 'upload' states in favor of using the default modal state.
When a media toolbar action is triggered, reset the modal after switching to the new state (as opposed to beforehand).

fixes #23675.


git-svn-id: http://core.svn.wordpress.org/trunk@23590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-03 07:36:21 +00:00
Daryl Koopersmith
00d88af87a Update Backbone to 0.9.10. Update media to handle breaking changes.
* When overriding `Backbone.sync()`, ensure the `sync` and `error` events fire consistently.

* `Model#make()` has been removed. Use `$` instead, and be sure to grab the DOM node where necessary (using `[0]`).

* `Collection#get()` now accepts `cid`s. `Collection#getByCid()` has been removed.

* When overriding the `State` constructor, bind `change` callbacks after the default `Model` constructor is called, because the `Model` constructor no longer passes the `silent` flag when calling `set()` for the default attributes.

* In 'change' events, `options.changes` was removed. It can now be accessed through `model.changed`. Check if any attributes have changed by calling `model.hasChanged()`. Also, don't mess with `model.changed`; it persists beyond the scope of a single event.

* `options.index` is no longer be set in the `add` event callback. Use `collection.indexOf(model)` can be used to retrieve the index of a model instead.

props gcorne. fixes #23262.


git-svn-id: http://core.svn.wordpress.org/trunk@23589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-03 07:04:06 +00:00
Andrew Nacin
9a7814c1a0 Don't unnecessarily re-render the attachment details view when editing the title and caption. Re-rendering causes issues with tabbing and focus, and is only necessary for other views (such as "Caption this image..." when editing a gallery).
props koopersmith.
fixes #23054.
for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@23283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 23:29:20 +00:00
Daryl Koopersmith
a84cef4556 Media: Properly reset the "add to gallery" library to ensure it accurately reflects the current gallery. see #22815.
git-svn-id: http://core.svn.wordpress.org/trunk@23263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 08:28:12 +00:00
Andrew Nacin
c95ff91fe7 Media: Restore 3.4 behavior by consulting the old-school DB options for default align, size, and link properties.
This restores linking to media files as the default, over attachment pages. This 'default' cannot currently be changed by a user setting (per 3.4 behavior), due to the default database schema.

see #22841, for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@23262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 08:02:16 +00:00
Daryl Koopersmith
da06cf3e2d Media: Do not update attachment display user settings when a single attachment is inserted.
This is consistent with 3.4 behavior.

see #22841.


git-svn-id: http://core.svn.wordpress.org/trunk@23261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 08:01:19 +00:00
Daryl Koopersmith
774df9900e Media: Check that a router region exists before attempting to access its child views. Add relevant documentation. see #22930.
git-svn-id: http://core.svn.wordpress.org/trunk@23260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 07:08:37 +00:00
Daryl Koopersmith
1132f798f7 Media: Automatically select uploading attachments in single-select workflows.
The code now automatically selects uploading attachments in all workflows. In a workflow that selects multiple attachments, all attachments added to the upload queue are selected. In a workflow that selects a single attachment (e.g. selecting a featured image), the last attachment added to the upload queue is selected.

see #22817.


git-svn-id: http://core.svn.wordpress.org/trunk@23259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 06:44:21 +00:00
Andrew Nacin
94b3fbc8dd Makes sure attachment sizes are correctly deselected in IE. Fixes size selections on insert in IE9. props koopersmith. fixes #22851.
git-svn-id: http://core.svn.wordpress.org/trunk@23163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-10 23:15:53 +00:00
Daryl Koopersmith
c08b897b89 Trailing commas make IE7 cry. fixes #22819.
git-svn-id: http://core.svn.wordpress.org/trunk@23124 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-07 20:42:10 +00:00
Ryan Boren
eaefa67006 When inserting from URL in the media modal, retain query params and properly insert the caption code.
Props koopersmith
fixes #22796


git-svn-id: http://core.svn.wordpress.org/trunk@23110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 23:12:59 +00:00
Andrew Nacin
2d9b708b6e Media: When the attachment details view changes to another view or attachment, save compat fields on destroy. (We already do this for non-compat fields.) props koopersmith. fixes #22776.
git-svn-id: http://core.svn.wordpress.org/trunk@23098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 06:56:06 +00:00
Mark Jaquith
1419b404a8 Add the ability to click "Edit" and kick out to the advanced image editor from within the Media modal. New window, with "Refresh" offered on your return. fixes #22743. props koopersmith, nacin, helenyhou.
git-svn-id: http://core.svn.wordpress.org/trunk@23095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 05:52:19 +00:00
Mark Jaquith
54a390bea9 New method of managing media selections. There is now a "master" selection in the background. props koopersmith. fixes #22725
* This especially helps when you switch between insert/gallery and have non-images selected (as galleries don't support non-images).
* The views now act as filters on the "master" selection, instead of having their own selections that get passed around.

git-svn-id: http://core.svn.wordpress.org/trunk@23089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 03:55:37 +00:00
Daryl Koopersmith
c75dc67668 Do not alter the body's overflow attribute when the media modal is opened. Fix image insertion in the visual editor in Firefox. props azaozz. fixes #22765.
git-svn-id: http://core.svn.wordpress.org/trunk@23085 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 03:15:39 +00:00
Andrew Nacin
173806d7a1 Restore the Description field to the media UI in 3.5.
We tried in vain -- a noble but ultimately failed effort -- to reduce the number of fields for attachments from four (title, caption, alt, description) to one (caption for images, title otherwise). Alternative text needed to stay for accessibility reasons, of course.

Eventually title returned due to heavy plugin reliance. Description is too used by too many plugins (often times incorrectly -- the caption is more likely the proper field), hence its less-than-triumphant return today.

Version 3.5 has tried to streamline media in a number of ways. Removing fields may have been too much at once, as it forced not only a user interface change, but a paradigm change as well.

Finally, on upload we populate the description field with IPTC/EXIF captions, rather than the caption field. See #22768, this should be fixed. For now, Description stays.

This commit also restores 'Title' attribute editing to the main tab of the Edit Image dialog. The "Title" field no longer populates title attributes for <img> tags by design (for accessibility and other purposes, see #18984). So, here is a more obvious 'workaround' for the tooltip community.

Finally, this:
 * Cleans up the post.php attachment editor, including by showing a prettier form of the mime type.
 * Enables plugins to specifically hide attachment_fields_to_edit from either post.php (where you can create meta boxes) or the modal (which you may not want to clutter), for compatibility reasons.
 * Hides the 'Describe this file...' placeholder when a field is read-only in the modal.

props nacin, helenyhou.
fixes #22759.



git-svn-id: http://core.svn.wordpress.org/trunk@23083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 00:41:06 +00:00
Andrew Nacin
88f61468b3 Media: Final names for the actions in the dialog sidebar: "Insert from URL" and "Set Featured Image" to go with "Insert Media" and "Create Gallery".
Longer strings (such as a translation) looks excellent when it wraps to another line.

props markjaquith, fixes #22753.



git-svn-id: http://core.svn.wordpress.org/trunk@23076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 19:07:48 +00:00
Andrew Nacin
c42ae7acb6 Media: Use '%d selected' for the selection string, and offer a comment to translators to help them find a workable solution with this would-be plural string. fixes #22749. see #22229.
git-svn-id: http://core.svn.wordpress.org/trunk@23075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 19:03:38 +00:00
Mark Jaquith
bc8ddb3e64 Intelligently make media fields readonly when the user cannot update or do anything with them. props koopersmith, helenyhou, nacin. fixes #22613
git-svn-id: http://core.svn.wordpress.org/trunk@23072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 10:29:24 +00:00
Mark Jaquith
4d35b3409b Implement tabbing between fields in the media modal. props lessbloat, koopersmith. fixes #22659
git-svn-id: http://core.svn.wordpress.org/trunk@23070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 09:57:58 +00:00
Mark Jaquith
d8d39ff764 When setting the featured image from the dedicated meta box, only show the featured image section in the media chooser. props koopersmith. fixes #22731
* Less distracting
* Some of these sections won't apply for CPTs without an editor

git-svn-id: http://core.svn.wordpress.org/trunk@23069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 09:43:10 +00:00
Mark Jaquith
e84a4a0c89 Fix the "Uploaded to this post" filter in the "Add to gallery" state. fixes #22723
Also, use "images" wording instead of generic "media items" when in a gallery (images-only) context. fixes #22722

Both are props koopersmith

git-svn-id: http://core.svn.wordpress.org/trunk@23068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 09:25:17 +00:00
Mark Jaquith
98fb6e45d7 Use data on the ui.item to transport the original Sortable index for the update() function. This way extensions can set/access this info in their own custom Sortable functions. see #22696
git-svn-id: http://core.svn.wordpress.org/trunk@23067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 09:04:19 +00:00
Ryan Boren
c4d04dd476 Clear the From URL view in the media modal after inserting an image. Improve button enable checks.
Props koopersmith
fixes #22740


git-svn-id: http://core.svn.wordpress.org/trunk@23065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 04:43:51 +00:00
Mark Jaquith
b6982a0804 Allow a sortable options hash to be passed in, so you can override the defaults. props koopersmith. see #22696
git-svn-id: http://core.svn.wordpress.org/trunk@23064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 04:11:49 +00:00
Andrew Nacin
e1405b6f1d Media: Don't try to resize the bottom selection UI. props koopersmith. fixes #22748.
git-svn-id: http://core.svn.wordpress.org/trunk@23056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 01:38:44 +00:00
Daryl Koopersmith
81d474cda0 Toggle display of plupload overlays when the select files button is hidden. see #22732.
git-svn-id: http://core.svn.wordpress.org/trunk@23053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 00:45:21 +00:00
Andrew Nacin
d720772ef3 Media: Return to the library when the editing a selection and all items get de-selected. props koopersmith. fixes #22715.
git-svn-id: http://core.svn.wordpress.org/trunk@23051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-05 00:22:11 +00:00
Ryan Boren
51db7de93b When inserting an image From URL, show the fields only if it looks like we have a valid image.
Props koopersmith
fixes #22740


git-svn-id: http://core.svn.wordpress.org/trunk@23048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 23:07:41 +00:00
Andrew Nacin
d47267224c When adding images to a gallery, use "Images" as the filter name, rather than "All media items". props koopersmith. fixes #22722.
git-svn-id: http://core.svn.wordpress.org/trunk@23041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 20:51:37 +00:00
Andrew Nacin
1c5c724b3a Media: Properly select the select element's option in the attachment display settings. props koopersmith. fixes #22693.
git-svn-id: http://core.svn.wordpress.org/trunk@23037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 19:38:16 +00:00
Ryan Boren
53f5c1cdc7 Better dropdown select handling.
Props cdog, koopersmith
fixes #22693


git-svn-id: http://core.svn.wordpress.org/trunk@23033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 18:50:49 +00:00
Ryan Boren
a200c702e0 Only show Delete in media modal if the user can delete.
Props nacin, koopersmith
fixes #22711


git-svn-id: http://core.svn.wordpress.org/trunk@23032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 18:33:51 +00:00
Ryan Boren
8603ed6082 Media: Hide "Edit" link in the selection view when it doesn't make sense
Props koopersmith, ocean90, nacin
fixes #22713


git-svn-id: http://core.svn.wordpress.org/trunk@23031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 18:23:47 +00:00
Mark Jaquith
bc09152660 Fix a Firefox "scroll to bottom" bug when launching the media modal.
* Records main document scroll position when launching media modal.
* Restores position when media modal is closed.
* Also locks background document scrolling while media modal is open, preventing inadvertent scrolling there.

props koopersmith. fixes #22716

git-svn-id: http://core.svn.wordpress.org/trunk@23029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 17:58:24 +00:00
Mark Jaquith
82d51aeeef Update toolbars for Embed screen. Fixes JS error. props koopersmith. fixes #22714
git-svn-id: http://core.svn.wordpress.org/trunk@23028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 17:45:24 +00:00
Andrew Nacin
d2a9957ad8 Media: Disable 'Insert gallery' and 'Set featured image' if nothing is queued. Converts selection toolbars to use the newer view manager. props koopersmith, fixes #22714.
git-svn-id: http://core.svn.wordpress.org/trunk@23024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 16:21:57 +00:00
Mark Jaquith
55ac7a4565 Fix a typo in media-views.js that referenced frame.router.get() instead of frame.router. Fixes #22710
git-svn-id: http://core.svn.wordpress.org/trunk@23015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 05:18:21 +00:00
Andrew Nacin
156c5fef0f Media: When an image does not have all image sizes available, make sure we insert the requested size into the editor. props koopersmith. fixes #22693.
git-svn-id: http://core.svn.wordpress.org/trunk@23008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 04:04:45 +00:00
Ryan Boren
61a9471024 Final round of media UX improvements.
Props koopersmith
fixes #21390 #22502


git-svn-id: http://core.svn.wordpress.org/trunk@23006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 01:26:03 +00:00
Ryan Boren
63662a9b7b In the QuickPress media modal, use the new post id when a post is published.
Props nacin, koopersmith
fixes #22673


git-svn-id: http://core.svn.wordpress.org/trunk@22994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 07:17:10 +00:00
Ryan Boren
0848a51955 When settting a featured image, move the currently selected image to the beginning of the library if it doesn't exist within the attachments loaded so far.
Props koopersmith
fixes #22494


git-svn-id: http://core.svn.wordpress.org/trunk@22993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 07:04:34 +00:00
Ryan Boren
c06ffe745f Show a spinner when attachment details are saved.
Props koopersmith
see #22613


git-svn-id: http://core.svn.wordpress.org/trunk@22991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 06:37:49 +00:00