From c4aaa7291b5d2f2ac6ee231d1f308aa06bf98508 Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 4 Oct 2012 18:43:49 -0700 Subject: [PATCH] Display full picture in image macro editing Summary: Users are complaining that they don't see how the image macro looks until they use it. Click leads to edit form. Display it there. Test Plan: Edited macro. Attempted to create macro with duplicate name. Reviewers: epriestley Reviewed By: epriestley CC: chad, aran, Korvin Differential Revision: https://secure.phabricator.com/D3636 --- .../controller/PhabricatorMacroEditController.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/applications/macro/controller/PhabricatorMacroEditController.php b/src/applications/macro/controller/PhabricatorMacroEditController.php index da574536e3..d920b7c19f 100644 --- a/src/applications/macro/controller/PhabricatorMacroEditController.php +++ b/src/applications/macro/controller/PhabricatorMacroEditController.php @@ -38,6 +38,7 @@ final class PhabricatorMacroEditController $errors = array(); $e_name = true; + $file = null; $request = $this->getRequest(); $user = $request->getUser(); @@ -75,6 +76,18 @@ final class PhabricatorMacroEditController $e_name = 'Duplicate'; } } + } else if ($this->id) { + $file = id(new PhabricatorFile()) + ->loadOneWhere('phid = %s', $macro->getFilePHID()); + } + + $caption = null; + if ($file) { + $caption = phutil_render_tag( + 'img', + array( + 'src' => $file->getViewURI(), + )); } if ($errors) { @@ -102,6 +115,7 @@ final class PhabricatorMacroEditController id(new AphrontFormFileControl()) ->setLabel('File') ->setName('file') + ->setCaption($caption) ->setError(true)) ->appendChild( id(new AphrontFormSubmitControl())