1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Add a custom "Header" Maniphest field type

Summary: Simple alternative to D5448. Adds a "header" type which renders a visual separator.

Test Plan:
{F39507}
{F39508}

Reviewers: jamesr, btrahan, chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D5616
This commit is contained in:
epriestley 2013-04-07 15:58:17 -07:00
parent be586de965
commit 3c1a0b76fa
5 changed files with 90 additions and 45 deletions

View file

@ -2749,7 +2749,7 @@ celerity_register_resource_map(array(
),
'maniphest-task-edit-css' =>
array(
'uri' => '/res/68c7863e/rsrc/css/application/maniphest/task-edit.css',
'uri' => '/res/e9eddd31/rsrc/css/application/maniphest/task-edit.css',
'type' => 'css',
'requires' =>
array(
@ -2911,7 +2911,7 @@ celerity_register_resource_map(array(
),
'phabricator-core-css' =>
array(
'uri' => '/res/040d65c1/rsrc/css/core/core.css',
'uri' => '/res/09a94677/rsrc/css/core/core.css',
'type' => 'css',
'requires' =>
array(
@ -3900,7 +3900,7 @@ celerity_register_resource_map(array(
), array(
'packages' =>
array(
'c0c1da13' =>
'b5f1b8bd' =>
array(
'name' => 'core.pkg.css',
'symbols' =>
@ -3942,7 +3942,7 @@ celerity_register_resource_map(array(
34 => 'phabricator-object-item-list-view-css',
35 => 'global-drag-and-drop-css',
),
'uri' => '/res/pkg/c0c1da13/core.pkg.css',
'uri' => '/res/pkg/b5f1b8bd/core.pkg.css',
'type' => 'css',
),
'd95b69e5' =>
@ -4132,16 +4132,16 @@ celerity_register_resource_map(array(
'reverse' =>
array(
'aphront-attached-file-view-css' => '6b1fccc6',
'aphront-dialog-view-css' => 'c0c1da13',
'aphront-error-view-css' => 'c0c1da13',
'aphront-form-view-css' => 'c0c1da13',
'aphront-list-filter-view-css' => 'c0c1da13',
'aphront-pager-view-css' => 'c0c1da13',
'aphront-panel-view-css' => 'c0c1da13',
'aphront-table-view-css' => 'c0c1da13',
'aphront-tokenizer-control-css' => 'c0c1da13',
'aphront-tooltip-css' => 'c0c1da13',
'aphront-typeahead-control-css' => 'c0c1da13',
'aphront-dialog-view-css' => 'b5f1b8bd',
'aphront-error-view-css' => 'b5f1b8bd',
'aphront-form-view-css' => 'b5f1b8bd',
'aphront-list-filter-view-css' => 'b5f1b8bd',
'aphront-pager-view-css' => 'b5f1b8bd',
'aphront-panel-view-css' => 'b5f1b8bd',
'aphront-table-view-css' => 'b5f1b8bd',
'aphront-tokenizer-control-css' => 'b5f1b8bd',
'aphront-tooltip-css' => 'b5f1b8bd',
'aphront-typeahead-control-css' => 'b5f1b8bd',
'differential-changeset-view-css' => '8aaacd1b',
'differential-core-view-css' => '8aaacd1b',
'differential-inline-comment-editor' => 'e96b08f8',
@ -4155,7 +4155,7 @@ celerity_register_resource_map(array(
'differential-table-of-contents-css' => '8aaacd1b',
'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88',
'global-drag-and-drop-css' => 'c0c1da13',
'global-drag-and-drop-css' => 'b5f1b8bd',
'inline-comment-summary-css' => '8aaacd1b',
'javelin-aphlict' => 'd95b69e5',
'javelin-behavior' => 'a2f94024',
@ -4227,47 +4227,47 @@ celerity_register_resource_map(array(
'javelin-util' => 'a2f94024',
'javelin-vector' => 'a2f94024',
'javelin-workflow' => 'a2f94024',
'lightbox-attachment-css' => 'c0c1da13',
'lightbox-attachment-css' => 'b5f1b8bd',
'maniphest-task-summary-css' => '6b1fccc6',
'maniphest-transaction-detail-css' => '6b1fccc6',
'phabricator-busy' => 'd95b69e5',
'phabricator-content-source-view-css' => '8aaacd1b',
'phabricator-core-buttons-css' => 'c0c1da13',
'phabricator-core-css' => 'c0c1da13',
'phabricator-crumbs-view-css' => 'c0c1da13',
'phabricator-directory-css' => 'c0c1da13',
'phabricator-core-buttons-css' => 'b5f1b8bd',
'phabricator-core-css' => 'b5f1b8bd',
'phabricator-crumbs-view-css' => 'b5f1b8bd',
'phabricator-directory-css' => 'b5f1b8bd',
'phabricator-drag-and-drop-file-upload' => 'e96b08f8',
'phabricator-dropdown-menu' => 'd95b69e5',
'phabricator-file-upload' => 'd95b69e5',
'phabricator-filetree-view-css' => 'c0c1da13',
'phabricator-flag-css' => 'c0c1da13',
'phabricator-form-view-css' => 'c0c1da13',
'phabricator-header-view-css' => 'c0c1da13',
'phabricator-jump-nav' => 'c0c1da13',
'phabricator-filetree-view-css' => 'b5f1b8bd',
'phabricator-flag-css' => 'b5f1b8bd',
'phabricator-form-view-css' => 'b5f1b8bd',
'phabricator-header-view-css' => 'b5f1b8bd',
'phabricator-jump-nav' => 'b5f1b8bd',
'phabricator-keyboard-shortcut' => 'd95b69e5',
'phabricator-keyboard-shortcut-manager' => 'd95b69e5',
'phabricator-main-menu-view' => 'c0c1da13',
'phabricator-main-menu-view' => 'b5f1b8bd',
'phabricator-menu-item' => 'd95b69e5',
'phabricator-nav-view-css' => 'c0c1da13',
'phabricator-nav-view-css' => 'b5f1b8bd',
'phabricator-notification' => 'd95b69e5',
'phabricator-notification-css' => 'c0c1da13',
'phabricator-notification-menu-css' => 'c0c1da13',
'phabricator-object-item-list-view-css' => 'c0c1da13',
'phabricator-notification-css' => 'b5f1b8bd',
'phabricator-notification-menu-css' => 'b5f1b8bd',
'phabricator-object-item-list-view-css' => 'b5f1b8bd',
'phabricator-object-selector-css' => '8aaacd1b',
'phabricator-prefab' => 'd95b69e5',
'phabricator-project-tag-css' => '6b1fccc6',
'phabricator-remarkup-css' => 'c0c1da13',
'phabricator-remarkup-css' => 'b5f1b8bd',
'phabricator-shaped-request' => 'e96b08f8',
'phabricator-side-menu-view-css' => 'c0c1da13',
'phabricator-standard-page-view' => 'c0c1da13',
'phabricator-side-menu-view-css' => 'b5f1b8bd',
'phabricator-standard-page-view' => 'b5f1b8bd',
'phabricator-textareautils' => 'd95b69e5',
'phabricator-tooltip' => 'd95b69e5',
'phabricator-transaction-view-css' => 'c0c1da13',
'phabricator-zindex-css' => 'c0c1da13',
'sprite-apps-large-css' => 'c0c1da13',
'sprite-gradient-css' => 'c0c1da13',
'sprite-icon-css' => 'c0c1da13',
'sprite-menu-css' => 'c0c1da13',
'syntax-highlighting-css' => 'c0c1da13',
'phabricator-transaction-view-css' => 'b5f1b8bd',
'phabricator-zindex-css' => 'b5f1b8bd',
'sprite-apps-large-css' => 'b5f1b8bd',
'sprite-gradient-css' => 'b5f1b8bd',
'sprite-icon-css' => 'b5f1b8bd',
'sprite-menu-css' => 'b5f1b8bd',
'syntax-highlighting-css' => 'b5f1b8bd',
),
));

View file

@ -23,6 +23,7 @@ class ManiphestAuxiliaryFieldDefaultSpecification
const TYPE_REMARKUP = 'remarkup';
const TYPE_USER = 'user';
const TYPE_USERS = 'users';
const TYPE_HEADER = 'header';
public function getFieldType() {
return $this->fieldType;
@ -112,6 +113,9 @@ class ManiphestAuxiliaryFieldDefaultSpecification
$control->setLimit(1);
}
break;
case self::TYPE_HEADER:
$control = new AphrontFormMarkupControl();
break;
default:
$label = $this->getLabel();
throw new ManiphestAuxiliaryFieldTypeException(
@ -140,15 +144,30 @@ class ManiphestAuxiliaryFieldDefaultSpecification
}
$control->setValue($value);
break;
case self::TYPE_HEADER:
$control->setValue(
phutil_tag(
'h2',
array(
'class' => 'maniphest-auxiliary-header',
),
$this->getLabel()));
break;
default:
$control->setValue($this->getValue());
$control->setName('auxiliary['.$this->getAuxiliaryKey().']');
break;
}
$control->setLabel($this->getLabel());
$control->setCaption($this->getCaption());
$control->setError($this->getError());
switch ($type) {
case self::TYPE_HEADER:
break;
default:
$control->setLabel($this->getLabel());
$control->setCaption($this->getCaption());
$control->setError($this->getError());
break;
}
return $control;
}
@ -294,6 +313,8 @@ class ManiphestAuxiliaryFieldDefaultSpecification
case self::TYPE_USER:
case self::TYPE_USERS:
return $this->renderHandleList($this->getValue());
case self::TYPE_HEADER:
return phutil_tag('hr');
}
return parent::renderForDetailView();
}

View file

@ -44,8 +44,17 @@ Each array key must be unique, and is used to organize the internal storage of
the field. These options are available:
- **label**: Display label for the field on the edit and detail interfaces.
- **type**: Field type: one of **int**, **string**, **bool**, **select**,
**remarkup**, **user**, **users**, or **date**.
- **type**: Field type. The supported field types are:
- **int**: An integer, rendered as a text field.
- **string**: A string, rendered as a text field.
- **bool**: A boolean value, rendered as a checkbox.
- **select**: Allows the user to select from several options, rendered
as a dropdown.
- **remarkup**: A text area which allows the user to enter markup.
- **user**: A single user typeahead.
- **users**: A typeahead which allows multiple users to be input.
- **date**: A date/time picker.
- **header**: Renders a visual divider which you can use to group fields.
- **caption**: A caption to display underneath the field (optional).
- **required**: True if the user should be required to provide a value.
- **options**: If type is set to **select**, provide options for the dropdown

View file

@ -7,3 +7,12 @@
margin-bottom: 1em;
font-size: 11px;
}
.maniphest-auxiliary-header {
font-weight: bold;
font-size: 14px;
color: #333333;
border-bottom: 1px solid #999999;
padding: 12px 0 4px;
margin-bottom: 4px;
}

View file

@ -130,3 +130,9 @@ img {
display: table;
clear: both;
}
hr {
height: 1px;
background: #bbbbbb;
border: none;
}