diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 3226054bca..3c800cff6b 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -2630,7 +2630,7 @@ celerity_register_resource_map(array( ), 'phabricator-property-list-view-css' => array( - 'uri' => '/res/ff5d093d/rsrc/css/layout/phabricator-property-list-view.css', + 'uri' => '/res/a853b8df/rsrc/css/layout/phabricator-property-list-view.css', 'type' => 'css', 'requires' => array( diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 36ed121834..4c866c6cb8 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -956,6 +956,7 @@ phutil_register_library_map(array( 'PhabricatorProjectTransaction' => 'applications/project/storage/PhabricatorProjectTransaction.php', 'PhabricatorProjectTransactionType' => 'applications/project/constants/PhabricatorProjectTransactionType.php', 'PhabricatorProjectUpdateController' => 'applications/project/controller/PhabricatorProjectUpdateController.php', + 'PhabricatorPropertyListExample' => 'applications/uiexample/examples/PhabricatorPropertyListExample.php', 'PhabricatorPropertyListView' => 'view/layout/PhabricatorPropertyListView.php', 'PhabricatorQuery' => 'infrastructure/query/PhabricatorQuery.php', 'PhabricatorRedirectController' => 'applications/base/controller/PhabricatorRedirectController.php', @@ -2102,6 +2103,7 @@ phutil_register_library_map(array( 'PhabricatorProjectTransaction' => 'PhabricatorProjectDAO', 'PhabricatorProjectTransactionType' => 'PhabricatorProjectConstants', 'PhabricatorProjectUpdateController' => 'PhabricatorProjectController', + 'PhabricatorPropertyListExample' => 'PhabricatorUIExample', 'PhabricatorPropertyListView' => 'AphrontView', 'PhabricatorRedirectController' => 'PhabricatorController', 'PhabricatorRefreshCSRFController' => 'PhabricatorAuthController', diff --git a/src/applications/uiexample/examples/PhabricatorPropertyListExample.php b/src/applications/uiexample/examples/PhabricatorPropertyListExample.php new file mode 100644 index 0000000000..e2a7ea37db --- /dev/null +++ b/src/applications/uiexample/examples/PhabricatorPropertyListExample.php @@ -0,0 +1,56 @@ +PhabricatorPropertyListView to render object '. + 'properties.'; + } + + public function renderExample() { + $request = $this->getRequest(); + $user = $request->getUser(); + + $view = new PhabricatorPropertyListView(); + + $view->addProperty( + pht('Color'), + pht('Yellow')); + + $view->addProperty( + pht('Size'), + pht('Mouse')); + + $view->addProperty( + pht('Element'), + pht('Electric')); + + $view->addTextContent( + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '. + 'Quisque rhoncus tempus massa, sit amet faucibus lectus bibendum '. + 'viverra. Nunc tempus tempor quam id iaculis. Maecenas lectus '. + 'velit, aliquam et consequat quis, tincidunt id dolor.'); + + return $view; + } +} diff --git a/src/view/layout/PhabricatorPropertyListView.php b/src/view/layout/PhabricatorPropertyListView.php index b13d8b4700..db7975ca87 100644 --- a/src/view/layout/PhabricatorPropertyListView.php +++ b/src/view/layout/PhabricatorPropertyListView.php @@ -18,13 +18,23 @@ final class PhabricatorPropertyListView extends AphrontView { - private $properties; + private $properties = array(); public function addProperty($key, $value) { $this->properties[$key] = $value; return $this; } + public function addTextContent($content) { + return $this->appendChild( + phutil_render_tag( + 'div', + array( + 'class' => 'phabricator-property-list-text-content', + ), + $content)); + } + public function render() { require_celerity_resource('phabricator-property-list-view-css'); @@ -50,6 +60,16 @@ final class PhabricatorPropertyListView extends AphrontView { ), $this->renderSingleView($items)); + $content = $this->renderChildren(); + if (strlen($content)) { + $content = phutil_render_tag( + 'div', + array( + 'class' => 'phabricator-property-list-content', + ), + $content); + } + return phutil_render_tag( 'div', array( @@ -60,7 +80,8 @@ final class PhabricatorPropertyListView extends AphrontView { // sure the property list is taller than the action list for objects with // few properties but many actions. Otherwise, the action list may // obscure the document content. - '
'); + ''). + $content; } diff --git a/webroot/rsrc/css/layout/phabricator-property-list-view.css b/webroot/rsrc/css/layout/phabricator-property-list-view.css index 5072568b9a..22f3affe7a 100644 --- a/webroot/rsrc/css/layout/phabricator-property-list-view.css +++ b/webroot/rsrc/css/layout/phabricator-property-list-view.css @@ -57,3 +57,12 @@ padding-left: 1.5em; margin-bottom: .5em; } + +.phabricator-property-list-content { + background: #fdfdfd; + border-bottom: 1px solid #dbdbdb; +} + +.phabricator-property-list-text-content { + padding: 12px 18px; +}