@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.

Paste embeds look super cool

Summary: Make Paste embeds look super cool

Test Plan: {F35387}

Reviewers: epriestley

CC: aran, Korvin, chad, btrahan, AnhNhan

Maniphest Tasks: T1770

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

authored by

Lauri-Henrik Jalonen and committed by
epriestley
1341c8a6 9303bf50

+94
+9
src/__celerity_resource_map__.php
··· 2644 2644 ), 2645 2645 'disk' => '/rsrc/css/application/owners/owners-path-editor.css', 2646 2646 ), 2647 + 'paste-css' => 2648 + array( 2649 + 'uri' => '/res/5081cf13/rsrc/css/application/paste/paste.css', 2650 + 'type' => 'css', 2651 + 'requires' => 2652 + array( 2653 + ), 2654 + 'disk' => '/rsrc/css/application/paste/paste.css', 2655 + ), 2647 2656 'path-typeahead' => 2648 2657 array( 2649 2658 'uri' => '/res/50246fb6/rsrc/js/application/herald/PathTypeahead.js',
+2
src/__phutil_library_map__.php
··· 637 637 'PackageDeleteMail' => 'applications/owners/mail/PackageDeleteMail.php', 638 638 'PackageMail' => 'applications/owners/mail/PackageMail.php', 639 639 'PackageModifyMail' => 'applications/owners/mail/PackageModifyMail.php', 640 + 'PasteEmbedView' => 'applications/paste/view/PasteEmbedView.php', 640 641 'Phabricator404Controller' => 'applications/base/controller/Phabricator404Controller.php', 641 642 'PhabricatorAWSConfigOptions' => 'applications/config/option/PhabricatorAWSConfigOptions.php', 642 643 'PhabricatorAccessLog' => 'infrastructure/PhabricatorAccessLog.php', ··· 2159 2160 'PackageDeleteMail' => 'PackageMail', 2160 2161 'PackageMail' => 'PhabricatorMail', 2161 2162 'PackageModifyMail' => 'PackageMail', 2163 + 'PasteEmbedView' => 'AphrontView', 2162 2164 'Phabricator404Controller' => 'PhabricatorController', 2163 2165 'PhabricatorAWSConfigOptions' => 'PhabricatorApplicationConfigOptions', 2164 2166 'PhabricatorAccessLogConfigOptions' => 'PhabricatorApplicationConfigOptions',
+9
src/applications/paste/remarkup/PhabricatorPasteRemarkupRule.php
··· 16 16 return id(new PhabricatorPasteQuery()) 17 17 ->setViewer($viewer) 18 18 ->withIDs($ids) 19 + ->needContent(true) 19 20 ->execute(); 20 21 21 22 } 22 23 24 + protected function renderObjectEmbed($object, $handle, $options) { 25 + $embed_paste = id(new PasteEmbedView()) 26 + ->setPaste($object) 27 + ->setHandle($handle); 28 + 29 + return $embed_paste->render(); 30 + 31 + } 23 32 }
+54
src/applications/paste/view/PasteEmbedView.php
··· 1 + <?php 2 + 3 + final class PasteEmbedView extends AphrontView { 4 + 5 + private $paste; 6 + private $handle; 7 + 8 + public function setPaste(PhabricatorPaste $paste) { 9 + $this->paste = $paste; 10 + return $this; 11 + } 12 + 13 + public function setHandle(PhabricatorObjectHandle $handle) { 14 + $this->handle = $handle; 15 + return $this; 16 + } 17 + 18 + public function render() { 19 + if (!$this->paste) { 20 + throw new Exception("Call setPaste() before render()!"); 21 + } 22 + 23 + $lines = phutil_split_lines($this->paste->getContent()); 24 + require_celerity_resource('paste-css'); 25 + 26 + $link = phutil_tag( 27 + 'a', 28 + array( 29 + 'href' => '/P'.$this->paste->getID() 30 + ), 31 + $this->handle->getFullName()); 32 + 33 + $head = phutil_tag( 34 + 'div', 35 + array( 36 + 'class' => 'paste-embed-head' 37 + ), 38 + $link); 39 + 40 + $body = phutil_tag( 41 + 'div', 42 + array(), 43 + id(new PhabricatorSourceCodeView()) 44 + ->setLines($lines)); 45 + 46 + return phutil_tag( 47 + 'div', 48 + array( 49 + 'class' => 'paste-embed' 50 + ), 51 + array($head, $body)); 52 + 53 + } 54 + }
+20
webroot/rsrc/css/application/paste/paste.css
··· 1 + /** 2 + * @provides paste-css 3 + */ 4 + 5 + .paste-embed { 6 + display: inline-block; 7 + padding: 5px; 8 + background: #f7f7f7; 9 + } 10 + 11 + .paste-embed-head { 12 + border-bottom: 1px solid #3d3d3d; 13 + padding: 2px; 14 + margin:2px; 15 + } 16 + 17 + .paste-embed-head a { 18 + color: #282828; 19 + font-weight: bold; 20 + }