Changeset 27322
- Timestamp:
- 02/27/2014 11:03:02 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-views.js
r27309 r27322 868 868 * wp.media.controller.CollectionAdd 869 869 * 870 * @static 871 * @param {string} prop The shortcode slug 872 * @param {object} args 873 * @returns {wp.media.controller.Library} 874 */ 875 media.controller.CollectionAdd = function ( prop, args ) { 876 /** 877 * @constructor 878 * @augments wp.media.controller.Library 879 * @augments wp.media.controller.State 880 * @augments Backbone.Model 881 */ 882 return media.controller.Library.extend({ 883 defaults: _.defaults({ 884 id: prop + '-library', 885 filterable: 'uploaded', 886 multiple: 'add', 887 menu: prop, 888 toolbar: prop + '-add', 889 priority: 100, 870 * @constructor 871 * @augments wp.media.controller.Library 872 * @augments wp.media.controller.State 873 * @augments Backbone.Model 874 */ 875 media.controller.CollectionAdd = function (attributes) { 876 var ExtendedLibrary, extended = _.extend( attributes, { 877 defaults: _.defaults( { 878 id: attributes.tag + '-library', 879 title: attributes.title, 880 menu: attributes.tag, 881 toolbar: attributes.tag + '-add', 882 filterable: 'uploaded', 883 multiple: 'add', 884 priority: 100, 890 885 syncSelection: false 891 }, args.defaults || {}, media.controller.Library.prototype.defaults ), 886 }, media.controller.Library.prototype.defaults ), 887 892 888 initialize: function() { 893 889 // If we haven't been provided a `library`, create a `Selection`. 894 890 if ( ! this.get('library') ) { 895 this.set( 'library', media.query({ type: args.type }) );891 this.set( 'library', media.query({ type: this.type }) ); 896 892 } 897 893 media.controller.Library.prototype.initialize.apply( this, arguments ); … … 900 896 activate: function() { 901 897 var library = this.get('library'), 902 edit = this.frame.state( prop + '-edit').get('library');898 edit = this.frame.state( this.tag + '-edit' ).get('library'); 903 899 904 900 if ( this.editLibrary && this.editLibrary !== edit ) { … … 921 917 media.controller.Library.prototype.activate.apply( this, arguments ); 922 918 } 923 }); 919 } ); 920 ExtendedLibrary = media.controller.Library.extend( extended ); 921 922 return new ExtendedLibrary(); 924 923 }; 925 924 … … 931 930 defaults: { 932 931 title: l10n.editGalleryTitle 933 }934 });935 936 // wp.media.controller.GalleryAdd937 // ---------------------------------938 media.controller.GalleryAdd = media.controller.CollectionAdd( 'gallery', {939 type: 'image',940 defaults: {941 title: l10n.addToGalleryTitle942 932 } 943 933 }); … … 955 945 }); 956 946 957 // wp.media.controller.PlaylistAdd958 // ---------------------------------959 media.controller.PlaylistAdd = media.controller.CollectionAdd( 'playlist', {960 type: 'audio',961 defaults: {962 title: l10n.addToPlaylistTitle963 }964 });965 966 947 // wp.media.controller.VideoPlaylistEdit 967 948 // ------------------------------- … … 973 954 title: l10n.editVideoPlaylistTitle, 974 955 dragInfo : false 975 }976 });977 978 // wp.media.controller.VideoPlaylistAdd979 // ---------------------------------980 media.controller.VideoPlaylistAdd = media.controller.CollectionAdd( 'video-playlist', {981 type: 'video',982 defaults: {983 title: l10n.addToVideoPlaylistTitle984 956 } 985 957 }); … … 1811 1783 }), 1812 1784 1813 new media.controller.GalleryAdd(), 1785 new media.controller.CollectionAdd({ 1786 tag: 'gallery', 1787 type: 'image', 1788 title: l10n.addToGalleryTitle 1789 }), 1814 1790 1815 1791 new media.controller.Library({ … … 1834 1810 }), 1835 1811 1836 new media.controller.PlaylistAdd(), 1812 new media.controller.CollectionAdd({ 1813 tag: 'playlist', 1814 type: 'audio', 1815 title: l10n.addToPlaylistTitle 1816 }), 1837 1817 1838 1818 new media.controller.Library({ … … 1857 1837 }), 1858 1838 1859 new media.controller.VideoPlaylistAdd() 1839 new media.controller.CollectionAdd({ 1840 tag: 'video-playlist', 1841 type: 'video', 1842 title: l10n.addToVideoPlaylistTitle 1843 }) 1860 1844 ]); 1861 1845
Note: See TracChangeset
for help on using the changeset viewer.