Support captions in StandardField

Summary: Support captions, so this can replace the Maniphest version.

Test Plan: See screenshot.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7020
This commit is contained in:
epriestley
2013-09-18 10:12:24 -07:00
parent df8474d778
commit 3f19ac70a5
6 changed files with 19 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ abstract class PhabricatorStandardCustomField
private $fieldConfig; private $fieldConfig;
private $applicationField; private $applicationField;
private $strings; private $strings;
private $caption;
abstract public function getFieldType(); abstract public function getFieldType();
@@ -71,6 +72,15 @@ abstract class PhabricatorStandardCustomField
return $this; return $this;
} }
public function setCaption($caption) {
$this->caption = $caption;
return $this;
}
public function getCaption() {
return $this->caption;
}
public function setFieldDescription($description) { public function setFieldDescription($description) {
$this->fieldDescription = $description; $this->fieldDescription = $description;
return $this; return $this;
@@ -88,6 +98,9 @@ abstract class PhabricatorStandardCustomField
case 'strings': case 'strings':
$this->setStrings($value); $this->setStrings($value);
break; break;
case 'caption':
$this->setCaption($value);
break;
case 'type': case 'type':
// We set this earlier on. // We set this earlier on.
break; break;
@@ -163,6 +176,7 @@ abstract class PhabricatorStandardCustomField
public function renderEditControl() { public function renderEditControl() {
return id(new AphrontFormTextControl()) return id(new AphrontFormTextControl())
->setName($this->getFieldKey()) ->setName($this->getFieldKey())
->setCaption($this->getCaption())
->setValue($this->getFieldValue()) ->setValue($this->getFieldValue())
->setLabel($this->getFieldName()); ->setLabel($this->getFieldName());
} }

View File

@@ -75,6 +75,7 @@ final class PhabricatorStandardCustomFieldBool
public function renderEditControl() { public function renderEditControl() {
return id(new AphrontFormCheckboxControl()) return id(new AphrontFormCheckboxControl())
->setLabel($this->getFieldName()) ->setLabel($this->getFieldName())
->setCaption($this->getCaption())
->addCheckbox( ->addCheckbox(
$this->getFieldKey(), $this->getFieldKey(),
1, 1,

View File

@@ -62,6 +62,7 @@ final class PhabricatorStandardCustomFieldDate
->setLabel($this->getFieldName()) ->setLabel($this->getFieldName())
->setName($this->getFieldKey()) ->setName($this->getFieldKey())
->setUser($this->getViewer()) ->setUser($this->getViewer())
->setCaption($this->getCaption())
->setAllowNull(true); ->setAllowNull(true);
$control->setValue($this->getFieldValue()); $control->setValue($this->getFieldValue());

View File

@@ -11,6 +11,7 @@ final class PhabricatorStandardCustomFieldRemarkup
return id(new PhabricatorRemarkupControl()) return id(new PhabricatorRemarkupControl())
->setLabel($this->getFieldName()) ->setLabel($this->getFieldName())
->setName($this->getFieldKey()) ->setName($this->getFieldKey())
->setCaption($this->getCaption())
->setValue($this->getFieldValue()); ->setValue($this->getFieldValue());
} }

View File

@@ -67,6 +67,7 @@ final class PhabricatorStandardCustomFieldSelect
public function renderEditControl() { public function renderEditControl() {
return id(new AphrontFormSelectControl()) return id(new AphrontFormSelectControl())
->setLabel($this->getFieldName()) ->setLabel($this->getFieldName())
->setCaption($this->getCaption())
->setName($this->getFieldKey()) ->setName($this->getFieldKey())
->setOptions($this->getOptions()); ->setOptions($this->getOptions());
} }

View File

@@ -24,6 +24,7 @@ final class PhabricatorStandardCustomFieldUsers
->setLabel($this->getFieldName()) ->setLabel($this->getFieldName())
->setName($this->getFieldKey()) ->setName($this->getFieldKey())
->setDatasource('/typeahead/common/accounts/') ->setDatasource('/typeahead/common/accounts/')
->setCaption($this->getCaption())
->setValue($handles); ->setValue($handles);
$limit = $this->getFieldConfigValue('limit'); $limit = $this->getFieldConfigValue('limit');