Quick Edit: remove action links, remove row titles, add hint in footer

git-svn-id: http://svn.automattic.com/wordpress/trunk@9162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-10-14 10:33:18 +00:00
parent 9bf42c78c6
commit 0a7871c4ab
6 changed files with 28 additions and 47 deletions

View File

@ -17,6 +17,10 @@
do_action('in_admin_footer', ''); do_action('in_admin_footer', '');
$upgrade = apply_filters( 'update_footer', '' ); $upgrade = apply_filters( 'update_footer', '' );
echo __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>').' | '.__('<a href="http://codex.wordpress.org/">Documentation</a>').' | '.__('<a href="http://wordpress.org/support/forum/4">Feedback</a>').' '.$upgrade; echo __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>').' | '.__('<a href="http://codex.wordpress.org/">Documentation</a>').' | '.__('<a href="http://wordpress.org/support/forum/4">Feedback</a>').' '.$upgrade;
$quick_edit_help = array( 'edit.php', 'edit-pages.php', 'edit-comments.php', 'edit-tags.php', 'categories.php', 'edit-link-categories.php' );
if ( in_array($pagenow, $quick_edit_help) )
echo '<br />' . __('Hint: double-click on a row to open Quick Edit.');
?></p> ?></p>
</div> </div>
<?php do_action('admin_footer', ''); ?> <?php do_action('admin_footer', ''); ?>

View File

@ -123,7 +123,6 @@ function _cat_row( $category, $level, $name_override = false ) {
$edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $name ) . '</a><br />'; $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $name ) . '</a><br />';
$actions = array(); $actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
if ( $default_cat_id != $category->term_id ) if ( $default_cat_id != $category->term_id )
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
$action_count = count($actions); $action_count = count($actions);
@ -207,7 +206,7 @@ function inline_edit_term_row($type) {
$hidden = (array) get_user_option( "manage-$type-columns-hidden" ); ?> $hidden = (array) get_user_option( "manage-$type-columns-hidden" ); ?>
<form method="get" action=""><table style="display: none"><tbody id="inlineedit"> <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
<tr title="<?php _e('Double-click to cancel'); ?>" id="inline-edit" style="display: none"><td colspan="8"> <tr id="inline-edit" style="display: none"><td colspan="8">
<?php <?php
foreach ( $columns as $column_name => $column_display_name ) { foreach ( $columns as $column_name => $column_display_name ) {
@ -292,7 +291,6 @@ function link_cat_row( $category, $name_override = false ) {
$edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />"; $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />";
$actions = array(); $actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
if ( $default_cat_id != $category->term_id ) if ( $default_cat_id != $category->term_id )
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
$action_count = count($actions); $action_count = count($actions);
@ -608,7 +606,6 @@ function _tag_row( $tag, $class = '' ) {
$out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />'; $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />';
$actions = array(); $actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
$action_count = count($actions); $action_count = count($actions);
$i = 0; $i = 0;
@ -896,7 +893,7 @@ function inline_edit_row( $type ) {
$bulk = 0; $bulk = 0;
while ( $bulk < 2 ) { ?> while ( $bulk < 2 ) { ?>
<tr title="<?php _e('Double-click to cancel'); ?>" id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" style="display: none"><td colspan="<?php echo $col_count; ?>"> <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" style="display: none"><td colspan="<?php echo $col_count; ?>">
<?php <?php
foreach($columns as $column_name=>$column_display_name) { foreach($columns as $column_name=>$column_display_name) {
$class = "class=\"$column_name column-$column_name quick-edit-div\""; $class = "class=\"$column_name column-$column_name quick-edit-div\"";
@ -1267,7 +1264,6 @@ function _post_row($a_post, $pending_comments, $mode) {
$actions = array(); $actions = array();
if ( current_user_can('edit_post', $post->ID) ) { if ( current_user_can('edit_post', $post->ID) ) {
$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . attribute_escape(__('Edit this post')) . '">' . __('Edit') . '</a>'; $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . attribute_escape(__('Edit this post')) . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . attribute_escape(__('Edit this post inline')) . '">' . __('Quick Edit') . '</a>';
$actions['delete'] = "<a class='submitdelete' title='" . attribute_escape(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; $actions['delete'] = "<a class='submitdelete' title='" . attribute_escape(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
} }
if ( in_array($post->post_status, array('pending', 'draft')) ) if ( in_array($post->post_status, array('pending', 'draft')) )
@ -1447,7 +1443,6 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
<?php <?php
$actions = array(); $actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
if ( in_array($post->post_status, array('pending', 'draft')) ) if ( in_array($post->post_status, array('pending', 'draft')) )
$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('Preview "%s"'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('Preview "%s"'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
@ -1893,7 +1888,6 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a>'; $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a>';
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>'; $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>'; $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
$actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick Edit') . '</a>';
if ( 'spam' != $the_comment_status ) if ( 'spam' != $the_comment_status )
$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>'; $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';

View File

@ -107,24 +107,25 @@ commentReply = {
addEvents : function(r) { addEvents : function(r) {
r.each(function() { r.each(function() {
$(this).dblclick(function(){ $(this).dblclick(function(){
commentReply.toggle(this); commentReply.toggle_edit(this);
}); });
}); });
}, },
toggle : function(el) { toggle_edit : function(el) {
if ( $(el).css('display') != 'none' ) if ( $(el).css('display') != 'none' ) {
$(el).find('a.vim-q').click(); var id = $(el).attr('id').substr(8);
if (id) this.open(id, '', 'edit');
}
}, },
revert : function() { revert : function() {
if ( $('#the-comment-list #replyrow').length < 1 ) if ( $('#the-comment-list #replyrow').length > 0 ) {
return false; $('#replyrow').fadeOut('fast', function(){
commentReply.close();
$('#replyrow').fadeOut('fast', function(){ });
commentReply.close(); }
});
return false; return false;
}, },
@ -144,7 +145,10 @@ commentReply = {
open : function(id, p, a) { open : function(id, p, a) {
var t = this; var t = this;
t.close();
if ( $('#the-comment-list #replyrow').length > 0 )
t.close();
t.o = '#comment-'+id; t.o = '#comment-'+id;
$('#replyrow td').attr('colspan', $('.widefat tfoot th:visible').length); $('#replyrow td').attr('colspan', $('.widefat tfoot th:visible').length);
@ -314,7 +318,7 @@ $(document).ready(function(){
$('form#comments-form')[0].submit(); $('form#comments-form')[0].submit();
} }
}; };
$.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', 'q', ['e', edit_comment], $.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', ['e', edit_comment],
['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')], ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')],
['shift+d', make_bulk('delete')], ['shift+x', toggle_all]], ['shift+d', make_bulk('delete')], ['shift+x', toggle_all]],
{highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last, {highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,

View File

@ -26,7 +26,6 @@ inlineEditPost = {
// add events // add events
t.rows.dblclick(function() { inlineEditPost.toggle(this); }); t.rows.dblclick(function() { inlineEditPost.toggle(this); });
t.addEvents(t.rows);
$('#bulk-title-div').after( $('#bulk-title-div').after(
$('#inline-edit div.categories').clone(), $('#inline-edit div.categories').clone(),
@ -79,14 +78,6 @@ inlineEditPost = {
$(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el); $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
}, },
addEvents : function(r) {
r.each(function() {
var row = $(this);
$('a.editinline', row).click(function() { inlineEditPost.edit(this); return false; });
row.attr('title', inlineEditL10n.edit);
});
},
setBulk : function() { setBulk : function() {
var te = '', c = ''; var te = '', c = '';
this.revert(); this.revert();
@ -98,7 +89,7 @@ inlineEditPost = {
if ( $(this).attr('checked') ) { if ( $(this).attr('checked') ) {
var id = $(this).val(); var id = $(this).val();
c = c == '' ? ' class="alternate"' : ''; c = c == '' ? ' class="alternate"' : '';
te += '<div'+c+' id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton">X</a>'+$('#inline_'+id+' .post_title').text()+'</div>'; te += '<div'+c+' id="ttle'+id+'"><a id="_'+id+'" title="'+inlineEditL10n.rem_title+'" class="ntdelbutton">X</a>'+$('#inline_'+id+' .post_title').text()+'</div>';
} }
}); });
@ -208,7 +199,6 @@ inlineEditPost = {
row.html($(r).html()).show() row.html($(r).html()).show()
.animate( { backgroundColor: '#CCEEBB' }, 500) .animate( { backgroundColor: '#CCEEBB' }, 500)
.animate( { backgroundColor: '#eefee7' }, 500); .animate( { backgroundColor: '#eefee7' }, 500);
inlineEditPost.addEvents(row);
} else { } else {
$('#edit-'+id+' .quick-edit-save').append('<span class="error">'+inlineEditL10n.error+'</span>'); $('#edit-'+id+' .quick-edit-save').append('<span class="error">'+inlineEditL10n.error+'</span>');
} }

View File

@ -20,7 +20,6 @@ inlineEditTax = {
// add events // add events
t.rows.dblclick(function() { inlineEditTax.toggle(this); }); t.rows.dblclick(function() { inlineEditTax.toggle(this); });
t.addEvents(t.rows);
$('#doaction, #doaction2, #post-query-submit').click(function(e){ $('#doaction, #doaction2, #post-query-submit').click(function(e){
if ( $('form#posts-filter tr.inline-editor').length > 0 ) if ( $('form#posts-filter tr.inline-editor').length > 0 )
@ -34,14 +33,6 @@ inlineEditTax = {
$(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el); $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
}, },
addEvents : function(r) {
r.each(function() {
var row = $(this);
$('a.editinline', row).click(function() { inlineEditTax.edit(this); return false; });
row.attr('title', inlineEditL10n.edit);
});
},
edit : function(id) { edit : function(id) {
var t = this; var t = this;
t.revert(); t.revert();
@ -112,7 +103,6 @@ inlineEditTax = {
row.html($(r).html()).show() row.html($(r).html()).show()
.animate( { backgroundColor: '#CCEEBB' }, 500) .animate( { backgroundColor: '#CCEEBB' }, 500)
.animate( { backgroundColor: '#eefee7' }, 500); .animate( { backgroundColor: '#eefee7' }, 500);
inlineEditTax.addEvents(row);
} else } else
$('#edit-'+id+' .quick-edit-save .error').html(r).show(); $('#edit-'+id+' .quick-edit-save .error').html(r).show();
} else } else

View File

@ -158,7 +158,7 @@ function wp_default_scripts( &$scripts ) {
'good' => __('Medium'), 'good' => __('Medium'),
'strong' => __('Strong') 'strong' => __('Strong')
) ); ) );
$scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'columns', 'settings-box'), '20081007' ); $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'columns', 'settings-box'), '20081014' );
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array( $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
'pending' => __('%i% pending'), // must look like: "# blah blah" 'pending' => __('%i% pending'), // must look like: "# blah blah"
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
@ -244,15 +244,14 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' ); $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' );
$scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081007' ); $scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081014' );
$scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
'edit' => __('Double-click to edit'), 'error' => __('Error while saving the changes.'),
'error' => __('Error while saving the changes.') 'rem_title' => __('Remove from batch edit')
) ); ) );
$scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081007' ); $scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081014' );
$scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
'edit' => __('Double-click to edit'),
'error' => __('Error while saving the changes.') 'error' => __('Error while saving the changes.')
) ); ) );