X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/607b7e02d77e7326161e8ec15639052d2040f745..4ea0dca21bda49aab5ccb91ec12bb4ef5924ed3e:/wp-admin/js/theme.js diff --git a/wp-admin/js/theme.js b/wp-admin/js/theme.js index 18596e82..9ccf6158 100644 --- a/wp-admin/js/theme.js +++ b/wp-admin/js/theme.js @@ -610,6 +610,11 @@ themes.view.Theme = wp.Backbone.View.extend({ updateTheme: function( event ) { var _this = this; + + if ( ! this.model.get( 'hasPackage' ) ) { + return; + } + event.preventDefault(); wp.updates.maybeRequestFilesystemCredentials( event ); @@ -801,7 +806,7 @@ themes.view.Details = wp.Backbone.View.extend({ $( document ).one( 'wp-theme-delete-success', function( event, response ) { _this.$el.find( '.close' ).trigger( 'click' ); - $( '[data-slug="' + response.slug + '"' ).css( { backgroundColor:'#faafaa' } ).fadeOut( 350, function() { + $( '[data-slug="' + response.slug + '"]' ).css( { backgroundColor:'#faafaa' } ).fadeOut( 350, function() { $( this ).remove(); _themes.data.themes = _.without( _themes.data.themes, _.findWhere( _themes.data.themes, { id: response.slug } ) ); @@ -866,8 +871,12 @@ themes.view.Preview = themes.view.Details.extend({ html: themes.template( 'theme-preview' ), render: function() { - var self = this, currentPreviewDevice, - data = this.model.toJSON(); + var self = this, + currentPreviewDevice, + data = this.model.toJSON(), + $body = $( document.body ); + + $body.attr( 'aria-busy', 'true' ); this.$el.removeClass( 'iframe-ready' ).html( this.html( data ) ); @@ -879,8 +888,7 @@ themes.view.Preview = themes.view.Details.extend({ themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.get( 'id' ) ), { replace: true } ); this.$el.fadeIn( 200, function() { - $( 'body' ).addClass( 'theme-installer-active full-overlay-active' ); - $( '.close-full-overlay' ).focus(); + $body.addClass( 'theme-installer-active full-overlay-active' ); }); this.$el.find( 'iframe' ).one( 'load', function() { @@ -890,6 +898,7 @@ themes.view.Preview = themes.view.Details.extend({ iframeLoaded: function() { this.$el.addClass( 'iframe-ready' ); + $( document.body ).attr( 'aria-busy', 'false' ); }, close: function() { @@ -1519,6 +1528,7 @@ themes.view.InstallerSearch = themes.view.Search.extend({ $( '.filter-links li > a.current' ).removeClass( 'current' ); $( 'body' ).removeClass( 'show-filters filters-applied show-favorites-form' ); + $( '.drawer-toggle' ).attr( 'aria-expanded', 'false' ); // Get the themes by sending Ajax POST request to api.wordpress.org/themes // or searching the local cache @@ -1541,7 +1551,7 @@ themes.view.Installer = themes.view.Appearance.extend({ 'click .filter-drawer .apply-filters': 'applyFilters', 'click .filter-group [type="checkbox"]': 'addFilter', 'click .filter-drawer .clear-filters': 'clearFilters', - 'click .filtered-by': 'backToFilters', + 'click .edit-filters': 'backToFilters', 'click .favorites-form-submit' : 'saveUsername', 'keyup #wporg-username-input': 'saveUsername' }, @@ -1617,6 +1627,7 @@ themes.view.Installer = themes.view.Appearance.extend({ event.preventDefault(); $( 'body' ).removeClass( 'filters-applied show-filters' ); + $( '.drawer-toggle' ).attr( 'aria-expanded', 'false' ); // Bail if this is already active if ( $el.hasClass( this.activeClass ) ) { @@ -1636,9 +1647,9 @@ themes.view.Installer = themes.view.Appearance.extend({ $( '[data-sort="' + sort + '"]' ).addClass( this.activeClass ); if ( 'favorites' === sort ) { - $ ( 'body' ).addClass( 'show-favorites-form' ); + $( 'body' ).addClass( 'show-favorites-form' ); } else { - $ ( 'body' ).removeClass( 'show-favorites-form' ); + $( 'body' ).removeClass( 'show-favorites-form' ); } this.browse( sort ); @@ -1688,6 +1699,11 @@ themes.view.Installer = themes.view.Appearance.extend({ event.preventDefault(); } + if ( ! tags ) { + wp.a11y.speak( l10n.selectFeatureFilter ); + return; + } + $( 'body' ).addClass( 'filters-applied' ); $( '.filter-links li > a.current' ).removeClass( 'current' ); filteringBy.empty(); @@ -1778,22 +1794,22 @@ themes.view.Installer = themes.view.Appearance.extend({ // Toggle the full filters navigation moreFilters: function( event ) { + var $body = $( 'body' ), + $toggleButton = $( '.drawer-toggle' ); + event.preventDefault(); - if ( $( 'body' ).hasClass( 'filters-applied' ) ) { + if ( $body.hasClass( 'filters-applied' ) ) { return this.backToFilters(); } - // If the filters section is opened and filters are checked - // run the relevant query collapsing to filtered-by state - if ( $( 'body' ).hasClass( 'show-filters' ) && this.filtersChecked() ) { - return this.addFilter(); - } - this.clearSearch(); themes.router.navigate( themes.router.baseUrl( '' ) ); - $( 'body' ).toggleClass( 'show-filters' ); + // Toggle the feature filters view. + $body.toggleClass( 'show-filters' ); + // Toggle the `aria-expanded` button attribute. + $toggleButton.attr( 'aria-expanded', $body.hasClass( 'show-filters' ) ); }, // Clears all the checked filters