Media: Hide "Edit" link in the selection view when it doesn't make sense

Props koopersmith, ocean90, nacin
fixes #22713


git-svn-id: https://develop.svn.wordpress.org/trunk@23031 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2012-12-04 18:23:47 +00:00
parent d2c09370e1
commit eb3dc78a61
3 changed files with 19 additions and 4 deletions

View File

@ -232,6 +232,8 @@
.media-selection .selection-info a:last-child {
border-right: 1px;
border-left: 0;
margin-left: 0;
margin-right: -8px;
}
.media-selection:after {

View File

@ -1116,7 +1116,12 @@
vertical-align: top;
}
.media-selection.empty {
.media-selection.empty,
.media-selection.editing {
display: none;
}
.media-selection.one .edit-selection {
display: none;
}
@ -1147,6 +1152,7 @@
.media-selection .selection-info a:last-child {
border-right: 0;
margin-right: 0;
}
.media-selection .selection-info .clear-selection {

View File

@ -1567,7 +1567,7 @@
toolbar: 'main-gallery',
filterable: 'uploaded',
multiple: 'add',
editable: true,
editable: false,
library: media.query( _.defaults({
type: 'image'
@ -3638,6 +3638,7 @@
this.views.set( '.selection-view', this.attachments );
this.collection.on( 'add remove reset', this.refresh, this );
this.controller.on( 'content:activate', this.refresh, this );
},
ready: function() {
@ -3649,9 +3650,15 @@
if ( ! this.$el.children().length )
return;
var collection = this.collection,
editing = 'edit-selection' === this.controller.content.mode();
// If nothing is selected, display nothing.
this.$el.toggleClass( 'empty', ! this.collection.length );
this.$('.count').text( this.collection.length + ' ' + l10n.selected );
this.$el.toggleClass( 'empty', ! collection.length );
this.$el.toggleClass( 'one', 1 === collection.length );
this.$el.toggleClass( 'editing', editing );
this.$('.count').text( collection.length + ' ' + l10n.selected );
},
edit: function( event ) {