Media Grid: make the edit attachment icon clickable.

Props ericlewis.
See #24716.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-07-10 15:56:15 +00:00
parent f281e72922
commit dd9bfea6bb
7 changed files with 19 additions and 8 deletions

View File

@ -2643,6 +2643,9 @@ video#inline-media-node {
font-weight: 300; font-weight: 300;
} }
.media-frame.mode-bulk-edit .attachment:hover .inline-toolbar {
display: none;
}
.edit-attachment-frame .edit-media-header .left:before { .edit-attachment-frame .edit-media-header .left:before {
content: '\f340'; content: '\f340';

File diff suppressed because one or more lines are too long

View File

@ -2643,6 +2643,9 @@ video#inline-media-node {
font-weight: 300; font-weight: 300;
} }
.media-frame.mode-bulk-edit .attachment:hover .inline-toolbar {
display: none;
}
.edit-attachment-frame .edit-media-header .left:before { .edit-attachment-frame .edit-media-header .left:before {
content: '\f340'; content: '\f340';

File diff suppressed because one or more lines are too long

View File

@ -1812,7 +1812,7 @@
this.activeModes.on( 'add remove reset', _.bind( this.triggerModeEvents, this ) ); this.activeModes.on( 'add remove reset', _.bind( this.triggerModeEvents, this ) );
_.each( this.options.mode, function( mode ) { _.each( this.options.mode, function( mode ) {
this.activeModes.add( new Backbone.Model( { id: mode } ) ); this.activateMode( mode );
}, this ); }, this );
// Force the uploader off if the upload limit has been exceeded or // Force the uploader off if the upload limit has been exceeded or
@ -2005,7 +2005,11 @@
this.trigger( eventToTrigger ); this.trigger( eventToTrigger );
}, },
activateMode: function( mode ) { activateMode: function( mode ) {
if ( this.activeModes.where( { id: mode } ).length ) {
return;
}
this.activeModes.add( [ { id: mode } ] ); this.activeModes.add( [ { id: mode } ] );
this.$el.addClass( 'mode-' + mode );
this.trigger( mode + ':activate' ); this.trigger( mode + ':activate' );
}, },
deactivateMode: function( mode ) { deactivateMode: function( mode ) {
@ -2014,6 +2018,7 @@
return; return;
} }
this.activeModes.remove( this.activeModes.where( { id: mode } ) ); this.activeModes.remove( this.activeModes.where( { id: mode } ) );
this.$el.removeClass( 'mode-' + mode );
this.trigger( mode + ':deactivate' ); this.trigger( mode + ':deactivate' );
} }
}); });
@ -4590,7 +4595,7 @@
}, },
events: { events: {
'click .attachment-preview': 'toggleSelectionHandler', 'click .js--select-attachment': 'toggleSelectionHandler',
'change [data-setting]': 'updateSetting', 'change [data-setting]': 'updateSetting',
'change [data-setting] input': 'updateSetting', 'change [data-setting] input': 'updateSetting',
'change [data-setting] select': 'updateSetting', 'change [data-setting] select': 'updateSetting',

File diff suppressed because one or more lines are too long

View File

@ -386,11 +386,11 @@ function wp_print_media_templates() {
<script type="text/html" id="tmpl-attachment"> <script type="text/html" id="tmpl-attachment">
<# if ( _.contains( data.controller.options.mode, 'grid' ) ) { #> <# if ( _.contains( data.controller.options.mode, 'grid' ) ) { #>
<div class="inline-toolbar"> <div class="inline-toolbar js--select-attachment">
<div class="dashicons dashicons-edit edit edit-media"></div> <div class="dashicons dashicons-edit edit edit-media"></div>
</div> </div>
<# } #> <# } #>
<div class="attachment-preview type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}"> <div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
<# if ( data.uploading ) { #> <# if ( data.uploading ) { #>
<div class="media-progress-bar"><div></div></div> <div class="media-progress-bar"><div></div></div>
<# } else if ( 'image' === data.type ) { #> <# } else if ( 'image' === data.type ) { #>