Changeset 27947
- Timestamp:
- 04/04/2014 03:48:34 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/customize-controls.css
r27856 r27947 466 466 } 467 467 468 #customize-control-header_image .uploaded button, 469 #customize-control-header_image .default button { 470 width: 100%; 471 padding: 0; 472 margin: 0; 473 background: none; 474 border: none; 475 color: inherit; 476 cursor: pointer; 477 outline: none; 478 } 479 480 #customize-control-header_image button img { 481 display: block; 482 } 483 468 484 /* Header control: current image container */ 469 485 … … 471 487 overflow: hidden; 472 488 -webkit-border-radius: 2px; 489 border: 1px solid #eee; 473 490 border-radius: 2px; 474 491 } … … 477 494 width: 100%; 478 495 position: relative; 479 background: #262626;480 496 text-align: center; 481 497 cursor: default; … … 486 502 position: absolute; 487 503 width: 100%; 488 height: 18px; 489 margin-top: -9px; 490 top: 50%; 491 color: #eee; 504 color: #555; 505 white-space: nowrap; 506 text-overflow: ellipsis; 507 overflow: hidden; 508 } 509 510 #customize-control-header_image .inner, 511 #customize-control-header_image .inner .dashicons { 512 line-height: 20px; 513 top: 10px; 514 } 515 #customize-control-header_image .list .inner, 516 #customize-control-header_image .list .inner .dashicons { 517 top: 9px; 518 } 519 520 #customize-control-header_image .header-view { 521 position: relative; 522 width: 100%; 523 margin-bottom: 5px; 524 } 525 526 #customize-control-header_image .header-view:last-child { 527 margin-bottom: 0px; 528 } 529 530 /* Convoluted, but 'outline' support isn't good enough yet */ 531 #customize-control-header_image .header-view:after { 532 border: 0; 533 } 534 #customize-control-header_image .header-view.selected:after { 535 content: ''; 536 position: absolute; 537 top: 0; left: 0; bottom: 0; right: 0; 538 border: 4px solid #2ea2cc; 539 border-radius: 2px; 540 } 541 #customize-control-header_image .header-view.button.selected { 542 border: 0; 492 543 } 493 544 494 545 /* Header control: overlay "close" button */ 495 496 #customize-control-header_image .header-view {497 position: relative;498 }499 546 500 547 #customize-control-header_image .uploaded .header-view .close { … … 576 623 } 577 624 578 #customize-control-header_image .choice.random:before {579 position: absolute;580 content: attr(data-label);581 left: 0;582 top: 0;583 }584 585 625 #customize-control-header_image .uploaded div:last-child > .choice { 586 626 margin-bottom: 0; 587 }588 589 #customize-control-header_image .choices hr {590 visibility: hidden;591 627 } 592 628 -
trunk/src/wp-admin/custom-header.php
r27849 r27947 1273 1273 $header_images = get_uploaded_header_images(); 1274 1274 $timestamp_key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); 1275 $alt_text_key = '_wp_attachment_image_alt'; 1275 1276 1276 1277 foreach ( $header_images as &$header_image ) { 1277 $header_image['timestamp'] = get_post_meta( $header_image['attachment_id'], $timestamp_key, true ); 1278 $header_meta = get_post_meta( $header_image['attachment_id'] ); 1279 $header_image['timestamp'] = isset( $header_meta[ $timestamp_key ] ) ? $header_meta[ $timestamp_key ] : ''; 1280 $header_image['alt_text'] = isset( $header_meta[ $alt_text_key ] ) ? $header_meta[ $alt_text_key ] : ''; 1278 1281 } 1279 1282 -
trunk/src/wp-includes/class-wp-customize-control.php
r27945 r27947 775 775 <div class="placeholder random"> 776 776 <div class="inner"> 777 < span><span class="dashicons dashicons-randomize dice"></span>777 <button type="button"><span class="dashicons dashicons-randomize dice"></span> 778 778 <# if ( data.type === 'uploaded' ) { #> 779 779 <?php _e( 'Randomize uploaded headers' ); ?> … … 781 781 <?php _e( 'Randomize suggested headers' ); ?> 782 782 <# } #> 783 </ span>783 </button> 784 784 </div> 785 785 </div> … … 788 788 789 789 <# if (data.type === 'uploaded') { #> 790 <div class="dashicons dashicons-no close"></div>790 <div class="dashicons dashicons-no close"></div> 791 791 <# } #> 792 792 793 < a href="#" class="choice thumbnail #>"793 <button type="button" class="choice thumbnail" 794 794 data-customize-image-value="{{{data.header.url}}}" 795 795 data-customize-header-image-data="{{JSON.stringify(data.header)}}"> 796 <img src="{{{data.header.thumbnail_url}}}"> 797 </a> 796 <span class="screen-reader-text"><?php _e( 'Set image' ); ?></span> 797 <img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}"> 798 </button> 798 799 799 800 <# } #> … … 804 805 <# if (data.random) { #> 805 806 806 <div class="placeholder" >807 <div class="placeholder" tabindex="0"> 807 808 <div class="inner"> 808 809 <span><span class="dashicons dashicons-randomize dice"></span> … … 818 819 <# } else { #> 819 820 820 <img src="{{{data.header.thumbnail_url}}}" />821 <img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}" tabindex="0"/> 821 822 822 823 <# } #> 823 824 <# } else { #> 824 825 825 <div class="placeholder" >826 <div class="placeholder" tabindex="0"> 826 827 <div class="inner"> 827 828 <span> … … 854 855 855 856 <div class="customize-control-content"> 856 <p class="customizer-section-intro" >857 <p class="customizer-section-intro" tabindex="0"> 857 858 <?php 858 859 // @todo translate (and look to custom-header.php for inspiration) … … 868 869 </p> 869 870 <div class="current"> 870 <span class="customize-control-title" >871 <span class="customize-control-title" tabindex="0"> 871 872 <?php _e( 'Current header' ); ?> 872 873 </span> … … 876 877 <div class="actions"> 877 878 <?php /* translators: Hide as in hide header image via the Customizer */ ?> 878 < a href="#" <?php echo $visibility ?> class="button remove"><?php _ex( 'Hide', 'custom header' ); ?></a>879 <button type="button"<?php echo $visibility ?> class="button remove"><?php _ex( 'Hide image', 'custom header' ); ?></button> 879 880 <?php /* translators: New as in add new header image via the Customizer */ ?> 880 < a href="#" class="button new"><?php _ex( 'Add new', 'header image' ); ?></a>881 <button type="button" class="button new"><?php _ex( 'Add new image', 'header image' ); ?></button> 881 882 <div style="clear:both"></div> 882 883 </div> 883 884 <div class="choices"> 884 <span class="customize-control-title header-previously-uploaded" >885 <span class="customize-control-title header-previously-uploaded" tabindex="0"> 885 886 <?php _ex( 'Previously uploaded', 'custom headers' ); ?> 886 887 </span> … … 889 890 </div> 890 891 </div> 891 <span class="customize-control-title header-default" >892 <span class="customize-control-title header-default" tabindex="0"> 892 893 <?php _ex( 'Suggested', 'custom headers' ); ?> 893 894 </span> -
trunk/src/wp-includes/js/customize-models.js
r27651 r27947 27 27 }, 28 28 choice: '', 29 hidden: false,29 selected: false, 30 30 random: false 31 31 }; … … 161 161 } 162 162 163 if (typeof elt.timestamp === 'undefined') { 164 elt.timestamp = 0; 165 } 166 163 167 this.add({ 164 168 header: elt, 165 169 choice: elt.url.split('/').pop(), 166 hidden: current === elt.url.replace(/^https?:\/\//, '')170 selected: current === elt.url.replace(/^https?:\/\//, '') 167 171 }, { silent: true }); 168 172 }, this); … … 192 196 choice: randomChoice, 193 197 random: true, 194 hidden: isRandomSameType198 selected: isRandomSameType 195 199 }); 196 200 }, … … 201 205 202 206 shouldHideTitle: function() { 203 return _.every(this.pluck('hidden'));207 return this.size() < 2; 204 208 }, 205 209 206 210 setImage: function(model) { 207 211 this.each(function(m) { 208 m.set(' hidden', false);212 m.set('selected', false); 209 213 }); 210 214 211 215 if (model) { 212 model.set('hidden', true); 213 // Bump images to top except for special "Randomize" images 214 if (!model.get('random')) { 215 model.get('header').timestamp = _.now(); 216 this.sort(); 217 } 216 model.set('selected', true); 218 217 } 219 218 }, … … 221 220 removeImage: function() { 222 221 this.each(function(m) { 223 m.set('hidden', false); 224 }); 225 }, 226 227 shown: function() { 228 var filtered = this.where({ hidden: false }); 229 return new api.HeaderTool.ChoiceList( filtered ); 222 m.set('selected', false); 223 }); 230 224 } 231 225 }); -
trunk/src/wp-includes/js/customize-views.js
r27693 r27947 33 33 getHeight: function() { 34 34 var image = this.$el.find('img'), 35 saved = this.model.get('savedHeight'), 36 height = image.height() || saved, 37 headerImageData; 35 saved, height, headerImageData; 38 36 39 37 if (image.length) { … … 41 39 } else { 42 40 this.$el.find('.inner').show(); 43 } 41 return 40; 42 } 43 44 saved = this.model.get('savedHeight'); 45 height = image.height() || saved; 44 46 45 47 // happens at ready … … 93 95 * @augments wp.Backbone.View 94 96 */ 95 (function () { // closures FTW96 var lastHeight = 0;97 97 api.HeaderTool.ChoiceView = wp.Backbone.View.extend({ 98 98 template: wp.template('header-choice'), … … 111 111 ]; 112 112 113 this.listenTo(this.model, 'change ', this.render);113 this.listenTo(this.model, 'change:selected', this.toggleSelected); 114 114 115 115 if (_.contains(properties, api.get().header_image)) { … … 119 119 120 120 render: function() { 121 var model = this.model;122 123 121 this.$el.html(this.template(this.extendedModel())); 124 122 125 if (model.get('random')) { 123 if (this.model.get('random')) { 124 this.$el.addClass('button display-options'); 126 125 this.setPlaceholder(40); 127 126 } 128 else { 129 lastHeight = this.getHeight(); 130 } 131 132 this.$el.toggleClass('hidden', model.get('hidden')); 127 128 this.toggleSelected(); 133 129 return this; 130 }, 131 132 toggleSelected: function() { 133 this.$el.toggleClass('selected', this.model.get('selected')); 134 134 }, 135 135 … … 146 146 147 147 select: function() { 148 this.preventJump(); 148 149 this.model.save(); 149 150 api.HeaderTool.currentHeader.set(this.extendedModel()); 151 }, 152 153 preventJump: function() { 154 var container = $('.wp-full-overlay-sidebar-content'), 155 scroll = container.scrollTop(); 156 157 _.defer(function() { 158 container.scrollTop(scroll); 159 }); 150 160 }, 151 161 … … 156 166 } 157 167 }); 158 })();159 168 160 169 … … 175 184 this.listenTo(this.collection, 'remove', this.render); 176 185 this.listenTo(this.collection, 'sort', this.render); 177 this.listenTo(this.collection, 'change:hidden', this.toggleTitle); 178 this.listenTo(this.collection, 'change:hidden', this.setMaxListHeight); 186 this.listenTo(this.collection, 'change', this.toggleList); 179 187 this.render(); 180 188 }, … … 183 191 this.$el.empty(); 184 192 this.collection.each(this.addOne, this); 185 this.toggle Title();193 this.toggleList(); 186 194 }, 187 195 … … 193 201 }, 194 202 195 toggleTitle: function() { 196 var title = this.$el.parents().prev('.customize-control-title'); 203 toggleList: function() { 204 var title = this.$el.parents().prev('.customize-control-title'), 205 randomButton = this.$el.find('.random').parent(); 197 206 if (this.collection.shouldHideTitle()) { 198 title. hide();207 title.add(randomButton).hide(); 199 208 } else { 200 title. show();209 title.add(randomButton).show(); 201 210 } 202 211 }
Note: See TracChangeset
for help on using the changeset viewer.