diff --git a/src/wp-admin/js/media.js b/src/wp-admin/js/media.js index e767b093c6..119c10bd2a 100644 --- a/src/wp-admin/js/media.js +++ b/src/wp-admin/js/media.js @@ -75,7 +75,7 @@ var findPosts; // Open up a manage media frame into the grid. wp.media && wp.media({ frame: 'manage', - container: $('#wpbody-content') + container: $('#wpbody-content > .wrap') }).open(); $( '#find-posts-submit' ).click( function( event ) { diff --git a/src/wp-admin/upload.php b/src/wp-admin/upload.php index b559309145..e2a314a4f1 100644 --- a/src/wp-admin/upload.php +++ b/src/wp-admin/upload.php @@ -24,7 +24,9 @@ if ( 'grid' === $mode ) { wp_enqueue_media(); wp_enqueue_script( 'media-grid' ); wp_enqueue_script( 'media' ); - wp_localize_script( 'media-grid', 'mediaGridSettings', array( 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ) ) ); + wp_localize_script( 'media-grid', '_wpMediaGridSettings', array( + 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ), + ) ); add_screen_option( 'misc_screen_options', array( 'option' => 'manageuploadgridcolumnshidden', 'id' => 'grid' ) ); add_screen_option( 'title', array( 'label' => __( 'Name' ) ) ); @@ -32,7 +34,35 @@ if ( 'grid' === $mode ) { add_screen_option( 'dateFormatted', array( 'label' => __( 'Date' ) ) ); add_screen_option( 'mime', array( 'label' => __( 'Mime-type' ) ) ); + get_current_screen()->add_help_tab( array( + 'id' => 'overview', + 'title' => __( 'Overview' ), + 'content' => + '
' . __( 'All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.' ) . '
' + ) ); + + get_current_screen()->set_help_sidebar( + '' . __( 'For more information:' ) . '
' . + '' . __( 'Documentation on Media Library' ) . '
' . + '' . __( 'Support Forums' ) . '
' + ); + + $title = __('Media Library'); + $parent_file = 'upload.php'; + require_once( ABSPATH . 'wp-admin/admin-header.php' ); + ?> + + Add New'; - view.$el.html( text ); - }; // Add the default states. this.states.add([ libraryState @@ -229,7 +223,8 @@ this.on( 'edit:attachment', this.editAttachment, this ); }, - addNewClickHandler: function() { + addNewClickHandler: function( event ) { + event.preventDefault(); this.trigger( 'toggle:upload:attachment' ); }, @@ -446,11 +441,9 @@ this.on( 'content:render:edit-image', this.editImageContentUgh, this ); this.on( 'close', this.detach ); - // Only need a tab to Edit Image for images. - if ( 'undefined' !== typeof this.model && this.model.get( 'type' ) === 'image' ) { + this.on( 'router:create', this.createRouter, this ); this.on( 'router:render', this.browseRouter, this ); - } this.options.hasPrevious = this.hasPrevious(); this.options.hasNext = this.hasNext(); @@ -559,14 +552,20 @@ browseRouter: function( view ) { view.set({ 'edit-metadata': { - text: 'Edit Metadata', + text: l10n.editMetadata, priority: 20 - }, + } + }); + + // Only need a tab to Edit Image for images. + if ( 'undefined' !== typeof this.model && this.model.get( 'type' ) === 'image' ) { + view.set({ 'edit-image': { - text: 'Edit Image', + text: l10n.editImage, priority: 40 } }); + } }, resetContent: function() { @@ -693,4 +692,4 @@ } }); -}(jQuery, _, Backbone, wp)); \ No newline at end of file +}(jQuery, _, Backbone, wp)); diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index eab3c87794..0f3246e1a2 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -5772,11 +5772,12 @@ this.views.add( this.attachments ); this.attachmentsNoResults = new media.View({ - controller: this.controller + controller: this.controller, + tagName: 'p' }); this.attachmentsNoResults.$el.addClass( 'hidden no-media' ); - this.attachmentsNoResults.$el.html( 'No media found.' ); + this.attachmentsNoResults.$el.html( l10n.noMedia ); this.views.add( this.attachmentsNoResults ); diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index a1e5b1f157..f8c950b314 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -2970,6 +2970,10 @@ function wp_enqueue_media( $args = array() ) { 'updateVideoPlaylist' => __( 'Update video playlist' ), 'addToVideoPlaylist' => __( 'Add to video playlist' ), 'addToVideoPlaylistTitle' => __( 'Add to Video Playlist' ), + + // Media Library + 'editMetadata' => __( 'Edit Metadata' ), + 'noMedia' => __( 'No media found. Try a different search.' ), ); /** @@ -3245,4 +3249,4 @@ function attachment_url_to_postid( $url ) { if ( ! empty( $post_id ) ) { return (int) $post_id; } -} \ No newline at end of file +}