don't double-show summary and content

This commit is contained in:
Evan Prodromou 2011-06-20 10:26:24 -04:00
parent d51abd8830
commit 3d8b776dc7
2 changed files with 12 additions and 5 deletions

View File

@ -127,6 +127,12 @@ class Blog_entry extends Managed_DataObject
$be->summary = self::summarize($content); $be->summary = self::summarize($content);
} }
// Don't save an identical summary
if ($be->summary == $be->content) {
$be->summary = null;
}
$url = common_local_url('showblogentry', array('id' => $be->id)); $url = common_local_url('showblogentry', array('id' => $be->id));
if (!array_key_exists('uri', $options)) { if (!array_key_exists('uri', $options)) {

View File

@ -71,10 +71,11 @@ class BlogEntryListItem extends NoticeListItemAdapter
$out->element('a', array('href' => $notice->bestUrl()), $entry->title); $out->element('a', array('href' => $notice->bestUrl()), $entry->title);
$out->elementEnd('h4'); $out->elementEnd('h4');
$out->element('div', 'blog-entry-summary', $entry->summary); if (!empty($entry->summary)) {
$out->element('div', 'blog-entry-summary', $entry->summary);
// XXX: hide content initially; click More... for full text. } else {
// XXX: hide content initially; click More... for full text.
$out->element('div', 'blog-entry-content', $entry->content); $out->element('div', 'blog-entry-content', $entry->content);
}
} }
} }