1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Change repository description from plain text to remarkup

Summary:
At one point this was sort of a one-line summary but it isn't really anymore (and doesn't appear on the list view). We could add a summary in the future if we wanted.

  - Change the control from a text area to a remarkup area.
  - Change the display to remarkup.

Test Plan:
{F44183}
{F44184}

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6034
This commit is contained in:
epriestley 2013-05-24 12:38:44 -07:00
parent c5546a1f15
commit 50bc33fc1c
4 changed files with 56 additions and 7 deletions

View file

@ -135,11 +135,13 @@ final class DiffusionRepositoryController extends DiffusionController {
}
private function buildPropertiesTable(PhabricatorRepository $repository) {
$user = $this->getRequest()->getUser();
$header = id(new PhabricatorHeaderView())
->setHeader($repository->getName());
$view = new PhabricatorPropertyListView();
$view = id(new PhabricatorPropertyListView())
->setUser($user);
$view->addProperty(pht('Callsign'), $repository->getCallsign());
switch ($repository->getVersionControlSystem()) {
@ -158,6 +160,10 @@ final class DiffusionRepositoryController extends DiffusionController {
$description = $repository->getDetail('description');
if (strlen($description)) {
$description = PhabricatorMarkupEngine::renderOneObject(
$repository,
'description',
$user);
$view->addTextContent($description);
}

View file

@ -91,7 +91,7 @@ final class DiffusionRepositoryEditBasicController extends DiffusionController {
->setValue($v_name)
->setError($e_name))
->appendChild(
id(new AphrontFormTextAreaControl())
id(new PhabricatorRemarkupControl())
->setName('description')
->setLabel(pht('Description'))
->setValue($v_desc))

View file

@ -83,8 +83,10 @@ final class DiffusionRepositoryEditController extends DiffusionController {
}
private function buildBasicProperties(PhabricatorRepository $repository) {
$user = $this->getRequest()->getUser();
$view = id(new PhabricatorPropertyListView())
->setUser($this->getRequest()->getUser())
->setUser($user)
->setObject($repository);
$view->addProperty(pht('Name'), $repository->getName());
@ -98,11 +100,16 @@ final class DiffusionRepositoryEditController extends DiffusionController {
$view->addProperty(pht('Callsign'), $repository->getCallsign());
$description = $repository->getDetail('description');
$view->addSectionHeader(pht('Description'));
if (!strlen($description)) {
$description = phutil_tag('em', array(), pht('None'));
$description = phutil_tag('em', array(), pht('No description provided.'));
} else {
$description = PhabricatorMarkupEngine::renderOneObject(
$repository,
'description',
$user);
}
$view->addProperty(pht('Description'), $description);
$view->addTextContent($description);
return $view;
}

View file

@ -4,7 +4,9 @@
* @task uri Repository URI Management
*/
final class PhabricatorRepository extends PhabricatorRepositoryDAO
implements PhabricatorPolicyInterface {
implements
PhabricatorPolicyInterface,
PhabricatorMarkupInterface {
/**
* Shortest hash we'll recognize in raw "a829f32" form.
@ -742,4 +744,38 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
return false;
}
/* -( PhabricatorMarkupInterface )----------------------------------------- */
public function getMarkupFieldKey($field) {
$hash = PhabricatorHash::digestForIndex($this->getMarkupText($field));
return "repo:{$hash}";
}
public function newMarkupEngine($field) {
return PhabricatorMarkupEngine::newMarkupEngine(array());
}
public function getMarkupText($field) {
return $this->getDetail('description');
}
public function didMarkupText(
$field,
$output,
PhutilMarkupEngine $engine) {
require_celerity_resource('phabricator-remarkup-css');
return phutil_tag(
'div',
array(
'class' => 'phabricator-remarkup',
),
$output);
}
public function shouldUseMarkupCache($field) {
return true;
}
}