* 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
Treat an admin-ajax response of 1 as successful for backwards compatibility with existing handlers.
props koopersmith. fixes#22750.
git-svn-id: http://core.svn.wordpress.org/trunk@23057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Most users don't realize that the Featured Image meta box exists; if they do, few use it.
Restores the old meta box UI, including the admin_post_thumbnail_html filter. If a plugin is using _wp_post_thumbnail_html() in conjunction with Thickbox elsewhere, it will also magically still work.
Specific underlying changes:
* 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.
props koopersmith.
fixes#21776.
git-svn-id: http://core.svn.wordpress.org/trunk@22979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This functionality is designed to be backwards compatible with manual querying for attachments by menu_order.
props koopersmith.
see #22607.
git-svn-id: http://core.svn.wordpress.org/trunk@22967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add an Attachments collection filter for uploadedTo (post_parent).
* Correct an erroneous map from the non-existent parent prop to post_parent.
* Define default menuOrder and uploadedTo props for uploading attachments.
* Unify filterable props into a single method (improving validation performance for calls to set with multiple properties).
Props koopersmith
fixes#22654
git-svn-id: http://core.svn.wordpress.org/trunk@22951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When attachments are sorted, we convert the shortcode to [gallery ids=""], as before.
props koopersmith.
fixes#22608.
git-svn-id: http://core.svn.wordpress.org/trunk@22882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Turn off multi selection uploads for mobile devices. Currently Plupload cannot upload multiple files in iOS Safari. Only the first file makes it to the queue.
Empty wp on unload to work around caching in iOS Safari.
Props azaozz, miqrogroove, nacin
fixes#22552
git-svn-id: http://core.svn.wordpress.org/trunk@22872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Make the composite gallery library use `mirror` instead of `observe`, as one method now invokes the other. Also, make `mirror` return the attachment collection for chaining.
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Moves the reference to the source collection out of the props model. If it was translated over to a query (which was potentially possible) which then fired an ajax request, jQuery would attempt to serialize an object recursively, which caused an infinite loop and much sadness for my browser.
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Merge `Composite` model with general `Attachments` model, as `Attachments.validate` and `Composite.evaluate` were functionally equivalent.
* Queries should only watch `wp.Uploader.queue`, as watching `Attachments.all` results in queries attempting to add attachments before their properties are set (which then results a few too many irrelevant adds/removes). `Attachments.all` should potentially be removed or rethought.
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Adds `createIframeStates()` to the `MediaFrame` view. It creates states and bindings for the `media_upload_tabs` output, and is included on `MediaFrame.Post` by default.
* Hijacks `tb_remove()` when the media modal is open to ensure the modal closes correctly.
* Adds a `chromeless` parameter to thickbox media tab URLs to render the UI without the old row of tabs.
see #22186, #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`wp.media` now recognizes the `frame` attribute (currently a string; either'select' or 'post') and defaults to using a basic select frame. It also checks for the existence of classes in a safer fashion, as it does not assume the `MediaFrame` property exists.
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`media.view.MediaFrame.Select` is a frame class with a handful of sensible defaults to handle selecting and uploading items in the media library.
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`wp.media.model.Query.more()`
* If a request has already been sent out for more attachments, return that request object instead of creating another.
`wp.media.controller.Region`
* A region allows views to be swapped in and out of a section of the page without either view having to know about the other.
* Application components can use the same callbacks and resources by leveraging `Region.mode()`, which triggers a set of callbacks to create or transform the current view, but only if necessary.
`wp.media.view.Frame`
* Leverage `Region` controllers instead of forcing states to swap view objects, which causes states to fit more comfortably in the controller-camp.
* Add `previous()`, a method to fetch the previous state `id`.
* Separate out the default settings over several objects (so blank frames can be instantiated).
`wp.media.view.MediaFrame`
* The base `Frame` used for media management: handles integration with the `Modal` and `UploaderWindow` views.
`wp.media.view.MediaFrame.Post`
* Includes all default media states and callbacks necessary for inserting media into a post.
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Underscore's default ERB-style templates are incompatible with PHP when asp_tags is enabled. As a result, we've settled on an alternative syntax that should be familiar to devs: Mustache-inspired for interpolating and escaping content, and ERB-inspired for execution.
`{{{a}}}` - interpolating
`{{ a }}` - escaping
`<# a #>` - execution
props rmccue. fixes#22344, see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Adds `wp.media.model.Selection.single()` to specify a single item used in a multi-item selection.
* Fixes a bug where the `details` class would not be removed when "Clear Selection" was clicked.
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Also moves most of the `Frame` view's `createSelection` method to a real `Selection` model (which inherits from the `Attachments` model).
* Properly assigns the library within the `Gallery` state, allowing for the `Gallery` state to inherit from the `Library` state.
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Revises the concept of the media controller and workspace views (i.e. two central points of control) to be more granular. The main media object is now the `Frame`, which is a hybrid view and state machine.
The state machine is a collection of states, which are just generic instances of `Backbone.Model`. This circumvents the problem of juggling global parameters when changing states. Each state contains its own event loop. All events are also forwarded to the frame itself (as is the case in all model/collection relationships).
The frame view contains several regions, each of which can be overridden without harming or re-rendering the other regions. These work well when used in conjunction with the state machine events.
This removes the upload sidebar (don't worry, visible upload UI will return). Drag and drop uploading still works. The ability to upload has been abstracted into its own view (instead of being attached to the central workspace view).
Editing galleries is temporarily broken — the gallery creation and editing experiences will be unified in a future patch.
Adds events to detect dragging changes in `wp.Uploader` and adds methods to detect and leverage browser support for CSS3 transitions.
see #21390, #21809.
git-svn-id: http://core.svn.wordpress.org/trunk@22320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Adds a `describe` option to the workflow controller to support inline caption editing.
* For images, descriptions are mapped to the `caption` attribute.
* For other media items, descriptions are mapped to the `title` attribute.
* Descriptions are saved when the textarea's `change` event fires (i.e. when the textarea is blurred).
fixes#21807, see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Images are auto-cropped, then fit to the preview on hover (with a slight delay). This is an experiment; we'll see how it turns out.
* Various style changes.
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22137 1a063a9b-81f0-0310-95a4-ce76da25c4cd