Theme Installer: Fix the Theme Preview function, and bring the button handling/styling inline with the Customizer. Fixes #26129

Built from https://develop.svn.wordpress.org/trunk@26317


git-svn-id: http://core.svn.wordpress.org/trunk@26221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2013-11-22 04:03:10 +00:00
parent 61ed60c619
commit f392843074
7 changed files with 55 additions and 6 deletions

View File

@ -7685,6 +7685,7 @@ body.full-overlay-active {
font-size: 16px;
line-height: 24px;
margin-bottom: 0;
margin-top: 0;
}
.install-theme-info .theme-screenshot {
@ -7713,6 +7714,26 @@ body.full-overlay-active {
line-height: 20px;
}
#theme-installer .wp-full-overlay-header {
margin-top: 9px;
}
#theme-installer .wp-full-overlay-header .theme-install {
float: left;
/* For when .theme-install is a span rather than a.button-primary (already installed theme) */
line-height: 26px;
}
#theme-installer .wp-full-overlay-sidebar {
background: #EEE;
border-left: 1px solid #DDD;
}
#theme-installer .wp-full-overlay-main {
background: #fff url('../images/spinner.gif') no-repeat fixed center center;
background-size: 20px 20px;
}
/*------------------------------------------------------------------------------
25.0 - Misc
------------------------------------------------------------------------------*/
@ -10716,7 +10737,8 @@ li#wp-admin-bar-toggle-button {
.spinner,
.imgedit-wait,
.customize-loading #customize-container,
.revision-tick.completed-false {
.revision-tick.completed-false,
#theme-installer .wp-full-overlay-main {
background-image: url('../images/spinner-2x.gif');
}

File diff suppressed because one or more lines are too long

View File

@ -7689,6 +7689,7 @@ body.full-overlay-active {
font-size: 16px;
line-height: 24px;
margin-bottom: 0;
margin-top: 0;
}
.install-theme-info .theme-screenshot {
@ -7717,6 +7718,26 @@ body.full-overlay-active {
line-height: 20px;
}
#theme-installer .wp-full-overlay-header {
margin-top: 9px;
}
#theme-installer .wp-full-overlay-header .theme-install {
float: right;
/* For when .theme-install is a span rather than a.button-primary (already installed theme) */
line-height: 26px;
}
#theme-installer .wp-full-overlay-sidebar {
background: #EEE;
border-right: 1px solid #DDD;
}
#theme-installer .wp-full-overlay-main {
background: #fff url('../images/spinner.gif') no-repeat fixed center center;
background-size: 20px 20px;
}
/*------------------------------------------------------------------------------
25.0 - Misc
------------------------------------------------------------------------------*/
@ -10720,7 +10741,8 @@ li#wp-admin-bar-toggle-button {
.spinner,
.imgedit-wait,
.customize-loading #customize-container,
.revision-tick.completed-false {
.revision-tick.completed-false,
#theme-installer .wp-full-overlay-main {
background-image: url('../images/spinner-2x.gif');
}

File diff suppressed because one or more lines are too long

View File

@ -255,7 +255,8 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
<div id="theme-installer" class="wp-full-overlay expanded">
<div class="wp-full-overlay-sidebar">
<div class="wp-full-overlay-header">
<a href="#" class="close-full-overlay"><?php _e( '&larr; Close' ); ?></a>
<a href="#" class="close-full-overlay button-secondary"><?php _e( 'Close' ); ?></a>
<span class="theme-install"></span>
</div>
<div class="wp-full-overlay-sidebar-content">
<div class="install-theme-info"></div>

View File

@ -60,6 +60,7 @@ jQuery( function($) {
}
var preview = $('#theme-installer'),
header = preview.find('.wp-full-overlay-header'),
info = preview.find('.install-theme-info'),
panel = preview.find('.wp-full-overlay-main'),
body = $( document.body );
@ -81,6 +82,9 @@ jQuery( function($) {
var src;
info.html( $(this).closest('.installable-theme').find('.install-theme-info').html() );
header.find( '.theme-install' ).replaceWith( info.find( '.theme-install' ) );
src = info.find( '.theme-preview-url' ).val();
panel.html( '<iframe src="' + src + '" />');
preview.fadeIn( 200, function() {

View File

@ -1 +1 @@
var theme_viewer;jQuery(function(a){a("#availablethemes").on("click",".theme-detail",function(b){var c=a(this).closest(".available-theme"),d=c.find(".themedetaildiv");d.length||(d=c.find(".install-theme-info .theme-details"),d=d.clone().addClass("themedetaildiv").appendTo(c).hide()),d.toggle(),b.preventDefault()})});var tb_position;jQuery(document).ready(function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height(),e=c>1040?1040:c,f=0;a("body.admin-bar").length&&(f=28),b.size()&&(b.width(e-50).height(d-45-f),a("#TB_iframeContent").width(e-50).height(d-75-f),b.css({"margin-left":"-"+parseInt((e-50)/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:20+f+"px","margin-top":"0"}))},a(window).resize(function(){tb_position()})}),jQuery(function(a){if(window.postMessage){var b=a("#theme-installer"),c=b.find(".install-theme-info"),d=b.find(".wp-full-overlay-main"),e=a(document.body);b.on("click",".close-full-overlay",function(a){b.fadeOut(200,function(){d.empty(),e.removeClass("theme-installer-active full-overlay-active")}),a.preventDefault()}),b.on("click",".collapse-sidebar",function(a){b.toggleClass("collapsed").toggleClass("expanded"),a.preventDefault()}),a("#availablethemes").on("click",".install-theme-preview",function(f){var g;c.html(a(this).closest(".installable-theme").find(".install-theme-info").html()),g=c.find(".theme-preview-url").val(),d.html('<iframe src="'+g+'" />'),b.fadeIn(200,function(){e.addClass("theme-installer-active full-overlay-active")}),f.preventDefault()})}});var ThemeViewer;!function(a){ThemeViewer=function(){function b(){a("#filter-click, #mini-filter-click").unbind("click").click(function(){return a("#filter-click").toggleClass("current"),a("#filter-box").slideToggle(),a("#current-theme").slideToggle(300),!1}),a("#filter-box :checkbox").unbind("click").click(function(){var b=a("#filter-box :checked").length,c=a("#filter-click").text();-1!==c.indexOf("(")&&(c=c.substr(0,c.indexOf("("))),0===b?a("#filter-click").text(c):a("#filter-click").text(c+" ("+b+")")})}var c={init:b};return c}}(jQuery),jQuery(document).ready(function(){theme_viewer=new ThemeViewer,theme_viewer.init()});var ThemeScroller;!function(a){ThemeScroller={querying:!1,scrollPollingDelay:500,failedRetryDelay:4e3,outListBottomThreshold:300,init:function(){var b=this;return"undefined"==typeof ajaxurl||"undefined"==typeof list_args||"undefined"==typeof theme_list_args?(a(".pagination-links").show(),void 0):(this.nonce=a("#_ajax_fetch_list_nonce").val(),this.nextPage=theme_list_args.paged+1,this.$outList=a("#availablethemes"),this.$spinner=a("div.tablenav.bottom").children(".spinner"),this.$window=a(window),this.$document=a(document),theme_list_args.total_pages>=this.nextPage&&(this.pollInterval=setInterval(function(){return b.poll()},this.scrollPollingDelay)),void 0)},poll:function(){var a=this.$document.scrollTop()+this.$window.innerHeight();this.querying||a<this.$outList.height()-this.outListBottomThreshold||this.ajax()},process:function(a){return void 0===a?(clearInterval(this.pollInterval),void 0):(this.nextPage>theme_list_args.total_pages&&clearInterval(this.pollInterval),this.nextPage<=theme_list_args.total_pages+1&&this.$outList.append(a.rows),void 0)},ajax:function(){var b=this,c={action:"fetch-list",paged:this.nextPage,s:theme_list_args.search,tab:theme_list_args.tab,type:theme_list_args.type,_ajax_fetch_list_nonce:this.nonce,"features[]":theme_list_args.features,list_args:list_args};this.querying=!0,this.$spinner.show(),a.getJSON(ajaxurl,c).done(function(a){b.nextPage++,b.process(a),b.$spinner.hide(),b.querying=!1}).fail(function(){b.$spinner.hide(),b.querying=!1,setTimeout(function(){b.ajax()},b.failedRetryDelay)})}},a(document).ready(function(){ThemeScroller.init()})}(jQuery);
var theme_viewer;jQuery(function(a){a("#availablethemes").on("click",".theme-detail",function(b){var c=a(this).closest(".available-theme"),d=c.find(".themedetaildiv");d.length||(d=c.find(".install-theme-info .theme-details"),d=d.clone().addClass("themedetaildiv").appendTo(c).hide()),d.toggle(),b.preventDefault()})});var tb_position;jQuery(document).ready(function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height(),e=c>1040?1040:c,f=0;a("body.admin-bar").length&&(f=28),b.size()&&(b.width(e-50).height(d-45-f),a("#TB_iframeContent").width(e-50).height(d-75-f),b.css({"margin-left":"-"+parseInt((e-50)/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:20+f+"px","margin-top":"0"}))},a(window).resize(function(){tb_position()})}),jQuery(function(a){if(window.postMessage){var b=a("#theme-installer"),c=b.find(".wp-full-overlay-header"),d=b.find(".install-theme-info"),e=b.find(".wp-full-overlay-main"),f=a(document.body);b.on("click",".close-full-overlay",function(a){b.fadeOut(200,function(){e.empty(),f.removeClass("theme-installer-active full-overlay-active")}),a.preventDefault()}),b.on("click",".collapse-sidebar",function(a){b.toggleClass("collapsed").toggleClass("expanded"),a.preventDefault()}),a("#availablethemes").on("click",".install-theme-preview",function(g){var h;d.html(a(this).closest(".installable-theme").find(".install-theme-info").html()),c.find(".theme-install").replaceWith(d.find(".theme-install")),h=d.find(".theme-preview-url").val(),e.html('<iframe src="'+h+'" />'),b.fadeIn(200,function(){f.addClass("theme-installer-active full-overlay-active")}),g.preventDefault()})}});var ThemeViewer;!function(a){ThemeViewer=function(){function b(){a("#filter-click, #mini-filter-click").unbind("click").click(function(){return a("#filter-click").toggleClass("current"),a("#filter-box").slideToggle(),a("#current-theme").slideToggle(300),!1}),a("#filter-box :checkbox").unbind("click").click(function(){var b=a("#filter-box :checked").length,c=a("#filter-click").text();-1!==c.indexOf("(")&&(c=c.substr(0,c.indexOf("("))),0===b?a("#filter-click").text(c):a("#filter-click").text(c+" ("+b+")")})}var c={init:b};return c}}(jQuery),jQuery(document).ready(function(){theme_viewer=new ThemeViewer,theme_viewer.init()});var ThemeScroller;!function(a){ThemeScroller={querying:!1,scrollPollingDelay:500,failedRetryDelay:4e3,outListBottomThreshold:300,init:function(){var b=this;return"undefined"==typeof ajaxurl||"undefined"==typeof list_args||"undefined"==typeof theme_list_args?(a(".pagination-links").show(),void 0):(this.nonce=a("#_ajax_fetch_list_nonce").val(),this.nextPage=theme_list_args.paged+1,this.$outList=a("#availablethemes"),this.$spinner=a("div.tablenav.bottom").children(".spinner"),this.$window=a(window),this.$document=a(document),theme_list_args.total_pages>=this.nextPage&&(this.pollInterval=setInterval(function(){return b.poll()},this.scrollPollingDelay)),void 0)},poll:function(){var a=this.$document.scrollTop()+this.$window.innerHeight();this.querying||a<this.$outList.height()-this.outListBottomThreshold||this.ajax()},process:function(a){return void 0===a?(clearInterval(this.pollInterval),void 0):(this.nextPage>theme_list_args.total_pages&&clearInterval(this.pollInterval),this.nextPage<=theme_list_args.total_pages+1&&this.$outList.append(a.rows),void 0)},ajax:function(){var b=this,c={action:"fetch-list",paged:this.nextPage,s:theme_list_args.search,tab:theme_list_args.tab,type:theme_list_args.type,_ajax_fetch_list_nonce:this.nonce,"features[]":theme_list_args.features,list_args:list_args};this.querying=!0,this.$spinner.show(),a.getJSON(ajaxurl,c).done(function(a){b.nextPage++,b.process(a),b.$spinner.hide(),b.querying=!1}).fail(function(){b.$spinner.hide(),b.querying=!1,setTimeout(function(){b.ajax()},b.failedRetryDelay)})}},a(document).ready(function(){ThemeScroller.init()})}(jQuery);