<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[38187] branches/4.6: Updates: Improve bulk update failure notice</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/38187">38187</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/38187","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>jorbin</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-08-03 22:32:09 +0000 (Wed, 03 Aug 2016)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Updates: Improve bulk update failure notice

Merge of <a href="https://core.trac.wordpress.org/changeset/38185">[38185]</a> to the 4.6 branch

When doing a bulk update, if there are failures the user needs to know about that. This makes it clearer that you can click on the notification to see more details, especially for screen reader users.

Fixes <a href="https://core.trac.wordpress.org/ticket/37510">#37510</a>.
Props juhise, Ankit K Gupta, afercia, jorbin, ocean90.?\226?\128?\130</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches46srcwpadmincsscommoncss">branches/4.6/src/wp-admin/css/common.css</a></li>
<li><a href="#branches46srcwpadminincludesupdatephp">branches/4.6/src/wp-admin/includes/update.php</a></li>
<li><a href="#branches46srcwpadminjsupdatesjs">branches/4.6/src/wp-admin/js/updates.js</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#branches46">branches/4.6/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/4.6
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- branches/4.6 2016-08-03 22:27:51 UTC (rev 38186)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/4.6  2016-08-03 22:32:09 UTC (rev 38187)
</ins><a id="branches46"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/4.6</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/3.1:18031
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/3.3:20543
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/3.4:21757
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/trunk:18512,38181,38183
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/trunk:18512,38181,38183,38185
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches46srcwpadmincsscommoncss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.6/src/wp-admin/css/common.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.6/src/wp-admin/css/common.css  2016-08-03 22:27:51 UTC (rev 38186)
+++ branches/4.6/src/wp-admin/css/common.css    2016-08-03 22:32:09 UTC (rev 38187)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3024,7 +3024,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /* Metabox collapse arrow indicators */
</span><span class="cx" style="display: block; padding: 0 10px"> .js .sidebar-name .sidebar-name-arrow:before,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.js .meta-box-sortables .postbox .toggle-indicator:before {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.js .meta-box-sortables .postbox .toggle-indicator:before,
+.bulk-action-notice .toggle-indicator:before {
</ins><span class="cx" style="display: block; padding: 0 10px">         content: "\f142";
</span><span class="cx" style="display: block; padding: 0 10px">        display: inline-block;
</span><span class="cx" style="display: block; padding: 0 10px">        font: normal 20px/1 dashicons;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3035,7 +3036,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> .js .widgets-holder-wrap.closed .sidebar-name-arrow:before,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.js .meta-box-sortables .postbox.closed .handlediv .toggle-indicator:before {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.js .meta-box-sortables .postbox.closed .handlediv .toggle-indicator:before,
+.bulk-action-notice .bulk-action-errors-collapsed .toggle-indicator:before {
</ins><span class="cx" style="display: block; padding: 0 10px">         content: "\f140";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3065,6 +3067,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">        text-indent: 1px; /* account for the dashicon alignment */
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.bulk-action-notice .toggle-indicator:before {
+       line-height: 16px;
+       vertical-align: top;
+       color: #72777c;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .js .postbox .handlediv:focus {
</span><span class="cx" style="display: block; padding: 0 10px">        -webkit-box-shadow: none;
</span><span class="cx" style="display: block; padding: 0 10px">        box-shadow: none;
</span></span></pre></div>
<a id="branches46srcwpadminincludesupdatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.6/src/wp-admin/includes/update.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.6/src/wp-admin/includes/update.php     2016-08-03 22:27:51 UTC (rev 38186)
+++ branches/4.6/src/wp-admin/includes/update.php       2016-08-03 22:32:09 UTC (rev 38187)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -634,7 +634,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div>
</span><span class="cx" style="display: block; padding: 0 10px">        </script>
</span><span class="cx" style="display: block; padding: 0 10px">        <script id="tmpl-wp-bulk-updates-admin-notice" type="text/html">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <div id="{{ data.id }}" class="notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>">
</ins><span class="cx" style="display: block; padding: 0 10px">                         <p>
</span><span class="cx" style="display: block; padding: 0 10px">                                <# if ( data.successes ) { #>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <# if ( 1 === data.successes ) { #>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -664,25 +664,25 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        <# } #>
</span><span class="cx" style="display: block; padding: 0 10px">                                <# } #>
</span><span class="cx" style="display: block; padding: 0 10px">                                <# if ( data.errors ) { #>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        <# if ( 1 === data.errors ) { #>
-                                               <button class="button-link">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 <button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
+                                               <# if ( 1 === data.errors ) { #>
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        /* translators: %s: Number of failures */
-                                                       printf( __( '%s failure.' ), '{{ data.errors }}' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 /* translators: %s: Number of failed updates */
+                                                       printf( __( '%s update failed.' ), '{{ data.errors }}' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                </button>
-                                       <# } else { #>
-                                               <button class="button-link">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         <# } else { #>
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        /* translators: %s: Number of failures */
-                                                       printf( __( '%s failures.' ), '{{ data.errors }}' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 /* translators: %s: Number of failed updates */
+                                                       printf( __( '%s updates failed.' ), '{{ data.errors }}' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                </button>
-                                       <# } #>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         <# } #>
+                                               <span class="screen-reader-text"><?php _e( 'Show more details' ); ?></span>
+                                               <span class="toggle-indicator" aria-hidden="true"></span>
+                                       </button>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <# } #>
</span><span class="cx" style="display: block; padding: 0 10px">                        </p>
</span><span class="cx" style="display: block; padding: 0 10px">                        <# if ( data.errors ) { #>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <ul class="hidden">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <ul class="bulk-action-errors hidden">
</ins><span class="cx" style="display: block; padding: 0 10px">                                         <# _.each( data.errorMessages, function( errorMessage ) { #>
</span><span class="cx" style="display: block; padding: 0 10px">                                                <li>{{ errorMessage }}</li>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <# } ); #>
</span></span></pre></div>
<a id="branches46srcwpadminjsupdatesjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.6/src/wp-admin/js/updates.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.6/src/wp-admin/js/updates.js   2016-08-03 22:27:51 UTC (rev 38186)
+++ branches/4.6/src/wp-admin/js/updates.js     2016-08-03 22:32:09 UTC (rev 38187)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -526,7 +526,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $card.removeClass( 'plugin-card-install-failed' ).find( '.notice.notice-error' ).remove();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $document.trigger( 'wp-plugin-installing', args );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return wp.updates.ajax( 'install-plugin', args );
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -718,7 +718,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                wp.a11y.speak( wp.updates.l10n.deleting, 'polite' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $document.trigger( 'wp-plugin-deleting', args );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return wp.updates.ajax( 'delete-plugin', args );
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1043,7 +1043,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $( '.install-theme-info, [data-slug="' + args.slug + '"]' ).removeClass( 'theme-install-failed' ).find( '.notice.notice-error' ).remove();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $document.trigger( 'wp-theme-installing', args );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return wp.updates.ajax( 'install-theme', args );
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1174,7 +1174,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $( '.theme-info .update-message' ).remove();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $document.trigger( 'wp-theme-deleting', args );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return wp.updates.ajax( 'delete-theme', args );
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1982,7 +1982,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $bulkActionForm.find( '.manage-column [type="checkbox"]' ).prop( 'checked', false );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        $document.trigger( 'wp-' + type + '-bulk-' + bulkAction, itemsSelected );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         // Find all the checkboxes which have been checked.
</span><span class="cx" style="display: block; padding: 0 10px">                        itemsSelected.each( function( index, element ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                var $checkbox  = $( element ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2023,6 +2023,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                wp.updates.addAdminNotice( {
</span><span class="cx" style="display: block; padding: 0 10px">                                        id:            'bulk-action-notice',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        className:     'bulk-action-notice',
</ins><span class="cx" style="display: block; padding: 0 10px">                                         successes:     success,
</span><span class="cx" style="display: block; padding: 0 10px">                                        errors:        error,
</span><span class="cx" style="display: block; padding: 0 10px">                                        errorMessages: errorMessages,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2030,7 +2031,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $bulkActionNotice = $( '#bulk-action-notice' ).on( 'click', 'button', function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $bulkActionNotice.find( 'ul' ).toggleClass( 'hidden' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 // $( this ) is the clicked button, no need to get it again.
+                                       $( this )
+                                               .toggleClass( 'bulk-action-errors-collapsed' )
+                                               .attr( 'aria-expanded', ! $( this ).hasClass( 'bulk-action-errors-collapsed' ) );
+                                       // Show the errors list.
+                                       $bulkActionNotice.find( '.bulk-action-errors' ).toggleClass( 'hidden' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( error > 0 && ! wp.updates.queue.length ) {
</span></span></pre>
</div>
</div>

</body>
</html>