Add new comment from post edit screen, partial props: garyc40, see #15527
git-svn-id: http://svn.automattic.com/wordpress/trunk@20164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
69447d2e89
commit
52f321913a
|
@ -287,8 +287,9 @@ div.error a {
|
|||
border-color: #c00 !important;
|
||||
}
|
||||
|
||||
.submit {
|
||||
border-color: #DFDFDF;
|
||||
.submit,
|
||||
#commentsdiv #add-new-comment {
|
||||
border-color: #dfdfdf;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
|
|
|
@ -295,8 +295,9 @@ div.error a {
|
|||
border-color: #c00 !important;
|
||||
}
|
||||
|
||||
.submit {
|
||||
border-color: #DFDFDF;
|
||||
.submit,
|
||||
#commentsdiv #add-new-comment {
|
||||
border-color: #dfdfdf;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
|
@ -1533,11 +1534,7 @@ body.press-this ul.category-tabs li.tabs a {
|
|||
}
|
||||
|
||||
div.widgets-sortables,
|
||||
#widgets-left .inactive {
|
||||
background-color: #fcfcfc;
|
||||
border-color: #dfdfdf;
|
||||
}
|
||||
|
||||
#widgets-left .inactive,
|
||||
#available-widgets .widget-holder {
|
||||
background-color: #fcfcfc;
|
||||
border-color: #dfdfdf;
|
||||
|
@ -1664,10 +1661,7 @@ div.widgets-sortables,
|
|||
color: #fff;
|
||||
}
|
||||
|
||||
.list-container {
|
||||
border-color: #DFDFDF;
|
||||
}
|
||||
|
||||
.list-container,
|
||||
.menu-item-handle {
|
||||
border-color: #dfdfdf;
|
||||
}
|
||||
|
|
|
@ -2400,7 +2400,6 @@ table.fixed {
|
|||
width: 80px;
|
||||
}
|
||||
|
||||
#commentsdiv .fixed .column-author,
|
||||
#comments-form .fixed .column-author {
|
||||
width: 20%;
|
||||
}
|
||||
|
@ -2410,28 +2409,49 @@ table.fixed {
|
|||
padding: 0;
|
||||
}
|
||||
|
||||
#commentsdiv.postbox .inside .row-actions {
|
||||
#commentsdiv .inside .row-actions {
|
||||
line-height:18px;
|
||||
}
|
||||
|
||||
#commentsdiv.postbox .inside td {
|
||||
padding:1em 10px;
|
||||
#commentsdiv .inside .column-author {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
#commentsdiv.postbox .inside .column-author {
|
||||
width:33%;
|
||||
#commentsdiv .column-comment p {
|
||||
margin: 0.6em 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#commentsdiv.postbox .inside p {
|
||||
margin:6px 10px 8px;
|
||||
#commentsdiv #replyrow td {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#commentsdiv.postbox .column-comment p {
|
||||
margin:0.6em 0;
|
||||
#commentsdiv p {
|
||||
padding: 8px 10px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#commentsdiv.postbox #replyrow td {
|
||||
padding:0;
|
||||
#commentsdiv #add-new-comment {
|
||||
border-width: 0 0 1px;
|
||||
border-style: none none solid;
|
||||
}
|
||||
|
||||
#commentsdiv .comments-box {
|
||||
border: 0 none;
|
||||
}
|
||||
|
||||
#commentsdiv .comments-box thead th {
|
||||
background: transparent;
|
||||
padding: 0 7px 4px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#commentsdiv .comments-box tr:last-child td {
|
||||
border-bottom: 0 none;
|
||||
}
|
||||
|
||||
#commentsdiv img.waiting {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.sorting-indicator {
|
||||
|
@ -3112,7 +3132,7 @@ div.tabs-panel-inactive {
|
|||
#normal-sortables .postbox #replyrow .submit {
|
||||
float: none;
|
||||
margin: 0;
|
||||
padding: 3px 7px;
|
||||
padding: 0 7px 5px;
|
||||
}
|
||||
|
||||
#side-sortables .submitbox .submit input,
|
||||
|
@ -3126,24 +3146,12 @@ div.tabs-panel-inactive {
|
|||
margin: 11px 0;
|
||||
}
|
||||
|
||||
#side-sortables .comments-box,
|
||||
#normal-sortables .comments-box {
|
||||
border: 0 none;
|
||||
}
|
||||
|
||||
ul.category-tabs,
|
||||
ul.add-menu-item-tabs,
|
||||
ul.wp-tab-bar {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
#side-sortables .comments-box thead th,
|
||||
#normal-sortables .comments-box thead th {
|
||||
background: transparent;
|
||||
padding: 0 7px 4px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
ul.category-tabs li.tabs,
|
||||
ul.add-menu-item-tabs li.tabs,
|
||||
.wp-tab-active {
|
||||
|
@ -3151,10 +3159,6 @@ ul.add-menu-item-tabs li.tabs,
|
|||
border-width: 1px 1px 0;
|
||||
}
|
||||
|
||||
#commentsdiv img.waiting {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
#post-body .category-tabs li.tabs,
|
||||
#post-body .add-menu-item-tabs li.tabs {
|
||||
border-style: solid none solid solid;
|
||||
|
|
|
@ -471,25 +471,30 @@ function post_comment_meta_box_thead($result) {
|
|||
function post_comment_meta_box($post) {
|
||||
global $wpdb, $post_ID;
|
||||
|
||||
$total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID));
|
||||
|
||||
if ( 1 > $total ) {
|
||||
echo '<p>' . __('No comments yet.') . '</p>';
|
||||
return;
|
||||
}
|
||||
|
||||
wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
|
||||
?>
|
||||
<p class="hide-if-no-js" id="add-new-comment"><a href="#commentstatusdiv" onclick="commentReply.addcomment(<?php echo $post_ID; ?>);return false;"><?php _e('Add comment'); ?></a></p>
|
||||
<?php
|
||||
|
||||
$total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID));
|
||||
$wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
|
||||
$wp_list_table->display( true );
|
||||
?>
|
||||
<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /></p>
|
||||
<?php
|
||||
$hidden = get_hidden_meta_boxes('post');
|
||||
if ( ! in_array('commentsdiv', $hidden) ) { ?>
|
||||
<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
|
||||
<?php
|
||||
|
||||
if ( 1 > $total ) {
|
||||
echo '<p id="no-comments">' . __('No comments yet.') . '</p>';
|
||||
} else {
|
||||
$hidden = get_hidden_meta_boxes('post');
|
||||
if ( ! in_array('commentsdiv', $hidden) ) {
|
||||
?>
|
||||
<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<p class="hide-if-no-js hidden" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /></p>
|
||||
<?php
|
||||
|
||||
wp_comment_trashnotice();
|
||||
}
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
|
|||
<div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
|
||||
<?php endif; ?>
|
||||
<div id="replyhead" style="display:none;"><h5><?php _e( 'Reply to Comment' ); ?></h5></div>
|
||||
|
||||
<div id="addhead" style="display:none;"><h5><?php _e('Add new Comment'); ?></h5></div>
|
||||
<div id="edithead" style="display:none;">
|
||||
<div class="inside">
|
||||
<label for="author"><?php _e('Name') ?></label>
|
||||
|
@ -343,6 +343,7 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
|
|||
<p id="replysubmit" class="submit">
|
||||
<a href="#comments-form" class="cancel button-secondary alignleft" tabindex="106"><?php _e('Cancel'); ?></a>
|
||||
<a href="#comments-form" class="save button-primary alignright" tabindex="104">
|
||||
<span id="addbtn" style="display:none;"><?php _e('Add Comment'); ?></span>
|
||||
<span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
|
||||
<span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
|
||||
<img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
|
||||
|
|
|
@ -345,61 +345,72 @@ commentReply = {
|
|||
},
|
||||
|
||||
close : function() {
|
||||
var c;
|
||||
var c, replyrow = $('#replyrow');
|
||||
|
||||
if ( this.cid ) {
|
||||
// replyrow is not showing?
|
||||
if ( replyrow.parent().is('#com-reply') )
|
||||
return;
|
||||
|
||||
if ( this.cid && this.act == 'edit-comment' ) {
|
||||
c = $('#comment-' + this.cid);
|
||||
|
||||
if ( typeof QTags != 'undefined' )
|
||||
QTags.closeAllTags('replycontent');
|
||||
|
||||
if ( this.act == 'edit-comment' )
|
||||
c.fadeIn(300, function(){ c.show() }).css('backgroundColor', '');
|
||||
|
||||
$('#replyrow').hide();
|
||||
$('#com-reply').append( $('#replyrow') );
|
||||
$('#replycontent').val('');
|
||||
$('input', '#edithead').val('');
|
||||
$('.error', '#replysubmit').html('').hide();
|
||||
$('.waiting', '#replysubmit').hide();
|
||||
$('#replycontent').css('height', '');
|
||||
|
||||
this.cid = '';
|
||||
c.fadeIn(300, function(){ c.show() }).css('backgroundColor', '');
|
||||
}
|
||||
|
||||
// reset the Quicktags buttons
|
||||
if ( typeof QTags != 'undefined' )
|
||||
QTags.closeAllTags('replycontent');
|
||||
|
||||
$('#add-new-comment').css('display', '');
|
||||
|
||||
replyrow.hide();
|
||||
$('#com-reply').append( replyrow );
|
||||
$('#replycontent').css('height', '').val('');
|
||||
$('#edithead input').val('');
|
||||
$('.error', replyrow).html('').hide();
|
||||
$('.waiting', replyrow).hide();
|
||||
|
||||
this.cid = '';
|
||||
},
|
||||
|
||||
open : function(id, p, a) {
|
||||
var t = this, editRow, rowData, act, c = $('#comment-' + id), h = c.height(), replyButton;
|
||||
open : function(comment_id, post_id, action) {
|
||||
var t = this, editRow, rowData, act, c = $('#comment-' + comment_id), h = c.height(), replyButton;
|
||||
|
||||
t.close();
|
||||
t.cid = id;
|
||||
t.cid = comment_id;
|
||||
|
||||
editRow = $('#replyrow');
|
||||
rowData = $('#inline-'+id);
|
||||
act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment';
|
||||
rowData = $('#inline-'+comment_id);
|
||||
action = action || 'replyto';
|
||||
act = 'edit' == action ? 'edit' : 'replyto';
|
||||
act = t.act = act + '-comment';
|
||||
|
||||
$('#action', editRow).val(act);
|
||||
$('#comment_post_ID', editRow).val(p);
|
||||
$('#comment_ID', editRow).val(id);
|
||||
$('#comment_post_ID', editRow).val(post_id);
|
||||
$('#comment_ID', editRow).val(comment_id);
|
||||
|
||||
if ( h > 120 )
|
||||
$('#replycontent', editRow).css('height', (35+h) + 'px');
|
||||
|
||||
if ( a == 'edit' ) {
|
||||
if ( action == 'edit' ) {
|
||||
$('#author', editRow).val( $('div.author', rowData).text() );
|
||||
$('#author-email', editRow).val( $('div.author-email', rowData).text() );
|
||||
$('#author-url', editRow).val( $('div.author-url', rowData).text() );
|
||||
$('#status', editRow).val( $('div.comment_status', rowData).text() );
|
||||
$('#replycontent', editRow).val( $('textarea.comment', rowData).val() );
|
||||
$('#edithead, #savebtn', editRow).show();
|
||||
$('#replyhead, #replybtn', editRow).hide();
|
||||
$('#replyhead, #replybtn, #addhead, #addbtn', editRow).hide();
|
||||
|
||||
c.after( editRow ).fadeOut('fast', function(){
|
||||
$('#replyrow').fadeIn(300, function(){ $(this).show() });
|
||||
});
|
||||
} else {
|
||||
replyButton = $('#replybtn', editRow);
|
||||
$('#edithead, #savebtn', editRow).hide();
|
||||
} else if ( action == 'add' ) {
|
||||
$('#addhead, #addbtn', editRow).show();
|
||||
$('#replyhead, #replybtn, #edithead, #editbtn', editRow).hide();
|
||||
$('#the-comment-list').prepend(editRow);
|
||||
$('#replyrow').fadeIn(300);
|
||||
} else {
|
||||
replyButton = $('#replybtn', editRow);
|
||||
$('#edithead, #savebtn, #addhead, #addbtn', editRow).hide();
|
||||
$('#replyhead, #replybtn', editRow).show();
|
||||
c.after(editRow);
|
||||
|
||||
|
@ -442,7 +453,8 @@ commentReply = {
|
|||
$('#replysubmit .waiting').show();
|
||||
|
||||
$('#replyrow input').not(':button').each(function() {
|
||||
post[ $(this).attr('name') ] = $(this).val();
|
||||
var t = $(this);
|
||||
post[ t.attr('name') ] = t.val();
|
||||
});
|
||||
|
||||
post.content = $('#replycontent').val();
|
||||
|
@ -483,6 +495,7 @@ commentReply = {
|
|||
r = r.responses[0];
|
||||
c = r.data;
|
||||
id = '#comment-' + r.id;
|
||||
|
||||
if ( 'edit-comment' == t.act )
|
||||
$(id).remove();
|
||||
|
||||
|
@ -527,6 +540,16 @@ commentReply = {
|
|||
if ( er )
|
||||
$('#replysubmit .error').html(er).show();
|
||||
|
||||
},
|
||||
|
||||
addcomment: function(post_id) {
|
||||
var t = this;
|
||||
|
||||
$('#add-new-comment').fadeOut(200, function(){
|
||||
t.open(0, post_id, 'add');
|
||||
$('table.comments-box').css('display', '');
|
||||
$('#no-comments').remove();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -211,10 +211,11 @@ commentsBox = {
|
|||
if ( commentsBox.st > commentsBox.total )
|
||||
$('#show-comments').hide();
|
||||
else
|
||||
$('#show-comments').html(postL10n.showcomm);
|
||||
$('#show-comments').show().children('a').html(postL10n.showcomm);
|
||||
|
||||
return;
|
||||
} else if ( 1 == r ) {
|
||||
$('#show-comments').parent().html(postL10n.endcomm);
|
||||
$('#show-comments').html(postL10n.endcomm);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1082,7 +1082,7 @@ html[dir="rtl"] .wp-switch-editor {
|
|||
border-top-right-radius: 3px;
|
||||
border-top-left-radius: 3px;
|
||||
padding: 2px 8px 0;
|
||||
min-height: 30px;
|
||||
min-height: 29px;
|
||||
}
|
||||
|
||||
.quicktags-toolbar > div {
|
||||
|
|
Loading…
Reference in New Issue