Make WordPress Core

Changeset 29066


Ignore:
Timestamp:
07/10/2014 04:01:49 PM (11 years ago)
Author:
wonderboymusic
Message:

Media Grid, remove unnecessary abstraction: wp.media.controller._State

Props ericlewis.
See #24716.

Location:
trunk/src/wp-includes/js
Files:
2 edited

Legend:

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

    r29057 r29066  
    1818     * @augments Backbone.Model
    1919     */
    20     media.controller.EditImageNoFrame = media.controller._State.extend({
     20    media.controller.EditImageNoFrame = media.controller.State.extend({
    2121        defaults: {
    2222            id:      'edit-attachment',
     
    3030        },
    3131
    32         initialize: function() {
    33             media.controller._State.prototype.initialize.apply( this, arguments );
    34         },
    35 
     32        _ready: function() {},
     33
     34        /**
     35         * Override media.controller.State._postActivate, since this state doesn't
     36         * include the regions expected there.
     37         */
    3638        _postActivate: function() {
    3739            this._content();
    3840            this._router();
    39         },
    40 
    41         deactivate: function() {
    42             this.stopListening( this.frame );
    4341        },
    4442
  • trunk/src/wp-includes/js/media-views.js

    r29065 r29066  
    338338
    339339    /**
    340      * A more abstracted state, because media.controller.State expects
    341      * specific regions (menu, title, etc.) to exist on the frame, which do not
    342      * exist in media.view.Frame.EditAttachment.
    343      */
    344     media.controller._State = Backbone.Model.extend({
    345         constructor: function() {
    346             this.on( 'activate', this._preActivate, this );
    347             this.on( 'activate', this.activate, this );
    348             this.on( 'activate', this._postActivate, this );
    349             this.on( 'deactivate', this._deactivate, this );
    350             this.on( 'deactivate', this.deactivate, this );
    351             this.on( 'reset', this.reset, this );
    352             this.on( 'ready', this.ready, this );
    353             /**
    354              * Call parent constructor with passed arguments
    355              */
    356             Backbone.Model.apply( this, arguments );
    357         },
    358 
    359         /**
    360          * @abstract
    361          */
    362         ready: function() {},
    363         /**
    364          * @abstract
    365          */
    366         activate: function() {},
    367         /**
    368          * @abstract
    369          */
    370         deactivate: function() {},
    371         /**
    372          * @abstract
    373          */
    374         reset: function() {},
    375         /**
    376          * @access private
    377          */
    378         _preActivate: function() {
    379             this.active = true;
    380         },
    381         /**
    382          * @access private
    383          */
    384         _postActivate: function() {},
    385         /**
    386          * @access private
    387          */
    388         _deactivate: function() {
    389             this.active = false;
    390         }
    391     });
    392 
    393     /**
    394340     * wp.media.controller.State
    395341     *
     
    401347     * @augments Backbone.Model
    402348     */
    403     media.controller.State = media.controller._State.extend({
     349    media.controller.State = Backbone.Model.extend({
    404350        constructor: function() {
    405351            this.on( 'activate', this._preActivate, this );
     
    417363            this.on( 'change:menu', this._updateMenu, this );
    418364        },
    419 
     365        /**
     366         * @abstract
     367         */
     368        ready: function() {},
     369        /**
     370         * @abstract
     371         */
     372        activate: function() {},
     373        /**
     374         * @abstract
     375         */
     376        deactivate: function() {},
     377        /**
     378         * @abstract
     379         */
     380        reset: function() {},
    420381        /**
    421382         * @access private
     
    424385            this._updateMenu();
    425386        },
    426 
     387        /**
     388         * @access private
     389        */
     390        _preActivate: function() {
     391            this.active = true;
     392        },
    427393        /**
    428394         * @access private
Note: See TracChangeset for help on using the changeset viewer.