<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[28688] trunk/src/wp-includes/js: Improve inline doc descriptions in `media-views.js`.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/28688">28688</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-06-06 14:12:03 +0000 (Fri, 06 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Improve inline doc descriptions in `media-views.js`.

Props ericlewis.
See <a href="http://core.trac.wordpress.org/ticket/28459">#28459</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesjsmediamodelsjs">trunk/src/wp-includes/js/media-models.js</a></li>
<li><a href="#trunksrcwpincludesjsmediaviewsjs">trunk/src/wp-includes/js/media-views.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesjsmediamodelsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-models.js (28687 => 28688)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-models.js 2014-06-06 05:03:33 UTC (rev 28687)
+++ trunk/src/wp-includes/js/media-models.js    2014-06-06 14:12:03 UTC (rev 28688)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx">  var Attachment, Attachments, Query, PostImage, compare, l10n, media;
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * wp.media( attributes )
</del><ins>+         * Create and return a media frame.
</ins><span class="cx">    *
</span><span class="cx">   * Handles the default media experience. Automatically creates
</span><span class="cx">   * and opens a media frame, and returns the result.
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">          } else if ( 'post' === attributes.frame && MediaFrame.Post ) {
</span><span class="cx">                  frame = new MediaFrame.Post( attributes );
</span><span class="cx">          } else if ( 'manage' === attributes.frame && MediaFrame.Manage ) {
</span><del>-                       frame = new MediaFrame.Manage( attributes ); 
</del><ins>+                        frame = new MediaFrame.Manage( attributes );
</ins><span class="cx">           } else if ( 'image' === attributes.frame && MediaFrame.ImageDetails ) {
</span><span class="cx">                  frame = new MediaFrame.ImageDetails( attributes );
</span><span class="cx">          } else if ( 'audio' === attributes.frame && MediaFrame.AudioDetails ) {
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediaviewsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-views.js (28687 => 28688)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-views.js  2014-06-06 05:03:33 UTC (rev 28687)
+++ trunk/src/wp-includes/js/media-views.js     2014-06-06 14:12:03 UTC (rev 28688)
</span><span class="lines">@@ -92,14 +92,16 @@
</span><span class="cx"> 
</span><span class="cx">  _.extend( media.controller.Region.prototype, {
</span><span class="cx">          /**
</span><del>-                * Switch modes
</del><ins>+                 * Activate a mode.
</ins><span class="cx">            *
</span><span class="cx">           * @param {string} mode
</span><span class="cx">           *
</span><del>-                * @fires wp.media.controller.Region#{id}:activate:{mode}
-                * @fires wp.media.controller.Region#{id}:deactivate:{mode}
</del><ins>+                 * @fires this.view#{this.id}:activate:{this._mode}
+                * @fires this.view#{this.id}:activate
+                * @fires this.view#{this.id}:deactivate:{this._mode}
+                * @fires this.view#{this.id}:deactivate
</ins><span class="cx">            *
</span><del>-                * @returns {wp.media.controller.Region} Returns itself to allow chaining
</del><ins>+                 * @returns {wp.media.controller.Region} Returns itself to allow chaining.
</ins><span class="cx">            */
</span><span class="cx">          mode: function( mode ) {
</span><span class="cx">                  if ( ! mode ) {
</span><span class="lines">@@ -110,27 +112,40 @@
</span><span class="cx">                          return this;
</span><span class="cx">                  }
</span><span class="cx"> 
</span><ins>+                       /**
+                        * Region mode deactivation event.
+                        *
+                        * @event this.view#{this.id}:deactivate:{this._mode}
+                        * @event this.view#{this.id}:deactivate
+                        */
</ins><span class="cx">                   this.trigger('deactivate');
</span><ins>+
</ins><span class="cx">                   this._mode = mode;
</span><span class="cx">                  this.render( mode );
</span><ins>+
+                       /**
+                        * Region mode activation event.
+                        *
+                        * @event this.view#{this.id}:activate:{this._mode}
+                        * @event this.view#{this.id}:activate
+                        */
</ins><span class="cx">                   this.trigger('activate');
</span><span class="cx">                  return this;
</span><span class="cx">          },
</span><span class="cx">          /**
</span><del>-                * Render a new mode, the view is set in the `create` callback method
-                *   of the extending class
</del><ins>+                 * Render a mode.
</ins><span class="cx">            *
</span><del>-                * If no mode is provided, just re-render the current mode.
-                * If the provided mode isn't active, perform a full switch.
-                *
</del><span class="cx">            * @param {string} mode
</span><span class="cx">           *
</span><del>-                * @fires wp.media.controller.Region#{id}:create:{mode}
-                * @fires wp.media.controller.Region#{id}:render:{mode}
</del><ins>+                 * @fires this.view#{this.id}:create:{this._mode}
+                * @fires this.view#{this.id}:create
+                * @fires this.view#{this.id}:render:{this._mode}
+                * @fires this.view#{this.id}:render
</ins><span class="cx">            *
</span><span class="cx">           * @returns {wp.media.controller.Region} Returns itself to allow chaining
</span><span class="cx">           */
</span><span class="cx">          render: function( mode ) {
</span><ins>+                       // If the mode isn't active, activate it.
</ins><span class="cx">                   if ( mode && mode !== this._mode ) {
</span><span class="cx">                          return this.mode( mode );
</span><span class="cx">                  }
</span><span class="lines">@@ -138,8 +153,25 @@
</span><span class="cx">                  var set = { view: null },
</span><span class="cx">                          view;
</span><span class="cx"> 
</span><ins>+                       /**
+                        * Create region view event.
+                        *
+                        * Region view creation takes place in an event callback on the frame.
+                        *
+                        * @event this.view#{this.id}:create:{this._mode}
+                        * @event this.view#{this.id}:create
+                        */
</ins><span class="cx">                   this.trigger( 'create', set );
</span><span class="cx">                  view = set.view;
</span><ins>+
+                       /**
+                        * Render region view event.
+                        *
+                        * Region view creation takes place in an event callback on the frame.
+                        *
+                        * @event this.view#{this.id}:create:{this._mode}
+                        * @event this.view#{this.id}:create
+                        */
</ins><span class="cx">                   this.trigger( 'render', view );
</span><span class="cx">                  if ( view ) {
</span><span class="cx">                          this.set( view );
</span><span class="lines">@@ -148,13 +180,17 @@
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          /**
</span><del>-                * @returns {wp.media.View} Returns the selector's first subview
</del><ins>+                 * Get the region's view.
+                *
+                * @returns {wp.media.View}
</ins><span class="cx">            */
</span><span class="cx">          get: function() {
</span><span class="cx">                  return this.view.views.first( this.selector );
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          /**
</span><ins>+                * Set the region's view as a subview of the frame.
+                *
</ins><span class="cx">            * @param {Array|Object} views
</span><span class="cx">           * @param {Object} [options={}]
</span><span class="cx">           * @returns {wp.Backbone.Subviews} Subviews is returned to allow chaining
</span><span class="lines">@@ -167,10 +203,10 @@
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          /**
</span><del>-                * Helper function to trigger view events based on {id}:{event}:{mode}
</del><ins>+                 * Trigger regional view events on the frame.
</ins><span class="cx">            *
</span><span class="cx">           * @param {string} event
</span><del>-                * @returns {undefined|wp.media.controller.Region} Returns itself to allow chaining
</del><ins>+                 * @returns {undefined|wp.media.controller.Region} Returns itself to allow chaining.
</ins><span class="cx">            */
</span><span class="cx">          trigger: function( event ) {
</span><span class="cx">                  var base, args;
</span><span class="lines">@@ -182,11 +218,11 @@
</span><span class="cx">                  args = _.toArray( arguments );
</span><span class="cx">                  base = this.id + ':' + event;
</span><span class="cx"> 
</span><del>-                       // Trigger `region:action:mode` event.
</del><ins>+                        // Trigger `{this.id}:{event}:{this._mode}` event on the frame.
</ins><span class="cx">                   args[0] = base + ':' + this._mode;
</span><span class="cx">                  this.view.trigger.apply( this.view, args );
</span><span class="cx"> 
</span><del>-                       // Trigger `region:action` event.
</del><ins>+                        // Trigger `{this.id}:{event}` event on the frame.
</ins><span class="cx">                   args[0] = base;
</span><span class="cx">                  this.view.trigger.apply( this.view, args );
</span><span class="cx">                  return this;
</span><span class="lines">@@ -210,7 +246,6 @@
</span><span class="cx">  // Use Backbone's self-propagating `extend` inheritance method.
</span><span class="cx">  media.controller.StateMachine.extend = Backbone.Model.extend;
</span><span class="cx"> 
</span><del>-       // Add events to the `StateMachine`.
</del><span class="cx">   _.extend( media.controller.StateMachine.prototype, Backbone.Events, {
</span><span class="cx">          /**
</span><span class="cx">           * Fetch a state.
</span><span class="lines">@@ -286,10 +321,10 @@
</span><span class="cx">          }
</span><span class="cx">  });
</span><span class="cx"> 
</span><del>-       // Map methods from the `states` collection to the `StateMachine` itself.
</del><ins>+        // Map all event binding and triggering on a StateMachine to its `states` collection.
</ins><span class="cx">   _.each([ 'on', 'off', 'trigger' ], function( method ) {
</span><span class="cx">          /**
</span><del>-                * @returns {wp.media.controller.StateMachine} Returns itself to allow chaining
</del><ins>+                 * @returns {wp.media.controller.StateMachine} Returns itself to allow chaining.
</ins><span class="cx">            */
</span><span class="cx">          media.controller.StateMachine.prototype[ method ] = function() {
</span><span class="cx">                  // Ensure that the `states` collection exists so the `StateMachine`
</span><span class="lines">@@ -304,10 +339,9 @@
</span><span class="cx">  /**
</span><span class="cx">   * wp.media.controller.State
</span><span class="cx">   *
</span><del>-        * 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.
</del><ins>+         * A state is a step in a workflow that when set will trigger the controllers
+        * for the regions to be updated as specified in the frame. This is the base
+        * class that the various states used in wp.media extend.
</ins><span class="cx">    *
</span><span class="cx">   * @constructor
</span><span class="cx">   * @augments Backbone.Model
</span><span class="lines">@@ -538,7 +572,7 @@
</span><span class="cx">  };
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * wp.media.controller.Library
</del><ins>+         * A state for choosing an attachment from the media library.
</ins><span class="cx">    *
</span><span class="cx">   * @constructor
</span><span class="cx">   * @augments wp.media.controller.State
</span><span class="lines">@@ -747,7 +781,7 @@
</span><span class="cx">  _.extend( media.controller.Library.prototype, media.selectionSync );
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * wp.media.controller.ImageDetails
</del><ins>+         * A state for editing the settings of an image within a content editor.
</ins><span class="cx">    *
</span><span class="cx">   * @constructor
</span><span class="cx">   * @augments wp.media.controller.State
</span><span class="lines">@@ -778,7 +812,7 @@
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * wp.media.controller.GalleryEdit
</del><ins>+         * A state for editing a gallery's images and settings.
</ins><span class="cx">    *
</span><span class="cx">   * @constructor
</span><span class="cx">   * @augments wp.media.controller.Library
</span><span class="lines">@@ -877,7 +911,7 @@
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * wp.media.controller.GalleryAdd
</del><ins>+         * A state for adding an image to a gallery.
</ins><span class="cx">    *
</span><span class="cx">   * @constructor
</span><span class="cx">   * @augments wp.media.controller.Library
</span><span class="lines">@@ -1111,7 +1145,7 @@
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * wp.media.controller.FeaturedImage
</del><ins>+         * A state for selecting a featured image for a post.
</ins><span class="cx">    *
</span><span class="cx">   * @constructor
</span><span class="cx">   * @augments wp.media.controller.Library
</span><span class="lines">@@ -1194,10 +1228,8 @@
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * wp.media.controller.ReplaceImage
</del><ins>+         * A state for replacing an image.
</ins><span class="cx">    *
</span><del>-        * Replace a selected single image
-        *
</del><span class="cx">    * @constructor
</span><span class="cx">   * @augments wp.media.controller.Library
</span><span class="cx">   * @augments wp.media.controller.State
</span><span class="lines">@@ -1266,7 +1298,7 @@
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * wp.media.controller.EditImage
</del><ins>+         * A state for editing (cropping, etc.) an image.
</ins><span class="cx">    *
</span><span class="cx">   * @constructor
</span><span class="cx">   * @augments wp.media.controller.State
</span><span class="lines">@@ -4530,6 +4562,9 @@
</span><span class="cx">   * @augments Backbone.View
</span><span class="cx">   */
</span><span class="cx">  media.view.RouterItem = media.view.MenuItem.extend({
</span><ins>+               /**
+                * On click handler to activate the content region's corresponding mode.
+                */
</ins><span class="cx">           click: function() {
</span><span class="cx">                  var contentMode = this.options.contentMode;
</span><span class="cx">                  if ( contentMode ) {
</span></span></pre>
</div>
</div>

</body>
</html>