Skip to content

Commit

Permalink
hack around bug in parent
Browse files Browse the repository at this point in the history
  • Loading branch information
mattheu committed Jul 20, 2015
1 parent 4da1936 commit 8623799
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions js/mexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,36 @@

media.view.MEXP = view.extend( {

noMorePosts: false,

fetchedSuccess: function( response ) {

media.view.MEXP.__super__.fetchedSuccess.apply( this, [response] );

if ( 'page' in response.meta && 'total_pages' in response.meta ) {
if ( response.meta && 'page' in response.meta && 'total_pages' in response.meta ) {
if ( response.meta.page >= response.meta.total_pages ) {
this.noMorePosts = true;
jQuery( '#' + this.service.id + '-loadmore' ).attr( 'disabled', true );
}
}

}
},

/**
* Fix bug in MEXP plugin.
* Pagination disabled attr has no effect other than visual.
* https://github.com/Automattic/media-explorer/pull/67
*/
paginate : function( event ) {

if ( this.noMorePosts ) {
return;
}

media.view.MEXP.__super__.paginate.apply( this, [event] );

},


} );

Expand Down

0 comments on commit 8623799

Please sign in to comment.