From 72a92d438fb65fc5da712a2aeafe0e8599429e59 Mon Sep 17 00:00:00 2001 From: Lauri-Henrik Jalonen Date: Sun, 20 Jan 2013 09:29:34 -0800 Subject: [PATCH] Pholio tile to home page and mock to show first image Summary: Pholio tile to show up on home page First image is shown at mock page. Test Plan: Pholio app shows up on home page. First image is shown at mock page. Reviewers: epriestley CC: aran, Korvin Maniphest Tasks: T2356 Differential Revision: https://secure.phabricator.com/D4553 --- src/__celerity_resource_map__.php | 9 +++++ src/__phutil_library_map__.php | 2 + .../controller/PholioMockViewController.php | 9 +++-- .../pholio/view/PholioMockImagesView.php | 40 +++++++++++++++++++ .../rsrc/css/application/pholio/pholio.css | 12 ++++++ 5 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 src/applications/pholio/view/PholioMockImagesView.php create mode 100644 webroot/rsrc/css/application/pholio/pholio.css diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 7dde37e9f4..24e7363586 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -3055,6 +3055,15 @@ celerity_register_resource_map(array( ), 'disk' => '/rsrc/css/application/phame/phame.css', ), + 'pholio-css' => + array( + 'uri' => '/res/e454c33f/rsrc/css/application/pholio/pholio.css', + 'type' => 'css', + 'requires' => + array( + ), + 'disk' => '/rsrc/css/application/pholio/pholio.css', + ), 'phriction-document-css' => array( 'uri' => '/res/8d09bd7f/rsrc/css/application/phriction/phriction-document-css.css', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index cdaba398dc..e782b4f2ba 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1363,6 +1363,7 @@ phutil_register_library_map(array( 'PholioMockCommentController' => 'applications/pholio/controller/PholioMockCommentController.php', 'PholioMockEditController' => 'applications/pholio/controller/PholioMockEditController.php', 'PholioMockEditor' => 'applications/pholio/editor/PholioMockEditor.php', + 'PholioMockImagesView' => 'applications/pholio/view/PholioMockImagesView.php', 'PholioMockListController' => 'applications/pholio/controller/PholioMockListController.php', 'PholioMockQuery' => 'applications/pholio/query/PholioMockQuery.php', 'PholioMockViewController' => 'applications/pholio/controller/PholioMockViewController.php', @@ -2731,6 +2732,7 @@ phutil_register_library_map(array( 'PholioMockCommentController' => 'PholioController', 'PholioMockEditController' => 'PholioController', 'PholioMockEditor' => 'PhabricatorApplicationTransactionEditor', + 'PholioMockImagesView' => 'AphrontView', 'PholioMockListController' => 'PholioController', 'PholioMockQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PholioMockViewController' => 'PholioController', diff --git a/src/applications/pholio/controller/PholioMockViewController.php b/src/applications/pholio/controller/PholioMockViewController.php index 826402524c..b15149ac34 100644 --- a/src/applications/pholio/controller/PholioMockViewController.php +++ b/src/applications/pholio/controller/PholioMockViewController.php @@ -60,9 +60,12 @@ final class PholioMockViewController extends PholioController { $actions = $this->buildActionView($mock); $properties = $this->buildPropertyView($mock, $engine, $subscribers); - $carousel = - '

'. - 'Carousel Goes Here

'; + require_celerity_resource('pholio-css'); + + $output = new PholioMockImagesView(); + $output->setMock($mock); + + $carousel = $output->render(); $xaction_view = id(new PhabricatorApplicationTransactionView()) ->setUser($this->getRequest()->getUser()) diff --git a/src/applications/pholio/view/PholioMockImagesView.php b/src/applications/pholio/view/PholioMockImagesView.php new file mode 100644 index 0000000000..47383f5918 --- /dev/null +++ b/src/applications/pholio/view/PholioMockImagesView.php @@ -0,0 +1,40 @@ +mock = $mock; + } + + public function render() { + if (!$this->mock) { + throw new Exception("Call setMock() before render()!"); + } + + $image = id(new PholioImage())->loadOneWhere( + "mockid=%d", + $this->mock->getID()); + + $file = id(new PhabricatorFile())->loadOneWhere( + "phid=%s", + $image->getFilePHID()); + + $image_tag = phutil_render_tag( + 'img', + array( + 'src' => $file->getBestURI(), + 'class' => 'pholio-mock-image', + ), + ''); + + return phutil_render_tag( + 'div', + array( + 'class' => 'pholio-mock-image-container', + ), + $image_tag); + } + +} diff --git a/webroot/rsrc/css/application/pholio/pholio.css b/webroot/rsrc/css/application/pholio/pholio.css new file mode 100644 index 0000000000..38e81f19ed --- /dev/null +++ b/webroot/rsrc/css/application/pholio/pholio.css @@ -0,0 +1,12 @@ +/** + * @provides pholio-css + */ +.pholio-mock-image-container { + background-color: #282828; + text-align: center; +} + +.pholio-mock-image { + margin: 10px 0px; + display: inline-block; +}