Publish postbox and post status select updates.

git-svn-id: http://svn.automattic.com/wordpress/trunk@8889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz
2008-09-14 12:58:00 +00:00
parent 059492b3be
commit 203530fe88
11 changed files with 294 additions and 254 deletions

View File

@@ -10,33 +10,41 @@ jQuery(document).ready( function($) {
// hide advanced slug field
jQuery('#pageslugdiv').hide();
jQuery('.edit-timestamp').click(function () {
if (jQuery('#timestampdiv').is(":hidden")) {
jQuery('#curtime').slideUp("normal");
jQuery('#timestampdiv').slideDown("normal");
} else {
jQuery('#timestampdiv').slideUp("normal");
jQuery('#mm').val(jQuery('#hidden_mm').val());
jQuery('#jj').val(jQuery('#hidden_jj').val());
jQuery('#aa').val(jQuery('#hidden_aa').val());
jQuery('#hh').val(jQuery('#hidden_hh').val());
jQuery('#mn').val(jQuery('#hidden_mn').val());
jQuery('#curtime').slideDown("normal");
var stamp = $('#timestamp').html();
$('.edit-timestamp').click(function () {
if ($('#timestampdiv').is(":hidden")) {
$('#timestampdiv').slideDown("normal");
$('.edit-timestamp').hide();
}
return false;
});
jQuery('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
jQuery('#timestampdiv').hide();
var link = jQuery('.timestamp a').clone( true );
jQuery('.timestamp').show().html(
jQuery( '#mm option[value=' + jQuery('#mm').val() + ']' ).text() + ' ' +
jQuery('#jj').val() + ',' +
jQuery('#aa').val() + '@' +
jQuery('#hh').val() + ':' +
jQuery('#mn').val() + ' '
).append( link );
jQuery('#curtime').slideDown("normal");
$('.cancel-timestamp').click(function() {
$('#timestampdiv').slideUp("normal");
$('#mm').val($('#hidden_mm').val());
$('#jj').val($('#hidden_jj').val());
$('#aa').val($('#hidden_aa').val());
$('#hh').val($('#hidden_hh').val());
$('#mn').val($('#hidden_mn').val());
$('#timestamp').html(stamp);
$('.edit-timestamp').show();
return false;
});
$('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
$('#timestampdiv').slideUp("normal");
$('.edit-timestamp').show();
$('#timestamp').html(
$( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
$('#jj').val() + ', ' +
$('#aa').val() + ' @ ' +
$('#hh').val() + ':' +
$('#mn').val() + ' '
);
return false;
});
@@ -61,13 +69,29 @@ jQuery(document).ready( function($) {
return false;
});
jQuery('.edit-post-status').click(function () {
if (jQuery('#post-status-select').is(":hidden")) {
jQuery('#post-status-select').slideDown("normal");
} else {
jQuery('#post-status-select').slideUp("normal");
jQuery('#post-status-display').html(jQuery('#post_status :selected').text());
$('.edit-post-status').click(function() {
if ($('#post-status-select').is(":hidden")) {
$('#post-status-select').slideDown("normal");
$(this).hide();
}
return false;
});
});
$('.save-post-status').click(function() {
$('#post-status-select').slideUp("normal");
$('#post-status-display').html($('#post_status :selected').text());
$('.edit-post-status').show();
return false;
});
$('.cancel-post-status').click(function() {
$('#post-status-select').slideUp("normal");
$('#post_status').val($('#hidden_post_status').val());
$('#post-status-display').html($('#post_status :selected').text());
$('.edit-post-status').show();
return false;
});
});

View File

@@ -154,34 +154,41 @@ jQuery(document).ready( function($) {
return false;
} );
jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();
var stamp = $('#timestamp').html();
jQuery('.edit-timestamp').click(function () {
if (jQuery('#timestampdiv').is(":hidden")) {
jQuery('#curtime').slideUp("normal");
jQuery('#timestampdiv').slideDown("normal");
} else {
jQuery('#timestampdiv').slideUp("normal");
jQuery('#mm').val(jQuery('#hidden_mm').val());
jQuery('#jj').val(jQuery('#hidden_jj').val());
jQuery('#aa').val(jQuery('#hidden_aa').val());
jQuery('#hh').val(jQuery('#hidden_hh').val());
jQuery('#mn').val(jQuery('#hidden_mn').val());
jQuery('#curtime').slideDown("normal");
$('.edit-timestamp').click(function () {
if ($('#timestampdiv').is(":hidden")) {
$('#timestampdiv').slideDown("normal");
$('.edit-timestamp').hide();
}
return false;
});
jQuery('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
jQuery('#timestampdiv').hide();
var link = jQuery('.timestamp a').clone( true );
jQuery('.timestamp').show().html(
jQuery( '#mm option[value=' + jQuery('#mm').val() + ']' ).text() + ' ' +
jQuery('#jj').val() + ',' +
jQuery('#aa').val() + '@' +
jQuery('#hh').val() + ':' +
jQuery('#mn').val() + ' '
).append( link );
jQuery('#curtime').slideDown("normal");
$('.cancel-timestamp').click(function() {
$('#timestampdiv').slideUp("normal");
$('#mm').val($('#hidden_mm').val());
$('#jj').val($('#hidden_jj').val());
$('#aa').val($('#hidden_aa').val());
$('#hh').val($('#hidden_hh').val());
$('#mn').val($('#hidden_mn').val());
$('#timestamp').html(stamp);
$('.edit-timestamp').show();
return false;
});
$('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
$('#timestampdiv').slideUp("normal");
$('.edit-timestamp').show();
$('#timestamp').html(
$( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
$('#jj').val() + ', ' +
$('#aa').val() + ' @ ' +
$('#hh').val() + ':' +
$('#mn').val() + ' '
);
return false;
});
@@ -217,14 +224,29 @@ jQuery(document).ready( function($) {
}
});
jQuery('.edit-post-status').click(function () {
if (jQuery('#post-status-select').is(":hidden")) {
jQuery('#post-status-select').slideDown("normal");
} else {
jQuery('#post-status-select').slideUp("normal");
jQuery('#post-status-display').html(jQuery('#post_status :selected').text());
$('.edit-post-status').click(function() {
if ($('#post-status-select').is(":hidden")) {
$('#post-status-select').slideDown("normal");
$(this).hide();
}
return false;
});
$('.save-post-status').click(function() {
$('#post-status-select').slideUp("normal");
$('#post-status-display').html($('#post_status :selected').text());
$('.edit-post-status').show();
return false;
});
$('.cancel-post-status').click(function() {
$('#post-status-select').slideUp("normal");
$('#post_status').val($('#hidden_post_status').val());
$('#post-status-display').html($('#post_status :selected').text());
$('.edit-post-status').show();
return false;
});
});

View File

@@ -3,7 +3,10 @@
postboxes = {
add_postbox_toggles : function(page) {
$('.postbox h3').before('<a class="togbox">+</a> ');
$('.postbox h3, .postbox a.togbox').click( function() { $($(this).parent().get(0)).toggleClass('closed'); save_postboxes_state(page); } );
$('.postbox h3, .postbox a.togbox').click( function() {
$($(this).parent().get(0)).toggleClass('closed');
postboxes.save_state(page);
});
$('.hide-postbox-tog').click( function() {
var box = jQuery(this).val();
@@ -13,7 +16,7 @@
} else {
jQuery('#' + box).hide();
}
save_postboxes_state(page);
postboxes.save_state(page);
} );
if ( $.browser.msie ) {
@@ -25,7 +28,7 @@
this.init(page);
},
expandSidebar : function( doIt ) {
if ( doIt || $.trim( $( '#side-info-column' ).text() ) ) {
$( '#post-body' ).addClass( 'has-sidebar' );
@@ -42,7 +45,6 @@
items: '> .postbox',
handle: '.hndle',
distance: 2,
containment: '#wpbody-content',
stop: function() {
if ( 'side-sortables' == this.id ) { // doing this with jQuery doesn't work for some reason: make-it-tall gets duplicated
var makeItTall = document.getElementById( 'make-it-tall' );
@@ -69,20 +71,21 @@
postboxes.expandSidebar( true );
}
} );
},
save_state : function(page) {
var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
var hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
$.post(postboxL10n.requestFile, {
action: 'closed-postboxes',
closed: closed,
hidden: hidden,
closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
page: page
});
}
}
};
$(document).ready(function(){postboxes.expandSidebar();});
}(jQuery));
jQuery(document).ready(function(){postboxes.expandSidebar();});
function save_postboxes_state(page) {
var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
var hidden = jQuery('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
jQuery.post(postboxL10n.requestFile, {
action: 'closed-postboxes',
closed: closed,
hidden: hidden,
closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
page: page
});
}