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

Add one-line feed story.

Summary: It turns out not everything is interesting. This adds a oneline story with less vertical space.

Test Plan: UIExamples

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

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

+120 -49
+1 -1
src/__celerity_resource_map__.php
··· 3830 3830 ), 3831 3831 'phui-feed-story-css' => 3832 3832 array( 3833 - 'uri' => '/res/6afac7dd/rsrc/css/phui/phui-feed-story.css', 3833 + 'uri' => '/res/e5d6825b/rsrc/css/phui/phui-feed-story.css', 3834 3834 'type' => 'css', 3835 3835 'requires' => 3836 3836 array(
+29 -5
src/applications/uiexample/examples/PHUIFeedStoryExample.php
··· 15 15 $request = $this->getRequest(); 16 16 $user = $request->getUser(); 17 17 18 - /* Basic "One Line" Story */ 19 - $text = hsprintf('<strong><a>harding (Tom Harding)</a></strong> closed <a>'. 18 + /* Basic Story */ 19 + $text = hsprintf( 20 + '<strong><a>harding (Tom Harding)</a></strong> closed <a>'. 20 21 'D12: New spacer classes for blog views</a>.'); 21 22 $story1 = id(new PHUIFeedStoryView()) 22 23 ->setTitle($text) ··· 118 119 ->setPontification('If we ever create a lightweight status app '. 119 120 'this story would be how that would be displayed.'); 120 121 122 + /* Basic "One Line" Story */ 123 + $text = hsprintf( 124 + '<strong><a>harding (Tom Harding)</a></strong> updated <a>'. 125 + 'D12: New spacer classes for blog views</a>.'); 126 + $story6 = id(new PHUIFeedStoryView()) 127 + ->setTitle($text) 128 + ->setImage(celerity_get_resource_uri('/rsrc/image/people/harding.png')) 129 + ->setImageHref('http://en.wikipedia.org/wiki/Warren_G._Harding') 130 + ->setEpoch(1) 131 + ->setOneLine(true) 132 + ->setAppIcon('differential-dark') 133 + ->setUser($user); 121 134 122 135 123 - 124 136 $head1 = id(new PhabricatorHeaderView()) 125 - ->setHeader(pht('Basic "one-line" Story')); 137 + ->setHeader(pht('Basic Story')); 126 138 127 139 $head2 = id(new PhabricatorHeaderView()) 128 140 ->setHeader(pht('Title / Text Story')); ··· 136 148 $head5 = id(new PhabricatorHeaderView()) 137 149 ->setHeader(pht('Status Story')); 138 150 151 + $head6 = id(new PhabricatorHeaderView()) 152 + ->setHeader(pht('One Line Story')); 153 + 139 154 $wrap1 = 140 155 array( 141 156 id(new PHUIBoxView()) ··· 171 186 ->addMargin(PHUI::MARGIN_MEDIUM) 172 187 ->addPadding(PHUI::PADDING_SMALL)); 173 188 189 + $wrap6 = 190 + array( 191 + id(new PHUIBoxView()) 192 + ->appendChild($story6) 193 + ->addMargin(PHUI::MARGIN_MEDIUM) 194 + ->addPadding(PHUI::PADDING_SMALL)); 195 + 174 196 return phutil_tag( 175 197 'div', 176 198 array(), ··· 184 206 $head4, 185 207 $wrap4, 186 208 $head5, 187 - $wrap5 209 + $wrap5, 210 + $head6, 211 + $wrap6 188 212 )); 189 213 } 190 214 }
+64 -35
src/view/phui/PHUIFeedStoryView.php
··· 10 10 private $epoch; 11 11 private $viewed; 12 12 private $href; 13 + private $oneline = false; 13 14 private $pontification = null; 14 15 private $tokenBar = array(); 15 16 private $projects = array(); ··· 32 33 33 34 public function setEpoch($epoch) { 34 35 $this->epoch = $epoch; 36 + return $this; 37 + } 38 + 39 + public function setOneLine($oneline) { 40 + $this->oneline = $oneline; 35 41 return $this; 36 42 } 37 43 ··· 80 86 } 81 87 82 88 public function setPontification($text, $title = null) { 89 + $this->setOneLine(false); 83 90 if ($title) { 84 91 $title = phutil_tag('h3', array(), $title); 85 92 } ··· 124 131 125 132 require_celerity_resource('phui-feed-story-css'); 126 133 134 + $body = null; 135 + $foot = null; 136 + $image_style = null; 127 137 $actor = ''; 138 + 128 139 if ($this->image) { 129 140 $actor = new PHUIIconView(); 130 141 $actor->setImage($this->image); ··· 134 145 } 135 146 } 136 147 148 + if ($this->epoch) { 149 + // TODO: This is really bad; when rendering through Conduit and via 150 + // renderText() we don't have a user. 151 + if ($this->user) { 152 + $foot = phabricator_datetime($this->epoch, $this->user); 153 + } else { 154 + $foot = null; 155 + } 156 + } else { 157 + $foot = pht('No time specified.'); 158 + } 159 + 160 + if ($this->chronologicalKey) { 161 + $foot = phutil_tag( 162 + 'a', 163 + array( 164 + 'href' => '/feed/'.$this->chronologicalKey.'/', 165 + ), 166 + $foot); 167 + } 168 + 169 + $icon = null; 170 + if ($this->appIcon) { 171 + $icon = new PHUIIconView(); 172 + $icon->setSpriteIcon($this->appIcon); 173 + $icon->setSpriteSheet(PHUIIconView::SPRITE_APPS); 174 + } 175 + 176 + $ol_foot = null; 177 + if ($this->oneline) { 178 + $ol_foot = phutil_tag( 179 + 'div', 180 + array( 181 + 'class' => 'phui-feed-story-oneline-foot' 182 + ), 183 + array( 184 + $icon, 185 + $foot)); 186 + } 187 + 137 188 $action_list = array(); 138 189 $icons = null; 139 190 foreach ($this->actions as $action) { ··· 161 212 array( 162 213 $actor, 163 214 nonempty($this->title, pht('Untitled Story')), 164 - $icons 215 + $icons, 216 + $ol_foot 165 217 )); 166 218 167 - $body = null; 168 - $foot = null; 169 - $image_style = null; 170 - 171 219 if (!empty($this->tokenBar)) { 172 220 $tokenview = phutil_tag( 173 221 'div', ··· 188 236 $body_content); 189 237 } 190 238 191 - if ($this->epoch) { 192 - // TODO: This is really bad; when rendering through Conduit and via 193 - // renderText() we don't have a user. 194 - if ($this->user) { 195 - $foot = phabricator_datetime($this->epoch, $this->user); 196 - } else { 197 - $foot = null; 198 - } 239 + if ($this->oneline) { 240 + $foot = null; 199 241 } else { 200 - $foot = pht('No time specified.'); 201 - } 202 - 203 - if ($this->chronologicalKey) { 204 242 $foot = phutil_tag( 205 - 'a', 243 + 'div', 206 244 array( 207 - 'href' => '/feed/'.$this->chronologicalKey.'/', 245 + 'class' => 'phui-feed-story-foot', 208 246 ), 209 - $foot); 247 + array( 248 + $icon, 249 + $foot)); 210 250 } 211 251 212 - $icon = null; 213 - if ($this->appIcon) { 214 - $icon = new PHUIIconView(); 215 - $icon->setSpriteIcon($this->appIcon); 216 - $icon->setSpriteSheet(PHUIIconView::SPRITE_APPS); 252 + $classes = array('phui-feed-story'); 253 + if ($this->oneline) { 254 + $classes[] = 'phui-feed-story-oneline'; 217 255 } 218 256 219 - $foot = phutil_tag( 220 - 'div', 221 - array( 222 - 'class' => 'phui-feed-story-foot', 223 - ), 224 - array( 225 - $icon, 226 - $foot)); 227 - 228 257 return id(new PHUIBoxView()) 229 - ->addClass('phui-feed-story') 258 + ->addClass(implode(' ', $classes)) 230 259 ->setShadow(true) 231 260 ->addMargin(PHUI::MARGIN_MEDIUM_BOTTOM) 232 261 ->appendChild(array($head, $body, $foot));
+26 -8
webroot/rsrc/css/phui/phui-feed-story.css
··· 4 4 5 5 .phui-feed-story { 6 6 background: 5px 2px no-repeat; 7 - min-height: 50px; 7 + min-height: 44px; 8 8 background-color: #fff; 9 9 } 10 10 ··· 13 13 height: 35px; 14 14 background-size: 35px; 15 15 float: left; 16 - margin-right: 10px; 16 + margin-right: 8px; 17 17 } 18 18 19 19 .phui-feed-story-head { 20 - padding: 10px; 20 + padding: 8px; 21 21 overflow: hidden; 22 22 color: #333; 23 23 } 24 24 25 25 .phui-feed-story-body { 26 - padding: 0 10px 10px; 26 + padding: 0 8px 8px; 27 27 color: #444444; 28 28 word-break: break-word; 29 29 } ··· 31 31 .phui-feed-story-foot { 32 32 font-size: 11px; 33 33 background: #f7f7f7; 34 - padding: 10px; 34 + padding: 8px; 35 35 line-height: 14px; 36 36 } 37 37 ··· 40 40 color: #777; 41 41 } 42 42 43 - .phui-feed-story-foot .phui-icon-view { 43 + .phui-feed-story-foot .phui-icon-view, 44 + .phui-feed-story-oneline-foot .phui-icon-view { 44 45 float: left; 45 46 display: inline-block; 46 47 margin-right: 5px; ··· 60 61 } 61 62 62 63 .phui-feed-token-bar { 63 - margin-top: 10px; 64 + margin-top: 8px; 64 65 border-top: 1px solid #e7e7e7; 65 - padding-top: 10px; 66 + padding-top: 8px; 66 67 } 67 68 68 69 .phui-feed-token-bar .phui-icon-view { ··· 83 84 .phui-feed-story-action-list .phui-icon-view { 84 85 display: block; 85 86 } 87 + 88 + .phui-feed-story-oneline .phui-feed-story-head { 89 + padding: 4px; 90 + } 91 + 92 + .phui-feed-story-oneline .phui-feed-story-body { 93 + padding: 0; 94 + } 95 + 96 + .phui-feed-story-oneline-foot, 97 + .phui-feed-story-oneline-foot a { 98 + font-size: 11px; 99 + color: #777; 100 + margin-top: 2px; 101 + line-height: 14px; 102 + } 103 +