1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Pholio inline comment now include a thumbnail and link

Summary: Pholio inline comment now include a thumbnail and link to the Image being commented on

Test Plan: {F36331}

Reviewers: chad, epriestley

Reviewed By: epriestley

CC: aran, Korvin, btrahan

Maniphest Tasks: T2709

Differential Revision: https://secure.phabricator.com/D5375
This commit is contained in:
Lauri-Henrik Jalonen 2013-03-20 05:36:53 -07:00 committed by epriestley
parent b78fb12324
commit 404d514d0e
6 changed files with 85 additions and 3 deletions

View file

@ -3379,7 +3379,7 @@ celerity_register_resource_map(array(
),
'pholio-css' =>
array(
'uri' => '/res/b0947e46/rsrc/css/application/pholio/pholio.css',
'uri' => '/res/b03fae38/rsrc/css/application/pholio/pholio.css',
'type' => 'css',
'requires' =>
array(

View file

@ -1493,6 +1493,7 @@ phutil_register_library_map(array(
'PholioInlineDeleteController' => 'applications/pholio/controller/PholioInlineDeleteController.php',
'PholioInlineEditController' => 'applications/pholio/controller/PholioInlineEditController.php',
'PholioInlineSaveController' => 'applications/pholio/controller/PholioInlineSaveController.php',
'PholioInlineThumbController' => 'applications/pholio/controller/PholioInlineThumbController.php',
'PholioInlineViewController' => 'applications/pholio/controller/PholioInlineViewController.php',
'PholioMock' => 'applications/pholio/storage/PholioMock.php',
'PholioMockCommentController' => 'applications/pholio/controller/PholioMockCommentController.php',
@ -3093,6 +3094,7 @@ phutil_register_library_map(array(
'PholioInlineDeleteController' => 'PholioController',
'PholioInlineEditController' => 'PholioController',
'PholioInlineSaveController' => 'PholioController',
'PholioInlineThumbController' => 'PholioController',
'PholioInlineViewController' => 'PholioController',
'PholioMock' =>
array(

View file

@ -54,7 +54,8 @@ final class PhabricatorApplicationPholio extends PhabricatorApplication {
'save/' => 'PholioInlineSaveController',
'delete/(?P<id>\d+)/' => 'PholioInlineDeleteController',
'view/(?P<id>\d+)/' => 'PholioInlineViewController',
'edit/(?P<id>\d+)/' => 'PholioInlineEditController'
'edit/(?P<id>\d+)/' => 'PholioInlineEditController',
'thumb/(?P<imageid>\d+)/' => 'PholioInlineThumbController'
),
),
);

View file

@ -0,0 +1,40 @@
<?php
/**
* @group pholio
*/
final class PholioInlineThumbController extends PholioController {
private $imageid;
public function willProcessRequest(array $data) {
$this->imageid = idx($data, 'imageid');
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$image = id(new PholioImage())->load($this->imageid);
if ($image == null) {
return new Aphront404Response();
}
$mock = id(new PholioMockQuery())
->setViewer($user)
->withIDs(array($image->getMockID()))
->executeOne();
if (!$mock) {
return new Aphront404Response();
}
$file = id(new PhabricatorFile())->loadOneWhere(
'phid = %s',
$image->getFilePHID());
return id(new AphrontRedirectResponse())->setURI($file->getThumb60x45URI());
}
}

View file

@ -73,11 +73,35 @@ final class PholioTransactionView
if (!$inline->getComment()) {
continue;
}
$out[] = parent::renderTransactionContent($inline);
$out[] = $this->renderInlineContent($inline);
}
}
return $out;
}
private function renderInlineContent(PholioTransaction $inline) {
$comment = $inline->getComment();
$thumb = phutil_tag(
'img',
array(
'src' => '/pholio/inline/thumb/'.$comment->getImageID(),
));
$link = phutil_tag(
'a',
array(
'href' => '#'
),
$thumb);
$inline_comment = hsprintf('<p>%s</p>', $comment->getContent());
return phutil_tag(
'div',
array('class' => 'pholio-transaction-inline-comment'),
array($link, $inline_comment));
}
}

View file

@ -182,3 +182,18 @@
color: #fff;
font-weight: bold;
}
.pholio-transaction-inline-comment {
display: table-row;
}
.pholio-transaction-inline-comment img {
display: table-cell;
padding-bottom: 2px;
}
.pholio-transaction-inline-comment p {
display: table-cell;
vertical-align: middle;
padding-bottom: 2px;
}