Changeset 22157
- Timestamp:
- 10/10/2012 09:30:22 AM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-views.js
r22155 r22157 43 43 this.add( 'library', media.view.Workspace.Library, { 44 44 collection: media.query( this.get('library') ) 45 } 45 }); 46 46 this.unset('library'); 47 47 48 48 // Add the gallery view. 49 this.add( 'gallery', media.view.Workspace.Gallery, { collection: this.selection } ); 49 this.add( 'gallery', media.view.Workspace.Gallery, { 50 collection: this.selection 51 }); 52 this.add( 'gallery-library', media.view.Workspace.Library.Gallery, { 53 collection: media.query({ type: 'image' }) 54 }); 50 55 }, 51 56 … … 720 725 }); 721 726 727 media.view.Workspace.Library.Gallery = media.view.Workspace.Library.extend({ 728 initToolbarView: function() { 729 var controller = this.controller, 730 editing = controller.get('editing'), 731 items = { 732 'selection-preview': new media.view.SelectionPreview({ 733 controller: this.controller, 734 collection: this.controller.selection, 735 priority: -40, 736 clearable: false 737 }), 738 739 'continue-editing-gallery': { 740 style: 'primary', 741 text: l10n.continueEditingGallery, 742 priority: 40, 743 744 click: function() { 745 controller.render( 'gallery' ); 746 } 747 } 748 }; 749 750 this.toolbarView = new media.view.Toolbar({ 751 items: items 752 }); 753 754 this.$el.addClass('with-toolbar'); 755 this.$content.append( this.toolbarView.$el ); 756 } 757 }); 758 722 759 /** 723 760 * wp.media.view.Workspace.Gallery … … 751 788 }, 752 789 753 'add-images-from-library': { 754 text: l10n.addImagesFromLibrary, 755 priority: 30 790 'return-to-library': { 791 text: editing ? l10n.addImagesFromLibrary : l10n.returnToLibrary, 792 priority: -40, 793 794 click: function() { 795 controller.render( editing ? 'gallery-library' : 'library' ); 796 } 756 797 } 757 798 }; 758 759 if ( ! editing ) {760 items['return-to-library'] = {761 text: l10n.returnToLibrary,762 priority: -40,763 764 click: function() {765 controller.render('library');766 }767 };768 }769 799 770 800 this.toolbarView = new media.view.Toolbar({ … … 949 979 950 980 initialize: function() { 981 _.defaults( this.options, { 982 clearable: true 983 }); 984 951 985 this.controller = this.options.controller; 952 986 this.collection.on( 'add change:url remove', this.render, this ); … … 955 989 956 990 render: function() { 957 var options = {},991 var options = _.clone( this.options ), 958 992 first, sizes, amount; 959 993 -
trunk/wp-includes/media.php
r22154 r22157 1359 1359 <span class="count"><%- count %></span> 1360 1360 </div> 1361 <a class="clear-selection" href="#"><?php _e('Clear selection'); ?></a> 1361 <% if ( clearable ) { %> 1362 <a class="clear-selection" href="#"><?php _e('Clear selection'); ?></a> 1363 <% } %> 1362 1364 </script> 1363 1365 -
trunk/wp-includes/script-loader.php
r22155 r22157 329 329 330 330 // Gallery 331 'returnToLibrary' => __( 'Return to media library' ), 332 'insertGalleryIntoPost' => __( 'Insert gallery into post' ), 333 'updateGallery' => __( 'Update gallery' ), 334 'addImagesFromLibrary' => __( 'Add images from media library' ), 331 'returnToLibrary' => __( 'Return to media library' ), 332 'continueEditingGallery' => __( 'Continue editing gallery' ), 333 'insertGalleryIntoPost' => __( 'Insert gallery into post' ), 334 'updateGallery' => __( 'Update gallery' ), 335 'addImagesFromLibrary' => __( 'Add images from media library' ), 335 336 ) ); 336 337
Note: See TracChangeset
for help on using the changeset viewer.