Make WordPress Core

Changeset 28144


Ignore:
Timestamp:
04/16/2014 12:22:28 AM (10 years ago)
Author:
nacin
Message:

Graceful failures for TinyMCE views of video/audio playlists.

props gcorne.
fixes #27821.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/mce-view.js

    r28084 r28144  
    603603            }, this );
    604604
     605            if ( ! this.data.tracks ) {
     606                return;
     607            }
     608
    605609            p = new WPPlaylistView({
    606610                el: $( self.node ).find( '.wp-playlist' ).get(0),
     
    624628                tracks = [];
    625629
    626             if ( ! this.attachments.length ) {
     630            // Don't render errors while still fetching attachments
     631            if ( this.dfd && 'pending' === this.dfd.state() && ! this.attachments.length ) {
    627632                return;
    628633            }
     
    631636                data[ key ] = model.coerce( data, key );
    632637            });
    633 
    634             attachments = this.attachments.toJSON();
    635638
    636639            options = {
     
    642645                artists: data.artists
    643646            };
     647
     648            if ( ! this.attachments.length ) {
     649                return this.template( options );
     650            }
     651
     652            attachments = this.attachments.toJSON();
    644653
    645654            _.each( attachments, function( attachment ) {
  • trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css

    r28094 r28144  
    290290}
    291291
     292.wpview-error {
     293    border: 1px solid #dedede;
     294    padding: 20px 0;
     295    margin: 0;
     296}
     297
     298.selected .wpview-error {
     299    border-color: transparent;
     300}
     301
     302.wpview-error .dashicons {
     303    display: block;
     304    margin: 0 auto;
     305    width: 32px;
     306    height: 32px;
     307    font-size: 32px;
     308}
     309
     310.wpview-error p {
     311    margin: 0;
     312    text-align: center;
     313    font-family: 'Open Sans', sans-serif;
     314}
     315
    292316
    293317.wpview-wrap .toolbar div:hover,
     
    351375}
    352376
    353 .gallery-error {
    354     border: 1px solid #dedede;
    355     padding: 20px 0;
    356     margin: 0;
    357 }
    358 
    359 .selected .gallery-error {
    360     border-color: transparent;
    361 }
    362 
    363 .gallery-error .dashicons {
    364     display: block;
    365     margin: 0 auto;
    366     width: 32px;
    367     height: 32px;
    368     font-size: 32px;
    369 }
    370 
    371 .gallery-error p {
    372     margin: 0;
    373     text-align: center;
    374     font-family: 'Open Sans', sans-serif;
    375 }
    376377
    377378.gallery .gallery-item {
     
    444445    max-width: 100%;
    445446    height: auto;
     447    border: none;
     448    padding: 0;
    446449}
    447450
  • trunk/src/wp-includes/media-template.php

    r28095 r28144  
    10021002            </div>
    10031003        <# } else { #>
    1004             <div class="gallery-error">
     1004            <div class="wpview-error">
    10051005                <div class="dashicons dashicons-format-gallery"></div><p><?php _e( 'No items found.' ); ?></p>
    10061006            </div>
     
    10331033            <div class="dashicons dashicons-no-alt remove"></div>
    10341034        </div>
    1035         <div class="wp-playlist wp-{{ data.type }}-playlist wp-playlist-{{ data.style }}">
    1036             <# if ( 'audio' === data.type ){ #>
    1037             <div class="wp-playlist-current-item"></div>
    1038             <# } #>
    1039             <{{ data.type }} controls="controls" preload="none" <#
    1040                 if ( data.width ) { #> width="{{ data.width }}"<# }
    1041                 #><# if ( data.height ) { #> height="{{ data.height }}"<# } #>></{{ data.type }}>
    1042             <div class="wp-playlist-next"></div>
    1043             <div class="wp-playlist-prev"></div>
    1044         </div>
    1045         <div class="wpview-overlay"></div>
     1035        <# if ( data.tracks ) { #>
     1036            <div class="wp-playlist wp-{{ data.type }}-playlist wp-playlist-{{ data.style }}">
     1037                <# if ( 'audio' === data.type ){ #>
     1038                <div class="wp-playlist-current-item"></div>
     1039                <# } #>
     1040                <{{ data.type }} controls="controls" preload="none" <#
     1041                    if ( data.width ) { #> width="{{ data.width }}"<# }
     1042                    #><# if ( data.height ) { #> height="{{ data.height }}"<# } #>></{{ data.type }}>
     1043                <div class="wp-playlist-next"></div>
     1044                <div class="wp-playlist-prev"></div>
     1045            </div>
     1046            <div class="wpview-overlay"></div>
     1047        <# } else { #>
     1048            <div class="wpview-error">
     1049                <div class="dashicons dashicons-video-alt3"></div><p><?php _e( 'No items found.' ); ?></p>
     1050            </div>
     1051        <# } #>
    10461052    </script>
    10471053
Note: See TracChangeset for help on using the changeset viewer.