Commit Graph

60 Commits

Author SHA1 Message Date
Daryl Koopersmith
9e51aebdd7 Media JS: Add support for filtering Attachment collections by mime type. see #21390, #21776, #21809.
git-svn-id: http://core.svn.wordpress.org/trunk@22021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-26 20:50:13 +00:00
Daryl Koopersmith
669b4b3a6d Media JS: Use correct reference to search term in the Attachments model search filter. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-26 15:13:22 +00:00
Daryl Koopersmith
67708a3d8b First pass on TinyMCE attachment in-editor UI.
* Adds in-editor UI for image attachments. Most of this UI should be able to migrate to all images in a future commit.
* Removes the wpeditimage TinyMCE plugin from the default plugins array.
* Add `wp.media.fit`, a helper method to constrain dimensions based upon a maximum width and/or height.
* Add html attribute parsing and string generation utilities (currently stored in mce-views).
* Calling `remove` on a TinyMCE views now ensures that the the parent and references are removed as well.
* Fixes a bug where we weren't sending the full array of results to matches in wp.mce.view.

see #21390, #21812, #21813.



git-svn-id: http://core.svn.wordpress.org/trunk@22012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-26 14:12:54 +00:00
Daryl Koopersmith
f7ae81b15d Rename the attachment-thumbnail class in the media modal Attachment view to prevent conflicts with wp_get_attachment_image(). see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@21909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-19 01:10:17 +00:00
Daryl Koopersmith
751ecf9fd5 Ensure the Attachments model properties are correctly set for Query collections.
After shifting sorting and searching logic from the `Query` collection in [21898], it became apparent that `Query` collections should also have an accurate `props` model, as the model controls the aforementioned searching and sorting.

see #21921, #21809, and #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@21900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-18 22:19:05 +00:00
Daryl Koopersmith
380dfbbeab Allow JS Attachments models to be searchable and sortable.
Moves `wp.media.model.Query` sorting and searching to the parent `wp.media.model.Attachments`.

Query parameters are stored in `attachments.props`, which is a `Backbone.Model`, and supports `order` (`'ASC'` or `'DESC'`), `orderby` (any `Attachment` model property name), `search` (a search term), and `query` (a boolean value that ties the `Attachments` collection to the server).

`wp.media.query( args )` now returns an `Attachments` set that is mapped to a `Query` collection instead of the `Query` collection itself. This allows you to change the query arguments by updating `attachments.props` instead of fetching the mirrored arguments, changing them, and passing them to `wp.media.query()` again.

fixes #21921, see #21390, #21809.


git-svn-id: http://core.svn.wordpress.org/trunk@21898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-18 21:42:29 +00:00
Daryl Koopersmith
b514f391cd Media JS: Add support for multiple views to the media workflow controller. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@21820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 21:13:07 +00:00
Daryl Koopersmith
b9bbe5bb99 Add wp.media(), a function to create a default media workflow.
This will be the main entry point for basic media development, and should hopefully help less experienced developers wrangle the new media APIs.

If you would like to see the new UI, navigate to the post editor and run the following in your browser's Javascript console:

	wp.media();

Well, that certainly feels a lot nicer to type.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@21692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-31 20:44:02 +00:00
Daryl Koopersmith
e2be7ec824 Media JS: Attachments collection API improvements.
Rename watch() and unwatch() to observe() and unobserve(), respectively, to avoid conflicts with Firefox's proprietary Object.prototype.watch method.

Rename validate() to validator(), and changed() to validate(), as the latter will be more frequently used, and better explains its purpose. Also, make the new validate() more concise.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@21689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-31 18:38:32 +00:00
Daryl Koopersmith
c217397faa Add new media workflow scripts, styles, and templates.
Please note that this commit does not integrate media into the existing UI. If you would like to see the new UI, navigate to the post editor and run the following in your browser's Javascript console:

	new wp.media.controller.Workflow().render().modal.open();


The Javascript is broken up into two files, with the slugs media-models and media-views.

* media-models: The models are UI agnostic, and can be used independent of the views. If you'd like to create custom UIs, this is the script for you.

* media-views: This is the Media Experience. The views (and controllers) depend on the models (which are listed as a dependency and will automatically be included thanks to wp_enqueue_script). The views also require the media templates, media-view styles, and the plupload bridge settings. Perhaps we should create a function to include the whole shebang, but in the meantime...

To include media-views in the admin, run the following PHP in or after 'admin_enqueue_scripts':

	wp_enqueue_script( 'media-views' );
	wp_enqueue_style( 'media-views' );
	wp_plupload_default_settings();
	add_action( 'admin_footer', 'wp_print_media_templates' );

see #21390.



git-svn-id: http://core.svn.wordpress.org/trunk@21683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-31 04:54:23 +00:00