make edit posts column nicer

This commit is contained in:
John Bintz 2009-10-25 20:29:17 -04:00
parent b6888da24c
commit 83dbaebd0c
3 changed files with 35 additions and 4 deletions

View File

@ -346,6 +346,10 @@ class WhatDidTheySayAdmin {
} }
} }
if (strpos($pagenow, 'edit') === 0) {
wp_enqueue_style('wdts-admin', plugin_dir_url(dirname(__FILE__)) . 'css/wdts-admin.css');
}
wp_enqueue_script('scriptaculous-effects'); wp_enqueue_script('scriptaculous-effects');
add_action('wp_head', array(&$this, 'include_editor_javascript')); add_action('wp_head', array(&$this, 'include_editor_javascript'));
@ -407,7 +411,7 @@ class WhatDidTheySayAdmin {
if ($index === false) { $index = count($keys); } if ($index === false) { $index = count($keys); }
array_splice($keys, $index, 0, array('transcripts')); array_splice($keys, $index, 0, array('transcripts'));
array_splice($values, $index, 0, __('Trans')); array_splice($values, $index, 0, __('<span class="wdts-posts-queued-icon">&nbsp;</span> <span class="wdts-posts-approved-icon">&nbsp;</span>'));
return array_combine($keys, $values); return array_combine($keys, $values);
} }
@ -417,10 +421,19 @@ class WhatDidTheySayAdmin {
*/ */
function manage_posts_custom_column($name, $post_id) { function manage_posts_custom_column($name, $post_id) {
if ($name === "transcripts") { if ($name === "transcripts") {
$queued_transcript_object = new WDTSQueuedTranscript($post_id); foreach (array('Queued' => __('Queued', 'what-did-they-say'), 'Approved' => __('Approved', 'what-did-they-say')) as $type => $label) {
$class = "WDTS${type}Transcript";
$transcript_object = new $class($post_id);
$style = strtolower($type);
if (($queued_count = $queued_transcript_object->count()) > 0) { $count = 0;
printf(__('%s queued', 'what-did-they-say'), $queued_count); foreach ($transcript_object->get_transcripts() as $language => $transcript_info) {
if (!empty($transcript_info['transcript'])) { $count++; }
}
if ($count > 0) {
echo "<span title=\"${label}\" class=\"wdts-posts-${style}-icon\">" . $count . '</span>&nbsp;';
}
} }
} }
} }

View File

@ -105,6 +105,24 @@ h3.wdts {
padding: 0.75em; padding: 0.75em;
} }
.widefat .column-transcripts {
padding-top: 8px;
}
.wdts-posts-queued-icon, .wdts-posts-approved-icon {
background: url(../graphics/transcript-icon-background.png) 1px 1px no-repeat;
font-size: 9px;
padding: 2px 6px;
color: white
}
.wdts-posts-queued-icon {
background-color: #c99
}
.wdts-posts-approved-icon {
background-color: #aaa
}
body { body {
overflow-x: hidden overflow-x: hidden
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B