Make WordPress Core

Changeset 22348


Ignore:
Timestamp:
10/31/2012 09:43:59 PM (12 years ago)
Author:
koopersmith
Message:

Media: Update gallery editing to work with the new frame view. see #21390.

Location:
trunk/wp-includes
Files:
3 edited

Legend:

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

    r22340 r22348  
    691691
    692692            edit: function() {
    693                 if ( ! wp.media.view || this.workflow )
     693                if ( ! wp.media.view || this.frame )
    694694                    return;
    695695
    696                 this.workflow = wp.media({
     696                this.frame = wp.media({
    697697                    state:     'gallery',
    698                     selection: this.attachments.models,
    699698                    title:     mceview.l10n.editGallery,
    700699                    editing:   true,
    701                     multiple:  true
     700                    multiple:  true,
     701                    selection: new wp.media.model.Selection( this.attachments.models, {
     702                        props:    this.attachments.props.toJSON(),
     703                        multiple: true
     704                    })
    702705                });
    703706
    704                 // Create a single-use workflow. If the workflow is closed,
     707                // Create a single-use frame. If the frame is closed,
    705708                // then detach it from the DOM and remove the reference.
    706                 this.workflow.on( 'close', function() {
    707                     this.workflow.detach();
    708                     delete this.workflow;
     709                this.frame.on( 'close', function() {
     710                    this.frame.detach();
     711                    delete this.frame;
    709712                }, this );
    710713
    711714                // Update the `shortcode` and `attachments`.
    712                 this.workflow.on( 'update:gallery', function( selection ) {
     715                this.frame.get('gallery').on( 'update', function( selection ) {
    713716                    var view = mceview.get('gallery');
    714717
  • trunk/wp-includes/js/media-views.js

    r22344 r22348  
    115115            multiple: false,
    116116            describe: false,
    117             title:    l10n.mediaLibrary
     117            title:    l10n.mediaLibraryTitle
    118118        },
    119119
     
    263263            multiple:   false,
    264264            describe:   true,
    265             title:      l10n.createGallery,
    266             edge:       199
     265            title:      l10n.createGalleryTitle,
     266            edge:       199,
     267            editing:    false
    267268        },
    268269
     
    325326                modal:     true,
    326327                multiple:  false,
    327                 uploader:  true
     328                uploader:  true,
     329                editing:   false
    328330            });
    329331
     
    380382                }),
    381383                new media.controller.Gallery({
    382                     library: options.selection
     384                    library: options.selection,
     385                    editing: options.editing
    383386                })
    384387            ]);
     
    825828
    826829            this.options.items = {
    827                 'update-gallery': {
     830                update: {
    828831                    style:    'primary',
    829                     text:     editing ? l10n.updateGallery : l10n.insertGalleryIntoPost,
     832                    text:     editing ? l10n.updateGallery : l10n.insertGallery,
    830833                    priority: 40,
    831834                    click:    function() {
     
    837840                },
    838841
    839                 'return-to-library': {
    840                     text:     editing ? l10n.addImagesFromLibrary : l10n.returnToLibrary,
    841                     priority: -40,
     842                cancel: {
     843                    text:     l10n.cancel,
     844                    priority: -60,
    842845
    843846                    click: function() {
    844                         this.controller.state('library');
     847                        if ( editing )
     848                            controller.close();
     849                        else
     850                            controller.state('library');
    845851                    }
    846852                }
  • trunk/wp-includes/script-loader.php

    r22327 r22348  
    326326        'insertMedia' => __( 'Insert Media' ),
    327327        'search'      => __( 'Search' ),
     328        'cancel'      => __( 'Cancel' ),
     329        'addImages'   => __( 'Add images' ),
    328330
    329331        // Library
    330         'mediaLibrary'          => __( 'Media Library' ),
     332        'mediaLibraryTitle'     => __( 'Media Library' ),
    331333        'createNewGallery'      => __( 'Create a new gallery' ),
    332334        'insertIntoPost'        => __( 'Insert into post' ),
     
    334336
    335337        // Gallery
    336         'createGallery'          => __( 'Create Gallery' ),
    337         'returnToLibrary'        => __( 'Return to media library' ),
    338         'continueEditingGallery' => __( 'Continue editing gallery' ),
    339         'insertGalleryIntoPost'  => __( 'Insert gallery into post' ),
    340         'updateGallery'          => __( 'Update gallery' ),
    341         'addImagesFromLibrary'   => __( 'Add images from media library' ),
     338        'createGalleryTitle' => __( 'Create Gallery' ),
     339        'insertGallery'      => __( 'Insert gallery' ),
     340        'updateGallery'      => __( 'Update gallery' ),
    342341    ) );
    343342
Note: See TracChangeset for help on using the changeset viewer.