@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remarkup allows to point a specific image in a Mock set

Summary: One can point to spesific image in a Mock set using {Mxx|yy} syntax

Test Plan: {F35373}

Reviewers: chad, epriestley

Reviewed By: epriestley

CC: aran, Korvin, AnhNhan

Maniphest Tasks: T2710

Differential Revision: https://secure.phabricator.com/D5322

authored by

Lauri-Henrik Jalonen and committed by
epriestley
dcdf2072 30a17c20

+52 -1
+12
src/applications/pholio/remarkup/PholioRemarkupRule.php
··· 21 21 $embed_mock = id(new PholioMockEmbedView()) 22 22 ->setMock($object); 23 23 24 + if (strlen($options)) { 25 + $parser = new PhutilSimpleOptions(); 26 + $opts = $parser->parse(substr($options, 1)); 27 + 28 + if (isset($opts['image'])) { 29 + $images = array_unique( 30 + explode('&', preg_replace('/\s+/', '', $opts['image']))); 31 + 32 + $embed_mock->setImages($images); 33 + } 34 + } 35 + 24 36 return $embed_mock->render(); 25 37 } 26 38
+17 -1
src/applications/pholio/view/PholioMockEmbedView.php
··· 3 3 final class PholioMockEmbedView extends AphrontView { 4 4 5 5 private $mock; 6 + private $images = array(); 6 7 7 8 public function setMock(PholioMock $mock) { 8 9 $this->mock = $mock; 10 + return $this; 11 + } 12 + 13 + public function setImages(array $images) { 14 + $this->images = $images; 9 15 return $this; 10 16 } 11 17 ··· 31 37 ), 32 38 $mock_link); 33 39 40 + $images_to_show = array(); 41 + if (!empty($this->images)) { 42 + $images_to_show = array_intersect_key( 43 + $this->mock->getImages(), array_flip($this->images)); 44 + } 45 + 46 + if (empty($images_to_show)) { 47 + $images_to_show = array_slice($this->mock->getImages(), 0, 4); 48 + } 49 + 34 50 $thumbnails = array(); 35 - foreach (array_slice($this->mock->getImages(), 0, 4) as $image) { 51 + foreach ($images_to_show as $image) { 36 52 $thumbfile = $image->getFile(); 37 53 38 54 $dimensions = PhabricatorImageTransformer::getPreviewDimensions(
+15
src/docs/userguide/remarkup.diviner
··· 425 425 - you can use other Remarkup rules (like **bold**, //italics//, etc.) inside 426 426 table cells. 427 427 428 + = Embedding Pholio mocks = 429 + 430 + You can embed a Pholio mock by using braces to refer to it: 431 + 432 + {M123} # Embed the mock M123 433 + 434 + By default the first four images from the mock set are displayed. This behavior 435 + can be overridden with the **image** option. With the **image** option you can 436 + provide one or more imageIDs to display. 437 + 438 + You can set the image (or images) to display like this: 439 + 440 + {M123, image=12345} 441 + 442 + {M123, image=12345 & 6789}
+1
webroot/rsrc/css/application/pholio/pholio.css
··· 151 151 background-color: #282828; 152 152 padding: 5px; 153 153 color: #fff; 154 + margin: 2px; 154 155 } 155 156 156 157 .pholio-mock-embed-head {
+7
webroot/rsrc/js/application/pholio/behavior-pholio-mock-view.js
··· 674 674 image.desc); 675 675 info.push(desc); 676 676 677 + var embed = JX.$N( 678 + 'div', 679 + {className: 'pholio-image-embedding'}, 680 + JX.$H('Embed this image:<br />{M' + config.mockID + 681 + ', image=' + image.id + '}')); 682 + info.push(embed); 683 + 677 684 // Render image dimensions and visible size. If we have this infomation 678 685 // from the server we can display some of it immediately; otherwise, we need 679 686 // to wait for the image to load so we can read dimension information from