From 5523217fbb2d55f1c3d6ae4cf355178f84a14d5c Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sat, 6 Feb 2016 11:58:26 -0800 Subject: [PATCH] Add a coverImage field to PHUIObjectItemView Summary: Allows setting of an image to a Workboard card. (Hides from regular view, just in case). Test Plan: Fake setting a Pholio Mock image. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D15198 --- resources/celerity/map.php | 10 ++--- src/view/phui/PHUIObjectItemView.php | 39 ++++++++++++++++++- .../css/phui/phui-object-item-list-view.css | 4 ++ .../css/phui/workboards/phui-workcard.css | 6 +++ 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 5f5a9ee47f..077303a539 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'core.pkg.css' => 'c477bd31', + 'core.pkg.css' => 'a7d4cf8f', 'core.pkg.js' => 'ef5e33db', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '2de124c9', @@ -143,7 +143,7 @@ return array( 'rsrc/css/phui/phui-info-view.css' => '6d7c3509', 'rsrc/css/phui/phui-list.css' => '9da2aa00', 'rsrc/css/phui/phui-object-box.css' => '407eaf5a', - 'rsrc/css/phui/phui-object-item-list-view.css' => 'fe594a65', + 'rsrc/css/phui/phui-object-item-list-view.css' => '8f443e8b', 'rsrc/css/phui/phui-pager.css' => 'bea33d23', 'rsrc/css/phui/phui-pinboard-view.css' => '2495140e', 'rsrc/css/phui/phui-profile-menu.css' => 'ab4fcf5f', @@ -155,7 +155,7 @@ return array( 'rsrc/css/phui/phui-timeline-view.css' => '2efceff8', 'rsrc/css/phui/phui-two-column-view.css' => 'c75bfc5b', 'rsrc/css/phui/workboards/phui-workboard.css' => 'b07a5524', - 'rsrc/css/phui/workboards/phui-workcard.css' => 'b4322ca7', + 'rsrc/css/phui/workboards/phui-workcard.css' => 'adf34f58', 'rsrc/css/phui/workboards/phui-workpanel.css' => 'e1bd8d04', 'rsrc/css/sprite-login.css' => '60e8560e', 'rsrc/css/sprite-menu.css' => '9dd65b92', @@ -819,7 +819,7 @@ return array( 'phui-inline-comment-view-css' => '0fdb3667', 'phui-list-view-css' => '9da2aa00', 'phui-object-box-css' => '407eaf5a', - 'phui-object-item-list-view-css' => 'fe594a65', + 'phui-object-item-list-view-css' => '8f443e8b', 'phui-pager-css' => 'bea33d23', 'phui-pinboard-view-css' => '2495140e', 'phui-profile-menu-css' => 'ab4fcf5f', @@ -832,7 +832,7 @@ return array( 'phui-timeline-view-css' => '2efceff8', 'phui-two-column-view-css' => 'c75bfc5b', 'phui-workboard-view-css' => 'b07a5524', - 'phui-workcard-view-css' => 'b4322ca7', + 'phui-workcard-view-css' => 'adf34f58', 'phui-workpanel-view-css' => 'e1bd8d04', 'phuix-action-list-view' => 'b5c256b8', 'phuix-action-view' => '8cf6d262', diff --git a/src/view/phui/PHUIObjectItemView.php b/src/view/phui/PHUIObjectItemView.php index c7a3d074b5..4b56d746a7 100644 --- a/src/view/phui/PHUIObjectItemView.php +++ b/src/view/phui/PHUIObjectItemView.php @@ -27,6 +27,7 @@ final class PHUIObjectItemView extends AphrontTagView { private $countdownNum; private $countdownNoun; private $launchButton; + private $coverImage; const AGE_FRESH = 'fresh'; const AGE_STALE = 'stale'; @@ -150,6 +151,11 @@ final class PHUIObjectItemView extends AphrontTagView { return $this->imageIcon; } + public function setCoverImage($image) { + $this->coverImage = $image; + return $this; + } + public function setState($state) { $this->state = $state; switch ($state) { @@ -720,16 +726,45 @@ final class PHUIObjectItemView extends AphrontTagView { $actions); } - return phutil_tag( + $frame_content = phutil_tag( 'div', array( - 'class' => 'phui-object-item-frame', + 'class' => 'phui-object-item-frame-content', ), array( $actions, $image, $box, )); + + $frame_cover = null; + if ($this->coverImage) { + $cover_image = phutil_tag( + 'img', + array( + 'src' => $this->coverImage, + 'class' => 'phui-object-item-cover-image', + )); + + $frame_cover = phutil_tag( + 'div', + array( + 'class' => 'phui-object-item-frame-cover', + ), + $cover_image); + } + + $frame = phutil_tag( + 'div', + array( + 'class' => 'phui-object-item-frame', + ), + array( + $frame_cover, + $frame_content, + )); + + return $frame; } private function renderStatusIcon($icon, $label) { diff --git a/webroot/rsrc/css/phui/phui-object-item-list-view.css b/webroot/rsrc/css/phui/phui-object-item-list-view.css index 551144673b..81509008c9 100644 --- a/webroot/rsrc/css/phui/phui-object-item-list-view.css +++ b/webroot/rsrc/css/phui/phui-object-item-list-view.css @@ -56,6 +56,10 @@ ul.phui-object-item-list-view { overflow: hidden; } +.phui-object-item-cover-image { + display: none; +} + .phui-object-item-no-bar .phui-object-item-frame { border-width: 1px; } diff --git a/webroot/rsrc/css/phui/workboards/phui-workcard.css b/webroot/rsrc/css/phui/workboards/phui-workcard.css index d0c427da57..dbdee0103a 100644 --- a/webroot/rsrc/css/phui/workboards/phui-workcard.css +++ b/webroot/rsrc/css/phui/workboards/phui-workcard.css @@ -100,6 +100,12 @@ margin-bottom: 8px; } +.phui-workcard .phui-object-item-cover-image { + display: block; + padding: 8px 8px 0 8px; + width: 263px; +} + /* - Draggable Colors --------------------------------------------------------*/