Changeset 22712
- Timestamp:
- 11/20/2012 01:49:35 PM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/css/media-views.css
r22706 r22712 387 387 height: 100%; 388 388 width: 100%; 389 } 390 391 /** 392 * Attachment Browser Filters 393 */ 394 .media-frame select.attachment-filters { 395 margin-top: 11px; 396 margin-right: 10px; 389 397 } 390 398 -
trunk/wp-includes/js/media-views.js
r22710 r22712 256 256 toolbar: 'main-attachments', 257 257 sidebar: 'settings', 258 searchable: true 258 searchable: true, 259 filterable: false 259 260 }, 260 261 … … 335 336 var frame = this.frame; 336 337 337 // Content.338 338 if ( this.get('empty') ) { 339 339 // Attempt to fetch any Attachments we don't already have. … … 355 355 356 356 _updateEmpty: function() { 357 var library = this.get('library'); 357 var library = this.get('library'), 358 props = library.props; 359 360 // If we're filtering the library, bail. 361 if ( this.get('filterable') && ( props.get('type') || props.get('parent') ) ) 362 return; 363 358 364 this.set( 'empty', ! library.length && ! library.props.get('search') ); 359 365 }, … … 1214 1220 search: state.get('searchable'), 1215 1221 upload: state.get('upload'), 1222 filters: state.get('filterable'), 1216 1223 1217 1224 AttachmentView: state.get('AttachmentView') … … 1341 1348 // Main states. 1342 1349 new media.controller.Library( _.defaults({ 1343 selection: options.selection, 1344 library: media.query( options.library ), 1345 editable: true 1350 selection: options.selection, 1351 library: media.query( options.library ), 1352 editable: true, 1353 filterable: true 1346 1354 }, main ) ), 1347 1355 … … 2720 2728 }); 2721 2729 2730 /** 2731 * wp.media.view.AttachmentFilters 2732 */ 2733 media.view.AttachmentFilters = media.View.extend({ 2734 tagName: 'select', 2735 className: 'attachment-filters', 2736 2737 events: { 2738 change: 'change' 2739 }, 2740 2741 initialize: function() { 2742 var els; 2743 2744 els = _.map({ 2745 all: 'allMediaItems', 2746 uploaded: 'uploadedToThisPost', 2747 image: 'images', 2748 audio: 'audio', 2749 video: 'videos' 2750 }, function( text, value ) { 2751 return this.make( 'option', { value: value }, l10n[ text ] ); 2752 }, this ); 2753 2754 this.$el.html( els ); 2755 2756 this.model.on( 'change', this.select, this ); 2757 this.select(); 2758 }, 2759 2760 change: function( event ) { 2761 var model = this.model, 2762 value = this.el.value, 2763 type; 2764 2765 if ( 'all' === value || 'uploaded' === value ) 2766 model.unset('type'); 2767 else if ( 'image' === value || 'audio' === value || 'video' === value ) 2768 model.set( 'type', value ); 2769 2770 if ( 'uploaded' === value ) 2771 model.set( 'parent', media.view.settings.postId ); 2772 else 2773 model.unset('parent'); 2774 }, 2775 2776 select: function() { 2777 var model = this.model, 2778 type = model.get('type'), 2779 value = 'all'; 2780 2781 if ( model.get('parent') === media.view.settings.postId ) 2782 value = 'uploaded'; 2783 else if ( 'image' === type ) 2784 value = 'image'; 2785 else if ( 'audio' === type ) 2786 value = 'audio'; 2787 else if ( 'video' === type ) 2788 value = 'video'; 2789 2790 this.$el.val( value ); 2791 } 2792 }); 2793 2722 2794 2723 2795 … … 2733 2805 2734 2806 _.defaults( this.options, { 2735 search: true,2736 upload: false,2737 total: true,2807 filters: false, 2808 search: true, 2809 upload: false, 2738 2810 2739 2811 AttachmentView: media.view.Attachment.Library … … 2743 2815 controller: this.controller 2744 2816 }); 2817 2818 if ( this.options.filters ) { 2819 this.toolbar.set( 'filters', new media.view.AttachmentFilters({ 2820 controller: this.controller, 2821 model: this.collection.props, 2822 priority: -80 2823 }).render() ); 2824 } 2745 2825 2746 2826 if ( this.options.search ) { … … 2748 2828 controller: this.controller, 2749 2829 model: this.collection.props, 2750 priority: -602830 priority: 60 2751 2831 }).render() ); 2752 2832 } -
trunk/wp-includes/media.php
r22706 r22712 1358 1358 'returnToLibrary' => __( '← Return to library' ), 1359 1359 1360 'allMediaItems' => __( 'All media items' ), 1361 'uploadedToThisPost' => __( 'Uploaded to this post' ), 1362 'images' => __( 'Images' ), 1363 'audio' => __( 'Audio' ), 1364 'videos' => __( 'Videos' ), 1365 1360 1366 // Embed 1361 1367 'embedFromUrlTitle' => __( 'Embed From URL' ),
Note: See TracChangeset
for help on using the changeset viewer.