Ticket #28946: 28946.2.diff
| File 28946.2.diff, 12.3 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/css/list-tables.css
595 595 padding: 2px 8px 0 0; 596 596 } 597 597 598 .wp-filter .actions { 599 display: inline-block; 600 vertical-align: middle; 601 } 602 598 603 .tablenav .delete { 599 604 margin-right: 20px; 600 605 } … … 617 622 color: #2ea2cc; 618 623 } 619 624 620 .view-switch {625 tablenav .view-switch { 621 626 float: right; 622 627 margin: 5px 16px 0 8px; 623 628 } 624 629 630 .wp-filter .view-switch { 631 display: inline-block; 632 vertical-align: middle; 633 padding: 14px 0; 634 margin: 0 20px 0 0; 635 } 636 625 637 .view-switch a { 626 638 text-decoration: none; 627 639 } … … 1437 1449 display: block; 1438 1450 } 1439 1451 1440 .tablenav.top .actions, .view-switch { 1452 .tablenav.top .actions, 1453 .tablenav .view-switch { 1441 1454 display: none; 1442 1455 } 1443 1456 -
src/wp-admin/css/media.css
513 513 border: 4px dashed #bbb; 514 514 } 515 515 516 .media-frame.mode-grid .media-toolbar select {517 margin-top: 1px;518 font-size: inherit;519 }520 521 .media-frame.mode-grid .attachments-browser .bulk-select {522 display: inline-block;523 margin: 0 10px 0 0;524 }525 526 516 .media-frame.mode-grid .attachments, 527 517 .media-frame.mode-select .attachments { 528 518 padding: 2px; … … 530 520 531 521 .media-frame.mode-select .attachments-browser.fixed .attachments { 532 522 position: relative; 533 top: 80px; /* prevent jumping up when the toolbar becomes fixed */534 padding-bottom: 80px; /* offset for above so the bottom doesn't get cut off */523 top: 97px; /* prevent jumping up when the toolbar becomes fixed */ 524 padding-bottom: 97px; /* offset for above so the bottom doesn't get cut off */ 535 525 } 536 526 537 527 .media-frame.mode-grid .attachment:focus, … … 577 567 * 578 568 * This should be OOCSS'd so both use a shared selector. 579 569 */ 580 .media-frame.mode-grid .attachments-browser .media-toolbar { 581 background: #fff; 582 -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); 583 box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); 584 -webkit-box-sizing: border-box; 585 -moz-box-sizing: border-box; 586 box-sizing: border-box; 587 color: #555; 588 display: inline-block; 589 font-size: 13px; 590 margin: 20px 0; 591 padding: 0 20px; 592 position: relative; 593 width: 100%; 570 571 .media-frame.mode-grid .media-toolbar { 572 margin: 20px 0 16px; 594 573 height: auto; 595 border: none;596 574 } 597 575 598 .media-frame.mode-select .attachments-browser.fixed .media-toolbar { 599 position: fixed; 600 top: 32px; 601 left: auto; 602 right: 20px; 603 margin-top: 0; 576 .media-frame.mode-grid .media-toolbar select { 577 margin: 0 10px 0 0; 578 font-size: inherit; 604 579 } 605 580 606 .media-frame.mode-grid input[type="search"] { 607 margin: 1px; 608 padding: 3px 5px; 609 position: absolute; 610 right: 10px; 611 top: 9px; 612 font-size: 16px; 613 font-weight: 300; 614 line-height: 1.5; 615 width: 280px; 581 .media-frame.mode-grid .media-toolbar-secondary > .media-button { 582 margin-top: 10px; 583 margin-bottom: 10px; 616 584 } 617 585 618 .media-frame.mode-grid . view-switch{586 .media-frame.mode-grid .attachments-browser .bulk-select { 619 587 display: inline-block; 620 float: none; 621 vertical-align: middle; 622 padding: 15px 0; 623 margin: 0 20px 0 0; 588 margin: 0 10px 0 0; 624 589 } 625 590 626 .media-frame.mode-grid select{627 margin : 0 10px 00;591 .media-frame.mode-grid .search { 592 margin-top: 0; 628 593 } 629 594 630 595 .media-frame.mode-grid .spinner { … … 635 600 margin-right: 10px; 636 601 } 637 602 603 .media-frame.mode-select .attachments-browser.fixed .media-toolbar { 604 position: fixed; 605 top: 32px; 606 left: auto; 607 right: 20px; 608 margin-top: 0; 609 } 610 638 611 .media-frame.mode-grid .attachments-browser { 639 612 padding: 0; 640 613 } … … 1158 1131 */ 1159 1132 1160 1133 @media only screen and (max-width: 1120px) { 1161 .media-frame.mode-grid .attachments-browser .media-toolbar-primary,1162 1134 .media-frame.mode-grid .attachments-browser .media-toolbar-secondary { 1163 1135 float: none; 1164 1136 } 1165 1166 .media-frame.mode-grid input[type="search"] {1167 margin: 20px 0;1168 position: static;1169 width: 100%;1170 max-width: 280px;1171 }1172 1137 } 1173 1138 1174 1139 @media only screen and ( max-width: 782px ) { -
src/wp-admin/includes/class-wp-media-list-table.php
60 60 foreach ( $reals as $real ) 61 61 $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real]; 62 62 63 $ class = ( empty($_GET['post_mime_type']) && !$this->detached && !isset($_GET['status']) ) ? ' class="current"' : '';64 $type_links['all'] = "< a href='upload.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</a>';63 $selected = empty( $_GET['attachment-filter'] ) ? ' selected="selected"' : ''; 64 $type_links['all'] = "<option value=''$selected>" . sprintf( _nx( 'All (%s)', 'All (%s)', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</option>'; 65 65 foreach ( $post_mime_types as $mime_type => $label ) { 66 66 $class = ''; 67 67 68 68 if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) ) 69 69 continue; 70 70 71 if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) 72 $class = ' class="current"'; 71 $selected = ''; 72 if ( !empty( $_GET['attachment-filter'] ) && strpos( $_GET['attachment-filter'], 'post_mime_type:' ) === 0 && wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $_GET['attachment-filter'] ) ) ) 73 $selected = ' selected="selected"'; 73 74 if ( !empty( $num_posts[$mime_type] ) ) 74 $type_links[$mime_type] = '< a href="upload.php?post_mime_type=' . urlencode( $mime_type ) . '"' . $class . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</a>';75 $type_links[$mime_type] = '<option value="post_mime_type:' . urlencode( $mime_type ) . '"' . $selected . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</option>'; 75 76 } 76 $type_links['detached'] = '< a href="upload.php?detached=1"' . ( $this->detached ? ' class="current"' : '' ) . '>' . sprintf( _nx( 'Unattached <span class="count">(%s)</span>', 'Unattached <span class="count">(%s)</span>', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . '</a>';77 $type_links['detached'] = '<option value="detached"' . ( $this->detached ? ' selected="selected"' : '' ) . '>' . sprintf( _nx( 'Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . '</option>'; 77 78 78 79 if ( !empty($_num_posts['trash']) ) 79 $type_links['trash'] = '< a href="upload.php?status=trash"' . ( (isset($_GET['status']) && $_GET['status'] == 'trash' ) ? ' class="current"' : '') . '>' . sprintf( _nx( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . '</a>';80 $type_links['trash'] = '<option value="trash"' . ( (isset($_GET['attachment-filter']) && $_GET['attachment-filter'] == 'trash' ) ? ' selected="selected"' : '') . '>' . sprintf( _nx( 'Trash (%s)', 'Trash (%s)', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . '</option>'; 80 81 81 82 return $type_links; 82 83 } … … 91 92 } 92 93 93 94 protected function extra_tablenav( $which ) { 95 if ( 'bar' !== $which ) { 96 return; 97 } 94 98 ?> 95 <div class="a lignleft actions">99 <div class="actions"> 96 100 <?php 97 if ( 'top' == $which && !is_singular() && !$this->detached && !$this->is_trash ) {101 if ( ! is_singular() && ! $this->detached && ! $this->is_trash ) { 98 102 $this->months_dropdown( 'attachment' ); 99 103 100 104 /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */ … … 131 135 global $mode; 132 136 133 137 parent::pagination( $which ); 134 135 $this->view_switcher( $mode );136 138 } 137 139 138 140 /** … … 167 169 <?php 168 170 } 169 171 172 /** 173 * Override parent views so we can use the filter bar display. 174 */ 175 public function views() { 176 global $mode; 177 178 $views = $this->get_views(); 179 180 /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */ 181 $views = apply_filters( "views_{$this->screen->id}", $views ); 182 ?> 183 <div class="wp-filter"> 184 <?php $this->view_switcher( $mode ); ?> 185 186 <select class="attachment-filters" name="attachment-filter"> 187 <?php 188 if ( ! empty( $views ) ) { 189 foreach ( $views as $class => $view ) { 190 echo "\t$view\n"; 191 } 192 } 193 ?> 194 </select> 195 196 <?php $this->extra_tablenav( 'bar' ); ?> 197 <div class="media-toolbar-primary search-form"> 198 <label for="media-search-input" class="screen-reader-text"><?php esc_html_e( 'Search Media' ); ?></label> 199 <input type="search" placeholder="Search" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>"></div> 200 </div> 201 <?php 202 } 203 170 204 public function get_columns() { 171 205 $posts_columns = array(); 172 206 $posts_columns['cb'] = '<input type="checkbox" />'; -
src/wp-admin/includes/post.php
1032 1032 $states .= ',private'; 1033 1033 1034 1034 $q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : $states; 1035 $q['post_status'] = isset( $q['attachment-filter'] ) && 'trash' == $q['attachment-filter'] ? 'trash' : $states; 1036 1035 1037 $media_per_page = (int) get_user_option( 'upload_per_page' ); 1036 1038 if ( empty( $media_per_page ) || $media_per_page < 1 ) 1037 1039 $media_per_page = 20; … … 1051 1053 if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) ) 1052 1054 unset($q['post_mime_type']); 1053 1055 1054 if ( isset($q['detached']) ) 1056 foreach( array_keys( $post_mime_types ) as $type ) { 1057 if ( isset( $q['attachment-filter'] ) && "post_mime_type:$type" == $q['attachment-filter'] ) { 1058 $q['post_mime_type'] = $type; 1059 break; 1060 } 1061 } 1062 1063 if ( isset( $q['detached'] ) || ( isset( $q['attachment-filter'] ) && 'detached' == $q['attachment-filter'] ) ) { 1055 1064 $q['post_parent'] = 0; 1065 } 1056 1066 1057 1067 wp( $q ); 1058 1068 -
src/wp-admin/upload.php
265 265 <div id="message" class="updated"><p><?php echo $message; ?></p></div> 266 266 <?php } ?> 267 267 268 <?php $wp_list_table->views(); ?>269 270 268 <form id="posts-filter" action="" method="get"> 271 269 272 <?php $wp_list_table-> search_box( __( 'Search Media' ), 'media'); ?>270 <?php $wp_list_table->views(); ?> 273 271 274 272 <?php $wp_list_table->display(); ?> 275 273 -
src/wp-includes/js/media-grid.js
179 179 $browser = this.$('.attachments-browser'); 180 180 $toolbar = $browser.find('.media-toolbar'); 181 181 182 if ( $browser.offset().top < this.$window.scrollTop() + this.$adminBar.height() ) { 182 // Offset doesn't appear to take top margin into account, hence +20 183 if ( ( $browser.offset().top + 20 ) < this.$window.scrollTop() + this.$adminBar.height() ) { 183 184 $browser.addClass( 'fixed' ); 184 185 $toolbar.css('width', $browser.width() + 'px'); 185 186 } else { -
src/wp-includes/js/media-views.js
3911 3911 */ 3912 3912 media.view.Toolbar = media.View.extend({ 3913 3913 tagName: 'div', 3914 className: 'media-toolbar ',3914 className: 'media-toolbar wp-filter', 3915 3915 3916 3916 initialize: function() { 3917 3917 var state = this.controller.state(), … … 3923 3923 // The toolbar is composed of two `PriorityList` views. 3924 3924 this.primary = new media.view.PriorityList(); 3925 3925 this.secondary = new media.view.PriorityList(); 3926 this.primary.$el.addClass('media-toolbar-primary ');3926 this.primary.$el.addClass('media-toolbar-primary search-form'); 3927 3927 this.secondary.$el.addClass('media-toolbar-secondary'); 3928 3928 3929 3929 this.views.set([ this.secondary, this.primary ]);