Changeset 22882
- Timestamp:
- 11/27/2012 11:20:12 PM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-editor.js
r22877 r22882 158 158 captiontag: 'dd', 159 159 columns: 3, 160 size: 'thumbnail' 160 size: 'thumbnail', 161 orderby: 'menu_order ID' 161 162 }, 162 163 … … 171 172 return result; 172 173 173 attrs = shortcode.attrs.named; 174 // Fill the default shortcode attributes. 175 attrs = _.defaults( shortcode.attrs.named, wp.media.gallery.defaults ); 174 176 args = _.pick( attrs, 'orderby', 'order' ); 175 177 176 178 args.type = 'image'; 177 179 args.perPage = -1; 180 181 // Map the `orderby` attribute to the corresponding model property. 182 if ( ! attrs.orderby || /^menu_order(?: ID)?$/i.test( attrs.orderby ) ) 183 args.orderby = 'menuOrder'; 178 184 179 185 // Map the `ids` param to the correct query args. … … 205 211 shortcode: function( attachments ) { 206 212 var props = attachments.props.toJSON(), 207 attrs = _.pick( props, ' include', 'exclude', 'orderby', 'order' ),213 attrs = _.pick( props, 'orderby', 'order' ), 208 214 shortcode, clone; 209 215 … … 211 217 _.extend( attrs, attachments.gallery.toJSON() ); 212 218 219 // Convert all gallery shortcodes to use the `ids` property. 220 // Ignore `post__in` and `post__not_in`; the attachments in 221 // the collection will already reflect those properties. 213 222 attrs.ids = attachments.pluck('id'); 223 224 // Copy the `parent` post ID. 225 if ( props.parent ) 226 attrs.id = props.parent; 214 227 215 228 // If the `ids` attribute is set and `orderby` attribute … … 273 286 }); 274 287 275 return wp.media({ 288 // Destroy the previous gallery frame. 289 if ( this.frame ) 290 this.frame.dispose(); 291 292 // Store the current gallery frame. 293 this.frame = wp.media({ 276 294 frame: 'post', 277 295 state: 'gallery-edit', … … 281 299 selection: selection 282 300 }); 301 302 return this.frame; 283 303 } 284 304 }; -
trunk/wp-includes/js/media-models.js
r22872 r22882 660 660 661 661 orderby: { 662 allowed: [ 'name', 'author', 'date', 'title', 'modified', 'uploadedTo', 'id', 'post__in' ],662 allowed: [ 'name', 'author', 'date', 'title', 'modified', 'uploadedTo', 'id', 'post__in', 'menuOrder' ], 663 663 valuemap: { 664 664 'id': 'ID', 665 'uploadedTo': 'parent' 665 'uploadedTo': 'parent', 666 'menuOrder': 'menu_order ID' 666 667 } 667 668 }, 668 669 669 670 propmap: { 670 'search': 's', 671 'type': 'post_mime_type', 672 'parent': 'post_parent', 673 'perPage': 'posts_per_page' 671 'search': 's', 672 'type': 'post_mime_type', 673 'parent': 'post_parent', 674 'perPage': 'posts_per_page', 675 'menuOrder': 'menu_order' 674 676 }, 675 677 -
trunk/wp-includes/js/media-views.js
r22869 r22882 2899 2899 text: l10n.allMediaItems, 2900 2900 props: { 2901 parent: null 2901 parent: null, 2902 orderby: 'date', 2903 order: 'DESC' 2902 2904 }, 2903 2905 priority: 10 … … 2907 2909 text: l10n.uploadedToThisPost, 2908 2910 props: { 2909 parent: media.view.settings.postId 2911 parent: media.view.settings.postId, 2912 orderby: 'menuOrder', 2913 order: 'ASC' 2910 2914 }, 2911 2915 priority: 20 … … 2922 2926 text: text, 2923 2927 props: { 2924 type: key, 2925 parent: null 2928 type: key, 2929 parent: null, 2930 orderby: 'date', 2931 order: 'DESC' 2926 2932 } 2927 2933 }; … … 2931 2937 text: l10n.allMediaItems, 2932 2938 props: { 2933 type: null, 2934 parent: null 2939 type: null, 2940 parent: null, 2941 orderby: 'date', 2942 order: 'DESC' 2935 2943 }, 2936 2944 priority: 10 … … 2940 2948 text: l10n.uploadedToThisPost, 2941 2949 props: { 2942 type: null, 2943 parent: media.view.settings.postId 2950 type: null, 2951 parent: media.view.settings.postId, 2952 orderby: 'menuOrder', 2953 order: 'ASC' 2944 2954 }, 2945 2955 priority: 20 -
trunk/wp-includes/media.php
r22872 r22882 1255 1255 'urlstream_upload' => true, 1256 1256 ); 1257 1257 1258 1258 // Multi-file uploading doesn't currently work in iOS Safari, 1259 1259 // single-file allows the built-in camera to be used as source for images … … 1328 1328 'date' => strtotime( $attachment->post_date_gmt ) * 1000, 1329 1329 'modified' => strtotime( $attachment->post_modified_gmt ) * 1000, 1330 'menuOrder' => $attachment->menu_order, 1330 1331 'mime' => $attachment->post_mime_type, 1331 1332 'type' => $type,
Note: See TracChangeset
for help on using the changeset viewer.