2015-02-09 01:43:50 +01:00
|
|
|
/**
|
|
|
|
* wp.media.view.Router
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @augments wp.media.view.Menu
|
|
|
|
* @augments wp.media.view.PriorityList
|
|
|
|
* @augments wp.media.View
|
|
|
|
* @augments wp.Backbone.View
|
|
|
|
* @augments Backbone.View
|
|
|
|
*/
|
|
|
|
var Menu = require( './menu.js' ),
|
|
|
|
RouterItem = require( './router-item.js' ),
|
|
|
|
Router;
|
|
|
|
|
|
|
|
Router = Menu.extend({
|
|
|
|
tagName: 'div',
|
|
|
|
className: 'media-router',
|
|
|
|
property: 'contentMode',
|
|
|
|
ItemView: RouterItem,
|
|
|
|
region: 'router',
|
|
|
|
|
|
|
|
initialize: function() {
|
|
|
|
this.controller.on( 'content:render', this.update, this );
|
|
|
|
// Call 'initialize' directly on the parent class.
|
|
|
|
Menu.prototype.initialize.apply( this, arguments );
|
|
|
|
},
|
|
|
|
|
|
|
|
update: function() {
|
|
|
|
var mode = this.controller.content.mode();
|
|
|
|
if ( mode ) {
|
|
|
|
this.select( mode );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-02-09 17:01:29 +01:00
|
|
|
module.exports = Router;
|