diff --git a/src/wp-includes/js/media-grid.js b/src/wp-includes/js/media-grid.js
index 0ebbc67..29d2921 100644
|
a
|
b
|
|
| 233 | 233 | * Open the Edit Attachment modal. |
| 234 | 234 | */ |
| 235 | 235 | editAttachment: function( model ) { |
| 236 | | var library = this.state().get('library'), hasPrevious, hasNext; |
| 237 | | if ( library.indexOf( model ) > 0 ) { |
| 238 | | hasPrevious = true; |
| 239 | | } |
| 240 | | else { |
| 241 | | hasPrevious = false; |
| 242 | | } |
| 243 | | if ( library.indexOf( model ) < library.length - 1 ) { |
| 244 | | hasNext = true; |
| 245 | | } |
| 246 | | else { |
| 247 | | hasNext = false; |
| 248 | | } |
| | 236 | var library = this.state().get('library'); |
| 249 | 237 | |
| 250 | | new media.view.Frame.EditAttachment({ |
| 251 | | hasPrevious: hasPrevious, |
| 252 | | hasNext: hasNext, |
| 253 | | model: model, |
| 254 | | gridController: this |
| | 238 | // Create a new EditAttachment frame, passing along the library and the attachment model. |
| | 239 | this.editAttachmentFrame = new media.view.Frame.EditAttachment({ |
| | 240 | library: library, |
| | 241 | model: model |
| 255 | 242 | }); |
| | 243 | |
| | 244 | // Listen to events on the edit attachment frame for triggering pagination callback handlers. |
| | 245 | this.listenTo( this.editAttachmentFrame, 'edit:attachment:next', this.editNextAttachment ); |
| | 246 | this.listenTo( this.editAttachmentFrame, 'edit:attachment:previous', this.editPreviousAttachment ); |
| 256 | 247 | }, |
| 257 | 248 | |
| 258 | 249 | /** |
| … |
… |
|
| 363 | 354 | this.on( 'router:render', this.browseRouter, this ); |
| 364 | 355 | } |
| 365 | 356 | |
| | 357 | this.options.hasPrevious = ( this.options.library.indexOf( this.options.model ) > 0 ) ? true : false; |
| | 358 | this.options.hasNext = ( this.options.library.indexOf( this.options.model ) < this.options.library.length - 1 ) ? true : false; |
| | 359 | |
| 366 | 360 | // Initialize modal container view. |
| 367 | 361 | if ( this.options.modal ) { |
| 368 | 362 | this.modal = new media.view.Modal({ |
| … |
… |
|
| 471 | 465 | if ( ! this.options.hasPrevious ) |
| 472 | 466 | return; |
| 473 | 467 | this.modal.close(); |
| 474 | | this.options.gridController.trigger( 'edit:attachment:previous', this.model ); |
| | 468 | this.trigger( 'edit:attachment:previous', this.model ); |
| 475 | 469 | }, |
| 476 | 470 | |
| 477 | 471 | /** |
| … |
… |
|
| 481 | 475 | if ( ! this.options.hasNext ) |
| 482 | 476 | return; |
| 483 | 477 | this.modal.close(); |
| 484 | | this.options.gridController.trigger( 'edit:attachment:next', this.model ); |
| | 478 | this.trigger( 'edit:attachment:next', this.model ); |
| 485 | 479 | } |
| 486 | | |
| 487 | 480 | }); |
| 488 | 481 | |
| 489 | 482 | media.view.GridFieldOptions = media.View.extend({ |