From cf22cd7d7222b41ca381b268c664d531513522c7 Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Fri, 3 Jul 2015 21:28:24 +0000 Subject: [PATCH] Site Icon: Remove date dropdown from media modal. This also allows us to leverage the builtin `suggestedWidth` and `suggestedHeight` parameters to convey the expected image size. Props ocean90. Fixes #32860. Built from https://develop.svn.wordpress.org/trunk@33075 git-svn-id: http://core.svn.wordpress.org/trunk@33046 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-site-icon.php | 2 +- wp-admin/js/site-icon.js | 23 ++++++++++++----------- wp-admin/js/site-icon.min.js | 2 +- wp-admin/options-general.php | 4 ++-- wp-includes/version.php | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/wp-admin/includes/class-wp-site-icon.php b/wp-admin/includes/class-wp-site-icon.php index 147ccc9440..c397457dc2 100644 --- a/wp-admin/includes/class-wp-site-icon.php +++ b/wp-admin/includes/class-wp-site-icon.php @@ -176,7 +176,7 @@ class WP_Site_Icon { ?>

- +

diff --git a/wp-admin/js/site-icon.js b/wp-admin/js/site-icon.js index 2328d529f6..1f31f312fd 100644 --- a/wp-admin/js/site-icon.js +++ b/wp-admin/js/site-icon.js @@ -3,7 +3,7 @@ $( function() { // Build the choose from library frame. - $( '#choose-from-library-link' ).click( function( event ) { + $( '#choose-from-library-link' ).on( 'click', function( event ) { var $el = $(this); event.preventDefault(); @@ -14,15 +14,7 @@ } // Create the media frame. - frame = wp.media.frames.customHeader = wp.media({ - // Set the title of the modal. - title: $el.data('choose'), - - // Tell the modal to show only images. - library: { - type: 'image' - }, - + frame = wp.media({ // Customize the submit button. button: { // Set the text of the button. @@ -30,7 +22,16 @@ // Tell the button not to close the modal, since we're // going to refresh the page when the image is selected. close: false - } + }, + states: [ + new wp.media.controller.Library({ + title: $el.data( 'choose' ), + library: wp.media.query({ type: 'image' }), + date: false, + suggestedWidth: $el.data( 'size' ), + suggestedHeight: $el.data( 'size' ) + }) + ] }); // When an image is selected, run a callback. diff --git a/wp-admin/js/site-icon.min.js b/wp-admin/js/site-icon.min.js index ee316abd7d..3d680b1cba 100644 --- a/wp-admin/js/site-icon.min.js +++ b/wp-admin/js/site-icon.min.js @@ -1 +1 @@ -!function(a){var b;a(function(){a("#choose-from-library-link").click(function(c){var d=a(this);return c.preventDefault(),b?void b.open():(b=wp.media.frames.customHeader=wp.media({title:d.data("choose"),library:{type:"image"},button:{text:d.data("update"),close:!1}}),b.on("select",function(){var a=b.state().get("selection").first(),c=d.data("updateLink");window.location=c+"&file="+a.id}),void b.open())})})}(jQuery); \ No newline at end of file +!function(a){var b;a(function(){a("#choose-from-library-link").on("click",function(c){var d=a(this);return c.preventDefault(),b?void b.open():(b=wp.media({button:{text:d.data("update"),close:!1},states:[new wp.media.controller.Library({title:d.data("choose"),library:wp.media.query({type:"image"}),date:!1,suggestedWidth:d.data("size"),suggestedHeight:d.data("size")})]}),b.on("select",function(){var a=b.state().get("selection").first(),c=d.data("updateLink");window.location=c+"&file="+a.id}),void b.open())})})}(jQuery); \ No newline at end of file diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index b8175fbb09..21f568fc43 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -146,7 +146,7 @@ include( ABSPATH . 'wp-admin/admin-header.php' );

- +

@@ -158,7 +158,7 @@ include( ABSPATH . 'wp-admin/admin-header.php' );

- +

diff --git a/wp-includes/version.php b/wp-includes/version.php index 1365ec3d8c..9d99a4095d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-beta1-33074'; +$wp_version = '4.3-beta1-33075'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.