Permalink
Browse files

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
  • Loading branch information...
vrana
vrana committed Oct 5, 2012
1 parent dfe5ae0 commit c4aaa7291b5d2f2ac6ee231d1f308aa06bf98508
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/applications/macro/controller/PhabricatorMacroEditController.php
@@ -38,6 +38,7 @@ public function processRequest() {
$errors = array();
$e_name = true;
+ $file = null;
$request = $this->getRequest();
$user = $request->getUser();
@@ -75,6 +76,18 @@ public function processRequest() {
$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 @@ public function processRequest() {
id(new AphrontFormFileControl())
->setLabel('File')
->setName('file')
+ ->setCaption($caption)
->setError(true))
->appendChild(
id(new AphrontFormSubmitControl())

0 comments on commit c4aaa72

Please sign in to comment.