1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 14:51:06 +01:00

Show PhamePost and PhameBlog content/descriptions on detail pages

Summary: Currently the new detail pages don't show this information. Show it, and use the remarkup cache for BLAZING OODLES OF PERFOARMSNECES!!~~~

Test Plan: See screenshots.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1373

Differential Revision: https://secure.phabricator.com/D3700
This commit is contained in:
epriestley 2012-10-15 14:51:04 -07:00
parent 5fbb46df1c
commit 1ecbf23e1e
4 changed files with 91 additions and 2 deletions

View file

@ -107,6 +107,16 @@ final class PhameBlogViewController extends PhameController {
pht('Joinable By'),
$descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
$engine = id(new PhabricatorMarkupEngine())
->setViewer($user)
->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)
->process();
$properties->addTextContent(
'<div class="phabricator-remarkup">'.
$engine->getOutput($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION).
'</div>');
return $properties;
}

View file

@ -181,6 +181,16 @@ final class PhamePostViewController extends PhameController {
? pht('Draft')
: phabricator_datetime($post->getDatePublished(), $user));
$engine = id(new PhabricatorMarkupEngine())
->setViewer($user)
->addObject($post, PhamePost::MARKUP_FIELD_BODY)
->process();
$properties->addTextContent(
'<div class="phabricator-remarkup">'.
$engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY).
'</div>');
return $properties;
}
}

View file

@ -19,7 +19,11 @@
/**
* @group phame
*/
final class PhameBlog extends PhameDAO implements PhabricatorPolicyInterface {
final class PhameBlog extends PhameDAO
implements PhabricatorPolicyInterface, PhabricatorMarkupInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:description';
const SKIN_DEFAULT = 'PhabricatorBlogSkin';
@ -259,4 +263,35 @@ final class PhameBlog extends PhameDAO implements PhabricatorPolicyInterface {
return false;
}
/* -( PhabricatorMarkupInterface Implementation )-------------------------- */
public function getMarkupFieldKey($field) {
$hash = PhabricatorHash::digest($this->getMarkupText($field));
return $this->getPHID().':'.$field.':'.$hash;
}
public function newMarkupEngine($field) {
return PhabricatorMarkupEngine::newPhameMarkupEngine();
}
public function getMarkupText($field) {
return $this->getDescription();
}
public function didMarkupText(
$field,
$output,
PhutilMarkupEngine $engine) {
return $output;
}
public function shouldUseMarkupCache($field) {
return (bool)$this->getPHID();
}
}

View file

@ -19,7 +19,10 @@
/**
* @group phame
*/
final class PhamePost extends PhameDAO implements PhabricatorPolicyInterface {
final class PhamePost extends PhameDAO
implements PhabricatorPolicyInterface, PhabricatorMarkupInterface {
const MARKUP_FIELD_BODY = 'markup:body';
const VISIBILITY_DRAFT = 0;
const VISIBILITY_PUBLISHED = 1;
@ -174,4 +177,35 @@ final class PhamePost extends PhameDAO implements PhabricatorPolicyInterface {
}
}
/* -( PhabricatorMarkupInterface Implementation )-------------------------- */
public function getMarkupFieldKey($field) {
return $this->getPHID().':'.$field;
}
public function newMarkupEngine($field) {
return PhabricatorMarkupEngine::newPhameMarkupEngine();
}
public function getMarkupText($field) {
return $this->getBody();
}
public function didMarkupText(
$field,
$output,
PhutilMarkupEngine $engine) {
return $output;
}
public function shouldUseMarkupCache($field) {
return (bool)$this->getPHID();
}
}