Create a new Backbone view, `media.view.Label`, which can be used as a subview in things like toolbars, which need screen reader text.

Make an initial instance of it for the label for Bulk Actions in Media Grid.

See #29026.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-08-07 20:09:17 +00:00
parent ce7955cc9e
commit 3f17e7040e
5 changed files with 31 additions and 3 deletions

View File

@ -540,6 +540,13 @@
}); });
this.views.add( new media.view.Label({
value: l10n.bulkActionsLabel,
attributes: {
'for': 'bulk-select-dropdown'
}
}) );
this.views.add( this.views.add(
new media.view.BulkSelectionActionDropdown({ new media.view.BulkSelectionActionDropdown({
controller: this controller: this
@ -566,6 +573,7 @@
*/ */
media.view.BulkSelectionActionDropdown = media.View.extend({ media.view.BulkSelectionActionDropdown = media.View.extend({
tagName: 'select', tagName: 'select',
id: 'bulk-select-dropdown',
initialize: function() { initialize: function() {
media.view.Button.prototype.initialize.apply( this, arguments ); media.view.Button.prototype.initialize.apply( this, arguments );

File diff suppressed because one or more lines are too long

View File

@ -6567,6 +6567,25 @@
} }
}); });
/**
* @constructor
* @augments wp.media.View
* @augments wp.Backbone.View
* @augments Backbone.View
*/
media.view.Label = media.View.extend({
tagName: 'label',
className: 'screen-reader-text',
initialize: function() {
this.value = this.options.value;
},
render: function() {
this.$el.html( this.value );
}
});
/** /**
* wp.media.view.EmbedUrl * wp.media.view.EmbedUrl
* *

File diff suppressed because one or more lines are too long

View File

@ -2937,6 +2937,7 @@ function wp_enqueue_media( $args = array() ) {
'warnDelete' => __( "You are about to permanently delete this item.\n 'Cancel' to stop, 'OK' to delete." ), 'warnDelete' => __( "You are about to permanently delete this item.\n 'Cancel' to stop, 'OK' to delete." ),
'warnBulkDelete' => __( "You are about to permanently delete these items.\n 'Cancel' to stop, 'OK' to delete." ), 'warnBulkDelete' => __( "You are about to permanently delete these items.\n 'Cancel' to stop, 'OK' to delete." ),
'bulkActions' => __( 'Bulk Actions' ), 'bulkActions' => __( 'Bulk Actions' ),
'bulkActionsLabel' => __( 'Select bulk action' ),
'deletePermanently' => __( 'Delete Permanently' ), 'deletePermanently' => __( 'Delete Permanently' ),
'apply' => __( 'Apply' ), 'apply' => __( 'Apply' ),