Ticket #25821: 25821.6.patch
File 25821.6.patch, 6.2 KB (added by , 11 years ago) |
---|
-
src/wp-admin/css/wp-admin.css
10190 10190 10191 10191 #available-widgets .widget .widget-description { 10192 10192 display: block; 10193 padding: 10px 16px;10194 font-size: 12px;10193 padding: 10px 16px; 10194 font-size: 12px; 10195 10195 } 10196 10196 10197 10197 /* Inactive Sidebars */ … … 10495 10495 } 10496 10496 10497 10497 10498 /* Widgets Area Chooser merge*/10498 /* Widgets Area Chooser */ 10499 10499 .widget-liquid-left #widgets-left.chooser #available-widgets .widget, 10500 10500 .widget-liquid-left #widgets-left.chooser .inactive-sidebar { 10501 transition: opacity 0. 2s ease-in-out;10501 transition: opacity 0.1s linear; 10502 10502 } 10503 10503 10504 10504 .widget-liquid-left #widgets-left.chooser #available-widgets .widget, … … 10523 10523 #widgets-chooser { 10524 10524 clear: both; 10525 10525 display: none; 10526 margin: auto;10527 padding-bottom: 10px;10528 10526 max-width: 400px; 10529 10527 } 10530 10528 10531 10529 #widgets-chooser h3 { 10532 font-size: 14px; 10533 margin: 15px 0; 10530 font-size: 12px; 10531 padding: 15px 0 12px 35px; 10532 margin: 0; 10533 border-top: 1px solid #ccc; 10534 background: rgba(0,0,0,0.6); 10535 color: #fff; 10534 10536 } 10535 10537 10536 10538 #widgets-chooser ul.widgets-chooser-sidebars { 10537 margin: 0 0 20px 0;10539 margin: 0; 10538 10540 list-style-type: none; 10541 max-height: 300px; 10542 overflow: auto; 10539 10543 } 10540 10544 10541 #widgets-chooser ul.widgets-chooser-sidebarsli {10545 #widgets-chooser li { 10542 10546 padding: 10px 15px 10px 35px; 10543 10547 background: #fff; 10544 border: 1px solid #ccc; 10545 border-bottom: none; 10548 border-bottom: 1px solid #ccc; 10546 10549 margin: 0; 10547 10550 cursor: pointer; 10551 outline: none; 10552 position: relative; 10553 transition: background: 0.2s ease-in-out; 10548 10554 } 10549 10555 10550 #widgets-chooser ul.widgets-chooser-sidebars li:hover { 10556 #widgets-chooser li:hover, 10557 #widgets-chooser li:focus { 10551 10558 background: rgba(255,255,255,0.7); 10552 10559 } 10553 10560 10554 #widgets-chooser ul.widgets-chooser-sidebars li.widgets-chooser-selected { 10561 #widgets-chooser li:focus:before { 10562 content: '\f147'; 10563 display: block; 10564 -webkit-font-smoothing: antialiased; 10565 font: normal 26px/1 'dashicons'; 10566 color: #999; 10567 position: absolute; 10568 top: 7px; 10569 left: 5px; 10570 } 10571 10572 #widgets-chooser li.widgets-chooser-selected { 10555 10573 background: #1075a0; 10556 10574 color: #fff; 10557 position: relative;10558 10575 } 10559 10576 10560 #widgets-chooser ul.widgets-chooser-sidebars li.widgets-chooser-selected:before { 10577 #widgets-chooser li.widgets-chooser-selected:before, 10578 #widgets-chooser li.widgets-chooser-selected:focus:before { 10561 10579 content: '\f147'; 10562 10580 display: block; 10563 10581 -webkit-font-smoothing: antialiased; 10564 10582 font: normal 26px/1 'dashicons'; 10583 color: #fff; 10565 10584 position: absolute; 10566 10585 top: 7px; 10567 10586 left: 5px; 10568 10587 } 10569 10588 10570 #widgets-chooser ul.widgets-chooser-sidebars li:last-child {10571 border-bottom: 1px solid #ccc;10572 }10573 10574 10589 #widgets-chooser .widgets-chooser-actions { 10575 clear: both;10590 padding: 10px 0 12px 0; 10576 10591 text-align: center; 10577 10592 } 10578 10593 … … 12368 12383 height: 100%; 12369 12384 z-index: 400; 12370 12385 } 12371 } 12372 No newline at end of file 12386 } -
src/wp-admin/js/widgets.js
204 204 $( '#widgets-left' ).addClass( 'chooser' ); 205 205 widget.addClass( 'widget-in-question' ); 206 206 207 widget. after( chooser );208 chooser.slideDown( 200, function() {207 widget.find( '.widget-description' ).after( chooser ); 208 chooser.slideDown( 300, function() { 209 209 selectSidebar.find('.widgets-chooser-selected').focus(); 210 210 }); 211 212 selectSidebar.find( 'li' ).on( 'focusin.widgets-chooser', function() { 213 selectSidebar.find('.widgets-chooser-selected').removeClass( 'widgets-chooser-selected' ); 214 $(this).addClass( 'widgets-chooser-selected' ); 215 } ) 211 216 } 212 217 }); 213 218 … … 220 225 self.closeChooser(); 221 226 } else if ( $target.hasClass('button-secondary') ) { 222 227 self.closeChooser(); 223 } else if ( $target.is('.widgets-chooser-sidebars li') ) { 228 } 229 /* 230 else if ( $target.is('.widgets-chooser-sidebars li') ) { 224 231 chooser.find('.widgets-chooser-selected').removeClass( 'widgets-chooser-selected' ); 225 232 $target.addClass( 'widgets-chooser-selected' ); 226 233 } 234 */ 235 }).on( 'keyup.widgets-chooser', function( event ) { 236 if ( event.which === $.ui.keyCode.ENTER ) { 237 if ( $( event.target ).hasClass('button-secondary') ) { 238 // Close instead of adding when pressing Enter on the Cancel button 239 self.closeChooser(); 240 } else { 241 self.addWidget( chooser ); 242 self.closeChooser(); 243 } 244 } else if ( event.which === $.ui.keyCode.ESCAPE ) { 245 self.closeChooser(); 246 } 227 247 }); 228 248 }, 229 249 … … 337 357 }, 338 358 339 359 addWidget: function( chooser ) { 340 var widget = $('#available-widgets').find('.widget-in-question').clone(), 341 widgetId = widget.attr('id'), 342 add = widget.find( 'input.add_new' ).val(), 343 n = widget.find( 'input.multi_number' ).val(), 360 var widget, widgetId, add, n, 344 361 sidebarId = chooser.find( '.widgets-chooser-selected' ).data('sidebarId'), 345 362 sidebar = $( '#' + sidebarId ); 346 363 364 // Move the chooser out of the widget 365 $('#wpbody-content').append( chooser ); 366 367 widget = $('#available-widgets').find('.widget-in-question').clone(); 368 widgetId = widget.attr('id'); 369 add = widget.find( 'input.add_new' ).val(); 370 n = widget.find( 'input.multi_number' ).val(); 371 347 372 if ( 'multi' === add ) { 348 373 widget.html( 349 374 widget.html().replace( /<[^<>]+>/g, function(m) { … … 391 416 392 417 clearWidgetSelection: function() { 393 418 $( '#widgets-left' ).removeClass( 'chooser' ); 394 $( ' #available-widgets' ).find( '.widget-in-question' ).removeClass( 'widget-in-question' );419 $( '.widget-in-question' ).removeClass( 'widget-in-question' ); 395 420 } 396 421 }; 397 422 -
src/wp-admin/widgets.php
407 407 </div> 408 408 409 409 <div id="widgets-chooser"> 410 <h3><?php _e( 'Choose a n area to place this widget…' ); ?></h3>410 <h3><?php _e( 'Choose a sidebar:' ); ?></h3> 411 411 <ul class="widgets-chooser-sidebars"></ul> 412 412 <div class="widgets-chooser-actions"> 413 <button class="button-secondary"><?php _e( 'Cancel' ); ?></button> 413 414 <button class="button-primary"><?php _e( 'Add Widget' ); ?></button> 414 <button class="button-secondary"><?php _e( 'Cancel' ); ?></button>415 415 </div> 416 416 </div> 417 417