Skip to content

Commit

Permalink
Media Grid: remove Router code that doesn't actually ever run.
Browse files Browse the repository at this point in the history
See #29121.

Built from https://develop.svn.wordpress.org/trunk@29443


git-svn-id: http://core.svn.wordpress.org/trunk@29221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
staylor committed Aug 7, 2014
1 parent 19db9a2 commit 1217efe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
21 changes: 2 additions & 19 deletions wp-includes/js/media-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@
media.view.MediaFrame.Manage.Router = Backbone.Router.extend({
routes: {
'upload.php?item=:slug': 'showItem',
'upload.php?search=:query': 'search',
':default': 'defaultRoute'
'upload.php?search=:query': 'search'
},

// Map routes against the page URL
Expand All @@ -277,32 +276,15 @@

// Respond to the search route by filling the search field and trigggering the input event
search: function( query ) {
// Ensure modal closed, see back button
this.closeModal();
$( '#media-search-input' ).val( query ).trigger( 'input' );
},

// Show the modal with a specific item
showItem: function( query ) {
var library = media.frame.state().get('library');

// Remove existing modal if present
this.closeModal();
// Trigger the media frame to open the correct item
media.frame.trigger( 'edit:attachment', library.findWhere( { id: parseInt( query, 10 ) } ) );
},

// Close the modal if set up
closeModal: function() {
if ( media.frame.modal ) {
media.frame.modal.close();
}
},

// Default route: make sure the modal and search are reset
defaultRoute: function() {
this.closeModal();
$( '#media-search-input' ).val( '' ).trigger( 'input' );
}
});

Expand Down Expand Up @@ -344,6 +326,7 @@
});

this.gridRouter = this.options.gridRouter;

this.library = this.options.library;

if ( this.options.model ) {
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/js/media-grid.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1217efe

Please sign in to comment.