Make WordPress Core

Changeset 27051


Ignore:
Timestamp:
01/28/2014 11:20:04 PM (13 years ago)
Author:
wonderboymusic
Message:

For starters, [27050] is rad. This just cleans up some extra new lines that were littered about, updates *some* of the inline docs (needs more), moves wp.media.controller.ImageDetails closer to its parent class, and de-dupes some code in media-template.php.

See #24409.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media-editor.js

    r27005 r27051  
    448448                         * @param {string} content Content that is searched for possible
    449449                         *    shortcode markup matching the passed tag name,
     450                         *
     451                         * @this wp.media.gallery
     452                         *
    450453                         * @returns {wp.media.view.MediaFrame.Select} A media workflow.
    451454                         */
  • trunk/src/wp-includes/js/media-models.js

    r27050 r27051  
    343343
    344344        /**
    345          * wp.media.model.Attachment
     345         * wp.media.model.PostImage
    346346         *
    347347         * @constructor
    348348         * @augments Backbone.Model
    349          *
    350349         **/
    351350        PostImage = media.model.PostImage = Backbone.Model.extend({
    … …  
    355354
    356355                        if ( attributes.attachment_id ) {
    357                                 this.attachment = media.model.Attachment.get( attributes.attachment_id );
     356                                this.attachment = Attachment.get( attributes.attachment_id );
    358357                                this.dfd = this.attachment.fetch();
    359358                                this.bindAttachmentListeners();
    … …  
    365364
    366365                        this.setLinkTypeFromUrl();
    367 
    368366                },
    369367
    … …  
    412410
    413411                        this.set( 'link', type );
    414 
    415                 },
    416 
     412                },
    417413
    418414                updateLinkUrl: function() {
    … …  
    435431                                        this.set( 'linkUrl', '' );
    436432                                        break;
    437 
    438                         }
    439 
     433                        }
    440434                },
    441435
    … …  
    451445                        this.set( 'width', size.width );
    452446                        this.set( 'height', size.height );
    453 
    454447                }
    455 
    456 
    457448        });
    458449
  • trunk/src/wp-includes/js/media-views.js

    r27050 r27051  
    727727
    728728        /**
     729         * wp.media.controller.ImageDetails
     730         *
     731         * @constructor
     732         * @augments wp.media.controller.State
     733         * @augments Backbone.Model
     734         */
     735        media.controller.ImageDetails = media.controller.State.extend({
     736                defaults: _.defaults({
     737                        id: 'image-details',
     738                        toolbar: 'image-details',
     739                        title: l10n.imageDetailsTitle,
     740                        content: 'image-details',
     741                        menu: 'image-details',
     742                        router: false,
     743                        attachment: false,
     744                        priority: 60,
     745                        editing: false
     746                }, media.controller.Library.prototype.defaults ),
     747
     748                initialize: function( options ) {
     749                        this.image = options.image;
     750                        media.controller.State.prototype.initialize.apply( this, arguments );
     751                }
     752        });
     753
     754        /**
    729755         * wp.media.controller.GalleryEdit
    730756         *
    … …  
    911937                        title:      l10n.setFeaturedImageTitle,
    912938                        priority:   60,
    913 
    914939                        syncSelection: false
    915940                }, media.controller.Library.prototype.defaults ),
    … …  
    9811006        });
    9821007
    983 
    984         media.controller.ImageDetails = media.controller.State.extend({
    985 
    986                 defaults: _.defaults({
    987                         id: 'image-details',
    988                         toolbar: 'image-details',
    989                         title: l10n.imageDetailsTitle,
    990                         content: 'image-details',
    991                         menu: 'image-details',
    992                         router: false,
    993                         attachment: false,
    994                         priority: 60,
    995                         editing: false
    996                 }, media.controller.Library.prototype.defaults ),
    997 
    998                 initialize: function( options ) {
    999                         this.image = options.image;
    1000                         media.controller.State.prototype.initialize.apply( this, arguments );
    1001                 }
    1002         });
    1003 
    10041008        /**
    10051009         * wp.media.controller.ReplaceImage
    … …  
    10071011         * Replace a selected single image
    10081012         *
    1009          **/
     1013         * @constructor
     1014         * @augments wp.media.controller.Library
     1015         * @augments wp.media.controller.State
     1016         * @augments Backbone.Model
     1017         */
    10101018        media.controller.ReplaceImage = media.controller.Library.extend({
    10111019                defaults: _.defaults({
    … …  
    10231031
    10241032                        this.image = options.image;
    1025 
    10261033                        // If we haven't been provided a `library`, create a `Selection`.
    10271034                        if ( ! this.get('library') ) {
    … …  
    10761083
    10771084                        selection.reset( attachment ? [ attachment ] : [] );
    1078 
    1079                 }
    1080 
    1081 
     1085                }
    10821086        });
    10831087
  • trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js

    r27050 r27051  
    144144                } );
    145145
    146 
    147146                // extract caption
    148147                captionBlock = editor.dom.getParents( imageNode, '.wp-caption' );
    … …  
    173172
    174173                return metadata;
    175 
    176174        }
    177175
    … …  
    224222                }
    225223                editor.nodeChanged();
    226 
    227224        }
    228225
    … …  
    232229
    233230                mode = mode ? mode : 'node';
    234 
    235231
    236232                if ( ! imageData.caption ) {
    … …  
    262258                                return editor.dom.createHTML( 'a', { href: imageData.linkUrl }, editor.dom.createHTML( 'img', props ) );
    263259                        }
    264                 } else {
    265                         if ( mode === 'node' ) {
    266                                 return editor.dom.create( 'img', props );
    267                         } else if ( mode === 'html' ) {
    268                                 return editor.dom.createHTML( 'img', props );
    269                         }
    270 
     260                } else if ( mode === 'node' ) {
     261                        return editor.dom.create( 'img', props );
     262                } else if ( mode === 'html' ) {
     263                        return editor.dom.createHTML( 'img', props );
    271264                }
    272265        }
    … …  
    651644
    652645                                frame.open();
    653 
    654 
    655646                        }
    656647                }
  • trunk/src/wp-includes/media-template.php

    r27050 r27051  
    547547                                </div>
    548548                                <div class="setting link-to">
    549                                 <span><?php _e('Link To'); ?></span>
    550 
    551                                 <# if ( data.attachment ) { #>
     549                                        <span><?php _e('Link To'); ?></span>
    552550                                        <div class="button-group button-large" data-setting="link">
     551                                        <# if ( data.attachment ) { #>
    553552                                                <button class="button" value="file">
    554553                                                        <?php esc_attr_e('Media File'); ?>
    … …  
    557556                                                        <?php esc_attr_e('Attachment Page'); ?>
    558557                                                </button>
     558                                        <# } else { #>
     559                                                <button class="button" value="file">
     560                                                        <?php esc_attr_e('Image URL'); ?>
     561                                                </button>
     562                                        <# } #>
    559563                                                <button class="button" value="custom">
    560564                                                        <?php esc_attr_e('Custom URL'); ?>
    … …  
    565569                                        </div>
    566570                                        <input type="text" class="link-to-custom" data-setting="linkUrl" />
    567 
    568                                 <# } else { #>
    569                                         <div class="button-group button-large" data-setting="link">
    570                                                 <button class="button" value="file">
    571                                                         <?php esc_attr_e('Image URL'); ?>
    572                                                 </button>
    573                                                 <button class="button" value="custom">
    574                                                         <?php esc_attr_e('Custom URL'); ?>
    575                                                 </button>
    576                                                 <button class="button active" value="none">
    577                                                         <?php esc_attr_e('None'); ?>
    578                                                 </button>
    579                                         </div>
    580                                         <input type="text" class="link-to-custom" data-setting="linkUrl" />
    581 
    582                                 <# } #>
    583571                                </div>
    584572
    … …  
    597585
    598586                                                        foreach ( $sizes as $value => $name ) : ?>
    599                                                                 <#
    600                                                                 var size = data.attachment.sizes['<?php echo esc_js( $value ); ?>'];
     587                                                                <# var size = data.attachment.sizes['<?php echo esc_js( $value ); ?>'];
    601588                                                                if ( size ) { #>
    602589                                                                        <button class="button" value="<?php echo esc_attr( $value ); ?>">
  • trunk/src/wp-includes/media.php

    r27050 r27051  
    20092009                'reverseOrder'       => __( 'Reverse order' ),
    20102010
    2011 
    20122011                // Edit Image
    20132012                'imageDetailsTitle'     => __( 'Image Details' ),
Note: See TracChangeset for help on using the changeset viewer.