From 3c1a0b76fac86c9f40222c5bb79fcddb996d1c9e Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 7 Apr 2013 15:58:17 -0700 Subject: [PATCH] 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 --- src/__celerity_resource_map__.php | 80 +++++++++---------- ...hestAuxiliaryFieldDefaultSpecification.php | 27 ++++++- src/docs/userguide/maniphest_custom.diviner | 13 ++- .../css/application/maniphest/task-edit.css | 9 +++ webroot/rsrc/css/core/core.css | 6 ++ 5 files changed, 90 insertions(+), 45 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index ce3904ce0f..01e1f51f2f 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -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', ), )); diff --git a/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php b/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php index af020fcc91..8338c6dc6a 100644 --- a/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php +++ b/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php @@ -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(); } diff --git a/src/docs/userguide/maniphest_custom.diviner b/src/docs/userguide/maniphest_custom.diviner index 47dd7b32ab..c6a262c034 100644 --- a/src/docs/userguide/maniphest_custom.diviner +++ b/src/docs/userguide/maniphest_custom.diviner @@ -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 diff --git a/webroot/rsrc/css/application/maniphest/task-edit.css b/webroot/rsrc/css/application/maniphest/task-edit.css index 7e25c1698e..809b9ecaeb 100644 --- a/webroot/rsrc/css/application/maniphest/task-edit.css +++ b/webroot/rsrc/css/application/maniphest/task-edit.css @@ -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; +} diff --git a/webroot/rsrc/css/core/core.css b/webroot/rsrc/css/core/core.css index 6c3386542c..5a2b8fa35e 100644 --- a/webroot/rsrc/css/core/core.css +++ b/webroot/rsrc/css/core/core.css @@ -130,3 +130,9 @@ img { display: table; clear: both; } + +hr { + height: 1px; + background: #bbbbbb; + border: none; +}