Commit Graph

25 Commits

Author SHA1 Message Date
Daryl Koopersmith 15c451d2f6 Give media a heart transplant.
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: https://develop.svn.wordpress.org/trunk@22320 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-28 23:29:17 +00:00
Daryl Koopersmith 9e8cd23bdb Add attachment display settings to the media modal.
* Add a media view for button groups.
* Add button dropdown containers.
* Add a dropdown property to the button media model.

fixes #22206, #21814, see #21390, #21813, #21598.


git-svn-id: https://develop.svn.wordpress.org/trunk@22247 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-16 19:25:17 +00:00
Daryl Koopersmith a5fc058f89 Media Modal: Improve attachment remove button styles. see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22184 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-11 04:11:47 +00:00
Daryl Koopersmith 7dbf364156 Media Modal: Remove the outline from the modal's close button. props lessbloat, see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22180 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-11 02:54:19 +00:00
Daryl Koopersmith ce6ac7d7aa Media Modal: Increase delay of attachment zoom. see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22179 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-11 01:28:41 +00:00
Daryl Koopersmith 2f6ad44bfd Media Modal: Reduce height on the attachment captions from three lines to two. see #21390, #21807.
git-svn-id: https://develop.svn.wordpress.org/trunk@22178 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-11 00:55:38 +00:00
Daryl Koopersmith c32509dcf3 Media Modal: Remove unused CSS. see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22177 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-11 00:37:23 +00:00
Daryl Koopersmith b0d215a771 Media Modal: Show progress bars for uploading images, and adjust progress bar styles to compensate for the darker attachment background. see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22176 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-11 00:36:42 +00:00
Daryl Koopersmith d27568e703 Caption editing in the media modal library.
* 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: https://develop.svn.wordpress.org/trunk@22173 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-10 23:32:48 +00:00
Daryl Koopersmith 14de8ad04a Show filenames for non-image attachments in the new media modal.
Also passes all attachment model attributes to the attachment view template by default (instead of selecting specific values).

see #21390, #21836.


git-svn-id: https://develop.svn.wordpress.org/trunk@22159 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-10 09:55:47 +00:00
Daryl Koopersmith d4f1bc45ac Media JS: Improve markup and CSS of the modal view's title.
Also improves the accuracy of closing the modal when the backdrop is clicked (which became error-prone around the title bar in [22144]).

see #21390.


git-svn-id: https://develop.svn.wordpress.org/trunk@22158 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-10 09:40:22 +00:00
Daryl Koopersmith 58fb98ff26 Media modal search box style updates. props helenyhou, see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22145 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-09 03:14:18 +00:00
Daryl Koopersmith 561c3b7837 Improve media modal title bar styling. props helenyhou, see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22144 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-09 02:56:39 +00:00
Daryl Koopersmith adbb1b623a Increase the delay on the attachment zooming in the media modal. see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22142 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-09 01:57:34 +00:00
Daryl Koopersmith fe1645a0a9 Change the cursor to a pointer when hovering above an attachment in the media modal. see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22141 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-09 01:17:35 +00:00
Daryl Koopersmith 91a3c62b3f Better thumbnail previews in the image editor.
* 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: https://develop.svn.wordpress.org/trunk@22137 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-08 23:20:04 +00:00
Daryl Koopersmith 96cb206e15 On the gallery creation screen, only display the remove icon on hover.
git-svn-id: https://develop.svn.wordpress.org/trunk@22125 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-05 22:14:00 +00:00
Daryl Koopersmith 7354809132 Add quick insert buttons to attachment views in the library and remove buttons to attachment views in the gallery editor. see #21390, #21809.
git-svn-id: https://develop.svn.wordpress.org/trunk@22053 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-27 07:45:26 +00:00
Daryl Koopersmith 22b3981229 Media JS: Use a custom Attachment views for both the media library and gallery screens.
To do so, the Attachment view code had to be shifted above the Workspace view code to ensure the subview is defined (preventing errors).

Also corrects an error in `wp.media.view.Attachments.add` where it was still using the default Attachment view.

see #21390, #21809.


git-svn-id: https://develop.svn.wordpress.org/trunk@22046 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-27 06:53:54 +00:00
Daryl Koopersmith 7b999727ce Rename the attachment-thumbnail class in the media modal Attachment view to prevent conflicts with wp_get_attachment_image(). see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@21909 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-19 01:10:17 +00:00
Daryl Koopersmith 6a5a70ead3 Correct alignment of new buttons in media modal. see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@21907 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-19 00:48:41 +00:00
Daryl Koopersmith 4442437bd5 The first inklings of a gallery management screen.
* Adds `view.Workspace.Library` and `view.Workspace.Gallery` as extensions of `view.Workspace` to implement the individual screens
* Shifts the toolbar logic that was library-specific from the generic `Workspace` view to `Workspace.Library`.
* Adds a toolbar to the `Gallery` view.
* 'Create a gallery' and 'Return to media library' buttons toggle between the two views.
* 'Insert gallery into post' closes the modal, but does not actually perform its namesake action.
* Note that elements can still be deselected in the gallery view. This will be fixed in a future commit.

Improvements to avoid over-eager event unbinding:
* `Modal` views now properly detach their contents before replacing them with a new element.
* Likewise, `Workspace` views detach their main content blocks when re-rendering the view.

To test the gallery workflow (which is incomplete), run the following in your browser's console:

	`wp.media({ multiple: true });`

see #21809, #21390.


git-svn-id: https://develop.svn.wordpress.org/trunk@21906 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-19 00:34:00 +00:00
Daryl Koopersmith a7a925c744 Make browser text-selections ignore attachment views. see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@21786 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-07 22:15:52 +00:00
Daryl Koopersmith ec0ee0164c Adds UI for media modal toolbars, buttons, and the selected item(s) status.
Currently uses actions for inserting media into a post as an example (hence the raw text). To test a workflow that supports multiple selection, run the following in your browser's JavaScript console:

	wp.media({ multiple: true });

see #21390, #21808.



git-svn-id: https://develop.svn.wordpress.org/trunk@21769 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-06 07:46:15 +00:00
Daryl Koopersmith 5a4a17687a 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: https://develop.svn.wordpress.org/trunk@21683 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-31 04:54:23 +00:00