wp/wp-admin/js/inline-edit-post.js
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
   126 		$( '#the-list' ).on( 'click', '.editinline', function() {
   126 		$( '#the-list' ).on( 'click', '.editinline', function() {
   127 			$( this ).attr( 'aria-expanded', 'true' );
   127 			$( this ).attr( 'aria-expanded', 'true' );
   128 			inlineEditPost.edit( this );
   128 			inlineEditPost.edit( this );
   129 		});
   129 		});
   130 
   130 
       
   131 		// Clone quick edit categories for the bulk editor.
       
   132 		var beCategories = $( '#inline-edit fieldset.inline-edit-categories' ).clone();
       
   133 
       
   134 		// Make "id" attributes globally unique.
       
   135 		beCategories.find( '*[id]' ).each( function() {
       
   136 			this.id = 'bulk-edit-' + this.id;
       
   137 		});
       
   138 
   131 		$('#bulk-edit').find('fieldset:first').after(
   139 		$('#bulk-edit').find('fieldset:first').after(
   132 			$('#inline-edit fieldset.inline-edit-categories').clone()
   140 			beCategories
   133 		).siblings( 'fieldset:last' ).prepend(
   141 		).siblings( 'fieldset:last' ).prepend(
   134 			$( '#inline-edit .inline-edit-tags-wrap' ).clone()
   142 			$( '#inline-edit .inline-edit-tags-wrap' ).clone()
   135 		);
   143 		);
   136 
   144 
   137 		$('select[name="_status"] option[value="future"]', bulkRow).remove();
   145 		$('select[name="_status"] option[value="future"]', bulkRow).remove();
   138 
   146 
   139 		/**
   147 		/**
   140 		 * Adds onclick events to the apply buttons.
   148 		 * Adds onclick events to the apply buttons.
   141 		 */
   149 		 */
   142 		$('#doaction').on( 'click', function(e){
   150 		$('#doaction').on( 'click', function(e){
   143 			var n;
   151 			var n,
       
   152 				$itemsSelected = $( '#posts-filter .check-column input[type="checkbox"]:checked' );
       
   153 
       
   154 			if ( $itemsSelected.length < 1 ) {
       
   155 				return;
       
   156 			}
   144 
   157 
   145 			t.whichBulkButtonId = $( this ).attr( 'id' );
   158 			t.whichBulkButtonId = $( this ).attr( 'id' );
   146 			n = t.whichBulkButtonId.substr( 2 );
   159 			n = t.whichBulkButtonId.substr( 2 );
   147 
   160 
   148 			if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) {
   161 			if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) {
   240 				// If the number is less than the number of selected posts, then it's indeterminate.
   253 				// If the number is less than the number of selected posts, then it's indeterminate.
   241 				$( this ).prop( 'indeterminate', true );
   254 				$( this ).prop( 'indeterminate', true );
   242 				if ( ! $( this ).parent().find( 'input[name="indeterminate_post_category[]"]' ).length ) {
   255 				if ( ! $( this ).parent().find( 'input[name="indeterminate_post_category[]"]' ).length ) {
   243 					// Get the term label text.
   256 					// Get the term label text.
   244 					var label = $( this ).parent().text();
   257 					var label = $( this ).parent().text();
   245 					// Set indeterminate states for the backend. Add accessible text for indeterminate inputs. 
   258 					// Set indeterminate states for the backend. Add accessible text for indeterminate inputs.
   246 					$( this ).after( '<input type="hidden" name="indeterminate_post_category[]" value="' + $( this ).val() + '">' ).attr( 'aria-label', label.trim() + ': ' + wp.i18n.__( 'Some selected posts have this category' ) );
   259 					$( this ).after( '<input type="hidden" name="indeterminate_post_category[]" value="' + $( this ).val() + '">' ).attr( 'aria-label', label.trim() + ': ' + wp.i18n.__( 'Some selected posts have this category' ) );
   247 				}
   260 				}
   248 			}
   261 			}
   249 		} );
   262 		} );
   250 
   263 
   593 $( function() { inlineEditPost.init(); } );
   606 $( function() { inlineEditPost.init(); } );
   594 
   607 
   595 // Show/hide locks on posts.
   608 // Show/hide locks on posts.
   596 $( function() {
   609 $( function() {
   597 
   610 
   598 	// Set the heartbeat interval to 15 seconds.
   611 	// Set the heartbeat interval to 10 seconds.
   599 	if ( typeof wp !== 'undefined' && wp.heartbeat ) {
   612 	if ( typeof wp !== 'undefined' && wp.heartbeat ) {
   600 		wp.heartbeat.interval( 15 );
   613 		wp.heartbeat.interval( 10 );
   601 	}
   614 	}
   602 }).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) {
   615 }).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) {
   603 	var locked = data['wp-check-locked-posts'] || {};
   616 	var locked = data['wp-check-locked-posts'] || {};
   604 
   617 
   605 	$('#the-list tr').each( function(i, el) {
   618 	$('#the-list tr').each( function(i, el) {