Add some inline docs to `media-views.js` and remove some unnecessary comments from a few `super` calls.

Props gcorne.
See #26870.



git-svn-id: https://develop.svn.wordpress.org/trunk@27126 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-02-07 20:20:38 +00:00
parent 81679ef453
commit 4b047c21ab
1 changed files with 23 additions and 46 deletions

View File

@ -297,6 +297,11 @@
/** /**
* wp.media.controller.State * wp.media.controller.State
* *
* A state is a step in a workflow that when set will trigger
* the controllers for the regions to be updated as specified. This
* class is the base class that the various states used in the media
* modals extend.
*
* @constructor * @constructor
* @augments Backbone.Model * @augments Backbone.Model
*/ */
@ -792,9 +797,7 @@
if ( ! this.get('AttachmentView') ) { if ( ! this.get('AttachmentView') ) {
this.set( 'AttachmentView', media.view.Attachment.EditLibrary ); this.set( 'AttachmentView', media.view.Attachment.EditLibrary );
} }
/**
* call 'initialize' directly on the parent class
*/
media.controller.Library.prototype.initialize.apply( this, arguments ); media.controller.Library.prototype.initialize.apply( this, arguments );
}, },
@ -808,9 +811,7 @@
this.get('library').observe( wp.Uploader.queue ); this.get('library').observe( wp.Uploader.queue );
this.frame.on( 'content:render:browse', this.gallerySettings, this ); this.frame.on( 'content:render:browse', this.gallerySettings, this );
/**
* call 'activate' directly on the parent class
*/
media.controller.Library.prototype.activate.apply( this, arguments ); media.controller.Library.prototype.activate.apply( this, arguments );
}, },
@ -819,9 +820,7 @@
this.get('library').unobserve( wp.Uploader.queue ); this.get('library').unobserve( wp.Uploader.queue );
this.frame.off( 'content:render:browse', this.gallerySettings, this ); this.frame.off( 'content:render:browse', this.gallerySettings, this );
/**
* call 'deactivate' directly on the parent class
*/
media.controller.Library.prototype.deactivate.apply( this, arguments ); media.controller.Library.prototype.deactivate.apply( this, arguments );
}, },
@ -886,9 +885,6 @@
if ( ! this.get('library') ) { if ( ! this.get('library') ) {
this.set( 'library', media.query({ type: 'image' }) ); this.set( 'library', media.query({ type: 'image' }) );
} }
/**
* call 'initialize' directly on the parent class
*/
media.controller.Library.prototype.initialize.apply( this, arguments ); media.controller.Library.prototype.initialize.apply( this, arguments );
}, },
@ -903,12 +899,8 @@
// Accepts attachments that exist in the original library and // Accepts attachments that exist in the original library and
// that do not exist in gallery's library. // that do not exist in gallery's library.
library.validator = function( attachment ) { library.validator = function( attachment ) {
return !! this.mirroring.get( attachment.cid ) return !! this.mirroring.get( attachment.cid ) && ! edit.get( attachment.cid ) &&
&& ! edit.get( attachment.cid ) media.model.Selection.prototype.validator.apply( this, arguments );
/**
* call 'validator' directly on wp.media.model.Selection
*/
&& media.model.Selection.prototype.validator.apply( this, arguments );
}; };
// Reset the library to ensure that all attachments are re-added // Reset the library to ensure that all attachments are re-added
@ -917,9 +909,7 @@
library.reset( library.mirroring.models, { silent: true }); library.reset( library.mirroring.models, { silent: true });
library.observe( edit ); library.observe( edit );
this.editLibrary = edit; this.editLibrary = edit;
/**
* call 'activate' directly on the parent class
*/
media.controller.Library.prototype.activate.apply( this, arguments ); media.controller.Library.prototype.activate.apply( this, arguments );
} }
}); });
@ -950,9 +940,7 @@
if ( ! this.get('library') ) { if ( ! this.get('library') ) {
this.set( 'library', media.query({ type: 'image' }) ); this.set( 'library', media.query({ type: 'image' }) );
} }
/**
* call 'initialize' directly on the parent class
*/
media.controller.Library.prototype.initialize.apply( this, arguments ); media.controller.Library.prototype.initialize.apply( this, arguments );
library = this.get('library'); library = this.get('library');
@ -981,17 +969,13 @@
activate: function() { activate: function() {
this.updateSelection(); this.updateSelection();
this.frame.on( 'open', this.updateSelection, this ); this.frame.on( 'open', this.updateSelection, this );
/**
* call 'activate' directly on the parent class
*/
media.controller.Library.prototype.activate.apply( this, arguments ); media.controller.Library.prototype.activate.apply( this, arguments );
}, },
deactivate: function() { deactivate: function() {
this.frame.off( 'open', this.updateSelection, this ); this.frame.off( 'open', this.updateSelection, this );
/**
* call 'deactivate' directly on the parent class
*/
media.controller.Library.prototype.deactivate.apply( this, arguments ); media.controller.Library.prototype.deactivate.apply( this, arguments );
}, },
@ -1038,9 +1022,7 @@
if ( ! this.get('library') ) { if ( ! this.get('library') ) {
this.set( 'library', media.query({ type: 'image' }) ); this.set( 'library', media.query({ type: 'image' }) );
} }
/**
* call 'initialize' directly on the parent class
*/
media.controller.Library.prototype.initialize.apply( this, arguments ); media.controller.Library.prototype.initialize.apply( this, arguments );
library = this.get('library'); library = this.get('library');
@ -1068,19 +1050,9 @@
activate: function() { activate: function() {
this.updateSelection(); this.updateSelection();
/**
* call 'activate' directly on the parent class
*/
media.controller.Library.prototype.activate.apply( this, arguments ); media.controller.Library.prototype.activate.apply( this, arguments );
}, },
deactivate: function() {
/**
* call 'deactivate' directly on the parent class
*/
media.controller.Library.prototype.deactivate.apply( this, arguments );
},
updateSelection: function() { updateSelection: function() {
var selection = this.get('selection'), var selection = this.get('selection'),
attachment = this.image.attachment; attachment = this.image.attachment;
@ -1268,6 +1240,9 @@
/** /**
* wp.media.view.Frame * wp.media.view.Frame
* *
* A frame is a composite view consisting of one or more regions and one or more
* states. Only one state can be active at any given moment.
*
* @constructor * @constructor
* @augments wp.media.View * @augments wp.media.View
* @augments wp.Backbone.View * @augments wp.Backbone.View
@ -1327,6 +1302,8 @@
/** /**
* wp.media.view.MediaFrame * wp.media.view.MediaFrame
* *
* Type of frame used to create the media modal.
*
* @constructor * @constructor
* @augments wp.media.view.Frame * @augments wp.media.view.Frame
* @augments wp.media.View * @augments wp.media.View
@ -1343,9 +1320,7 @@
* @global wp.Uploader * @global wp.Uploader
*/ */
initialize: function() { initialize: function() {
/**
* call 'initialize' directly on the parent class
*/
media.view.Frame.prototype.initialize.apply( this, arguments ); media.view.Frame.prototype.initialize.apply( this, arguments );
_.defaults( this.options, { _.defaults( this.options, {
@ -1550,6 +1525,8 @@
/** /**
* wp.media.view.MediaFrame.Select * wp.media.view.MediaFrame.Select
* *
* Type of media frame that is used to select an item or items from the media library
*
* @constructor * @constructor
* @augments wp.media.view.MediaFrame * @augments wp.media.view.MediaFrame
* @augments wp.media.view.Frame * @augments wp.media.view.Frame