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

[Redesign] PHUIPagerView

Summary: Ref T8099, Moves AphrontPagerView to PHUIPagerView, converts to standard PHUIButtons and adds some additional features for icon placement on buttons.

Test Plan: Tested Advanced Search and Searching files in Diffusion. Works as expected.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8342, T8099

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

+100 -99
+6 -6
resources/celerity/map.php
··· 7 7 */ 8 8 return array( 9 9 'names' => array( 10 - 'core.pkg.css' => '63bd9495', 10 + 'core.pkg.css' => 'd9223b5d', 11 11 'core.pkg.js' => 'fbf1d615', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 13 'differential.pkg.css' => 'f89b49b6', ··· 23 23 'rsrc/css/aphront/list-filter-view.css' => 'aa5ffcb9', 24 24 'rsrc/css/aphront/multi-column.css' => 'fd18389d', 25 25 'rsrc/css/aphront/notification.css' => '9c279160', 26 - 'rsrc/css/aphront/pager-view.css' => '2e3539af', 27 26 'rsrc/css/aphront/panel-view.css' => '8427b78d', 28 27 'rsrc/css/aphront/phabricator-nav-view.css' => '0ecd30a1', 29 28 'rsrc/css/aphront/table-view.css' => '4f2ed0bf', ··· 126 125 'rsrc/css/phui/phui-action-list.css' => '32c388b3', 127 126 'rsrc/css/phui/phui-action-panel.css' => '3ee9afd5', 128 127 'rsrc/css/phui/phui-box.css' => 'a5bb366d', 129 - 'rsrc/css/phui/phui-button.css' => 'b995182d', 128 + 'rsrc/css/phui/phui-button.css' => '0d395b42', 130 129 'rsrc/css/phui/phui-crumbs-view.css' => 'ce840ec2', 131 130 'rsrc/css/phui/phui-document.css' => '08f33f08', 132 131 'rsrc/css/phui/phui-feed-story.css' => '153a2ebf', ··· 141 140 'rsrc/css/phui/phui-list.css' => 'e448b6ba', 142 141 'rsrc/css/phui/phui-object-box.css' => '6f449f57', 143 142 'rsrc/css/phui/phui-object-item-list-view.css' => '29ded459', 143 + 'rsrc/css/phui/phui-pager.css' => 'bea33d23', 144 144 'rsrc/css/phui/phui-pinboard-view.css' => '2495140e', 145 145 'rsrc/css/phui/phui-property-list-view.css' => '1baf23eb', 146 146 'rsrc/css/phui/phui-remarkup-preview.css' => '19ad512b', ··· 480 480 'aphront-dialog-view-css' => '8ea1b9cc', 481 481 'aphront-list-filter-view-css' => 'aa5ffcb9', 482 482 'aphront-multi-column-view-css' => 'fd18389d', 483 - 'aphront-pager-view-css' => '2e3539af', 484 483 'aphront-panel-view-css' => '8427b78d', 485 484 'aphront-table-view-css' => '4f2ed0bf', 486 485 'aphront-tokenizer-control-css' => '04875312', ··· 755 754 'phriction-document-css' => 'd1861e06', 756 755 'phui-action-panel-css' => '3ee9afd5', 757 756 'phui-box-css' => 'a5bb366d', 758 - 'phui-button-css' => 'b995182d', 757 + 'phui-button-css' => '0d395b42', 759 758 'phui-calendar-css' => 'ccabe893', 760 759 'phui-calendar-day-css' => 'd1cf6f93', 761 760 'phui-calendar-list-css' => 'c1c7f338', ··· 776 775 'phui-list-view-css' => 'e448b6ba', 777 776 'phui-object-box-css' => '6f449f57', 778 777 'phui-object-item-list-view-css' => '29ded459', 778 + 'phui-pager-css' => 'bea33d23', 779 779 'phui-pinboard-view-css' => '2495140e', 780 780 'phui-property-list-view-css' => '1baf23eb', 781 781 'phui-remarkup-preview-css' => '19ad512b', ··· 2041 2041 'aphront-list-filter-view-css', 2042 2042 'phabricator-remarkup-css', 2043 2043 'syntax-highlighting-css', 2044 - 'aphront-pager-view-css', 2044 + 'phui-pager-css', 2045 2045 'aphront-tooltip-css', 2046 2046 'phabricator-flag-css', 2047 2047 'phui-info-view-css',
+1 -1
resources/celerity/packages.php
··· 96 96 97 97 'phabricator-remarkup-css', 98 98 'syntax-highlighting-css', 99 - 'aphront-pager-view-css', 99 + 'phui-pager-css', 100 100 'aphront-tooltip-css', 101 101 'phabricator-flag-css', 102 102 'phui-info-view-css',
+2 -2
src/__phutil_library_map__.php
··· 148 148 'AphrontNullView' => 'view/AphrontNullView.php', 149 149 'AphrontPHPHTTPSink' => 'aphront/sink/AphrontPHPHTTPSink.php', 150 150 'AphrontPageView' => 'view/page/AphrontPageView.php', 151 - 'AphrontPagerView' => 'view/control/AphrontPagerView.php', 152 151 'AphrontPlainTextResponse' => 'aphront/response/AphrontPlainTextResponse.php', 153 152 'AphrontProgressBarView' => 'view/widget/bars/AphrontProgressBarView.php', 154 153 'AphrontProxyResponse' => 'aphront/response/AphrontProxyResponse.php', ··· 1210 1209 'PHUIObjectItemListView' => 'view/phui/PHUIObjectItemListView.php', 1211 1210 'PHUIObjectItemView' => 'view/phui/PHUIObjectItemView.php', 1212 1211 'PHUIPagedFormView' => 'view/form/PHUIPagedFormView.php', 1212 + 'PHUIPagerView' => 'view/phui/PHUIPagerView.php', 1213 1213 'PHUIPinboardItemView' => 'view/phui/PHUIPinboardItemView.php', 1214 1214 'PHUIPinboardView' => 'view/phui/PHUIPinboardView.php', 1215 1215 'PHUIPropertyGroupView' => 'view/phui/PHUIPropertyGroupView.php', ··· 3395 3395 'AphrontNullView' => 'AphrontView', 3396 3396 'AphrontPHPHTTPSink' => 'AphrontHTTPSink', 3397 3397 'AphrontPageView' => 'AphrontView', 3398 - 'AphrontPagerView' => 'AphrontView', 3399 3398 'AphrontPlainTextResponse' => 'AphrontResponse', 3400 3399 'AphrontProgressBarView' => 'AphrontBarView', 3401 3400 'AphrontProxyResponse' => 'AphrontResponse', ··· 4535 4534 'PHUIObjectItemListView' => 'AphrontTagView', 4536 4535 'PHUIObjectItemView' => 'AphrontTagView', 4537 4536 'PHUIPagedFormView' => 'AphrontView', 4537 + 'PHUIPagerView' => 'AphrontView', 4538 4538 'PHUIPinboardItemView' => 'AphrontView', 4539 4539 'PHUIPinboardView' => 'AphrontView', 4540 4540 'PHUIPropertyGroupView' => 'AphrontTagView',
+1 -1
src/applications/diffusion/controller/DiffusionBranchTableController.php
··· 12 12 13 13 $repository = $drequest->getRepository(); 14 14 15 - $pager = new AphrontPagerView(); 15 + $pager = new PHUIPagerView(); 16 16 $pager->setURI($request->getRequestURI(), 'offset'); 17 17 $pager->setOffset($request->getInt('offset')); 18 18
+1 -1
src/applications/diffusion/controller/DiffusionBrowseSearchController.php
··· 47 47 48 48 $limit = 100; 49 49 $page = $this->getRequest()->getInt('page', 0); 50 - $pager = new AphrontPagerView(); 50 + $pager = new PHUIPagerView(); 51 51 $pager->setPageSize($limit); 52 52 $pager->setOffset($page); 53 53 $pager->setURI($this->getRequest()->getRequestURI(), 'page');
+1 -1
src/applications/diffusion/controller/DiffusionHistoryController.php
··· 32 32 $history = DiffusionPathChange::newFromConduit( 33 33 $history_results['pathChanges']); 34 34 35 - $pager = new AphrontPagerView(); 35 + $pager = new PHUIPagerView(); 36 36 $pager->setPageSize($page_size); 37 37 $pager->setOffset($offset); 38 38 $history = $pager->sliceResults($history);
+1 -1
src/applications/diffusion/controller/DiffusionLintDetailsController.php
··· 66 66 67 67 $content = array(); 68 68 69 - $pager = id(new AphrontPagerView()) 69 + $pager = id(new PHUIPagerView()) 70 70 ->setPageSize($limit) 71 71 ->setOffset($offset) 72 72 ->setHasMorePages(count($messages) >= $limit)
+1 -1
src/applications/diffusion/controller/DiffusionTagListController.php
··· 12 12 13 13 $repository = $drequest->getRepository(); 14 14 15 - $pager = new AphrontPagerView(); 15 + $pager = new PHUIPagerView(); 16 16 $pager->setURI($request->getRequestURI(), 'offset'); 17 17 $pager->setOffset($request->getInt('offset')); 18 18
+1 -1
src/applications/drydock/controller/DrydockBlueprintViewController.php
··· 44 44 ->render(); 45 45 $resource_list->setNoDataString(pht('This blueprint has no resources.')); 46 46 47 - $pager = new AphrontPagerView(); 47 + $pager = new PHUIPagerView(); 48 48 $pager->setURI(new PhutilURI($blueprint_uri), 'offset'); 49 49 $pager->setOffset($request->getInt('offset')); 50 50
+1 -1
src/applications/drydock/controller/DrydockLeaseViewController.php
··· 30 30 $actions = $this->buildActionListView($lease); 31 31 $properties = $this->buildPropertyListView($lease, $actions); 32 32 33 - $pager = new AphrontPagerView(); 33 + $pager = new PHUIPagerView(); 34 34 $pager->setURI(new PhutilURI($lease_uri), 'offset'); 35 35 $pager->setOffset($request->getInt('offset')); 36 36
+1 -1
src/applications/drydock/controller/DrydockResourceViewController.php
··· 42 42 ->render(); 43 43 $lease_list->setNoDataString(pht('This resource has no leases.')); 44 44 45 - $pager = new AphrontPagerView(); 45 + $pager = new PHUIPagerView(); 46 46 $pager->setURI(new PhutilURI($resource_uri), 'offset'); 47 47 $pager->setOffset($request->getInt('offset')); 48 48
+1 -1
src/applications/phame/controller/blog/PhameBlogListController.php
··· 29 29 throw new Exception(pht("Unknown filter '%s'!", $filter)); 30 30 } 31 31 32 - $pager = id(new AphrontPagerView()) 32 + $pager = id(new PHUIPagerView()) 33 33 ->setURI($request->getRequestURI(), 'offset') 34 34 ->setOffset($request->getInt('offset')); 35 35
+1 -1
src/applications/phriction/controller/PhrictionHistoryController.php
··· 29 29 30 30 $current = $document->getContent(); 31 31 32 - $pager = new AphrontPagerView(); 32 + $pager = new PHUIPagerView(); 33 33 $pager->setOffset($request->getInt('page')); 34 34 $pager->setURI($request->getRequestURI(), 'page'); 35 35
+1 -1
src/applications/search/engine/PhabricatorApplicationSearchEngine.php
··· 739 739 740 740 public function newPagerForSavedQuery(PhabricatorSavedQuery $saved) { 741 741 if ($this->shouldUseOffsetPaging()) { 742 - $pager = new AphrontPagerView(); 742 + $pager = new PHUIPagerView(); 743 743 } else { 744 744 $pager = new AphrontCursorPagerView(); 745 745 }
+1 -1
src/applications/tokens/controller/PhabricatorTokenLeaderController.php
··· 11 11 $request = $this->getRequest(); 12 12 $user = $request->getUser(); 13 13 14 - $pager = new AphrontPagerView(); 14 + $pager = new PHUIPagerView(); 15 15 $pager->setURI($request->getRequestURI(), 'page'); 16 16 $pager->setOffset($request->getInt('page')); 17 17
+5 -5
src/applications/uiexample/examples/PhabricatorPagerUIExample.php
··· 10 10 return pht( 11 11 'Use %s to create a control which allows '. 12 12 'users to paginate through large amounts of content.', 13 - phutil_tag('tt', array(), 'AphrontPagerView')); 13 + phutil_tag('tt', array(), 'PHUIPagerView')); 14 14 } 15 15 16 16 public function renderExample() { ··· 40 40 '<p class="phabricator-ui-example-note">%s</p>', 41 41 pht( 42 42 'Use %s to render a pager element.', 43 - phutil_tag('tt', array(), 'AphrontPagerView')))); 43 + phutil_tag('tt', array(), 'PHUIPagerView')))); 44 44 45 - $pager = new AphrontPagerView(); 45 + $pager = new PHUIPagerView(); 46 46 $pager->setPageSize($page_size); 47 47 $pager->setOffset($offset); 48 48 $pager->setCount($item_count); ··· 53 53 '<p class="phabricator-ui-example-note">%s</p>', 54 54 pht('You can show more or fewer pages of surrounding context.'))); 55 55 56 - $many_pages_pager = new AphrontPagerView(); 56 + $many_pages_pager = new PHUIPagerView(); 57 57 $many_pages_pager->setPageSize($page_size); 58 58 $many_pages_pager->setOffset($offset); 59 59 $many_pages_pager->setCount($item_count); ··· 69 69 '%s if it exists, creating an inexact pager.', 70 70 phutil_tag('tt', array(), 'hasMorePages(true)')))); 71 71 72 - $inexact_pager = new AphrontPagerView(); 72 + $inexact_pager = new PHUIPagerView(); 73 73 $inexact_pager->setPageSize($page_size); 74 74 $inexact_pager->setOffset($offset); 75 75 $inexact_pager->setHasMorePages($offset < ($item_count - $page_size));
+1 -1
src/applications/xhprof/controller/PhabricatorXHProfSampleListController.php
··· 13 13 $request = $this->getRequest(); 14 14 $user = $request->getUser(); 15 15 16 - $pager = new AphrontPagerView(); 16 + $pager = new PHUIPagerView(); 17 17 $pager->setOffset($request->getInt('page')); 18 18 19 19 switch ($this->view) {
+1 -1
src/infrastructure/query/PhabricatorOffsetPagedQuery.php
··· 39 39 } 40 40 } 41 41 42 - final public function executeWithOffsetPager(AphrontPagerView $pager) { 42 + final public function executeWithOffsetPager(PHUIPagerView $pager) { 43 43 $this->setLimit($pager->getPageSize() + 1); 44 44 $this->setOffset($pager->getOffset()); 45 45
+30 -19
src/view/control/AphrontCursorPagerView.php
··· 141 141 142 142 $first_uri = $this->getFirstPageURI(); 143 143 if ($first_uri) { 144 - $links[] = phutil_tag( 145 - 'a', 146 - array( 147 - 'href' => $first_uri, 148 - ), 149 - "\xC2\xAB ".pht('First')); 144 + $icon = id(new PHUIIconView()) 145 + ->setIconFont('fa-fast-backward'); 146 + $links[] = id(new PHUIButtonView()) 147 + ->setTag('a') 148 + ->setHref($first_uri) 149 + ->setIcon($icon) 150 + ->addClass('mml') 151 + ->setColor(PHUIButtonView::SIMPLE) 152 + ->setText(pht('First')); 150 153 } 151 154 152 155 $prev_uri = $this->getPrevPageURI(); 153 156 if ($prev_uri) { 154 - $links[] = phutil_tag( 155 - 'a', 156 - array( 157 - 'href' => $prev_uri, 158 - ), 159 - "\xE2\x80\xB9 ".pht('Prev')); 157 + $icon = id(new PHUIIconView()) 158 + ->setIconFont('fa-backward'); 159 + $links[] = id(new PHUIButtonView()) 160 + ->setTag('a') 161 + ->setHref($prev_uri) 162 + ->setIcon($icon) 163 + ->addClass('mml') 164 + ->setColor(PHUIButtonView::SIMPLE) 165 + ->setText(pht('Prev')); 160 166 } 161 167 162 168 $next_uri = $this->getNextPageURI(); 163 169 if ($next_uri) { 164 - $links[] = phutil_tag( 165 - 'a', 166 - array( 167 - 'href' => $next_uri, 168 - ), 169 - pht('Next')." \xE2\x80\xBA"); 170 + $icon = id(new PHUIIconView()) 171 + ->setIconFont('fa-forward'); 172 + $links[] = id(new PHUIButtonView()) 173 + ->setTag('a') 174 + ->setHref($next_uri) 175 + ->setIcon($icon, false) 176 + ->addClass('mml') 177 + ->setColor(PHUIButtonView::SIMPLE) 178 + ->setText(pht('Next')); 170 179 } 171 180 172 181 return phutil_tag( 173 182 'div', 174 - array('class' => 'aphront-pager-view'), 183 + array( 184 + 'class' => 'phui-pager-view', 185 + ), 175 186 $links); 176 187 } 177 188
+13 -11
src/view/control/AphrontPagerView.php src/view/phui/PHUIPagerView.php
··· 1 1 <?php 2 2 3 - final class AphrontPagerView extends AphrontView { 3 + final class PHUIPagerView extends AphrontView { 4 4 5 5 private $offset; 6 6 private $pageSize = 100; ··· 112 112 throw new PhutilInvalidStateException('setURI'); 113 113 } 114 114 115 - require_celerity_resource('aphront-pager-view-css'); 115 + require_celerity_resource('phui-pager-css'); 116 116 117 117 $page = (int)floor($this->getOffset() / $this->getPageSize()); 118 118 $last = ((int)ceil($this->computeCount() / $this->getPageSize())) - 1; ··· 125 125 if ($max - $min > $last) { 126 126 $max = $min + $last; 127 127 if ($max == $min) { 128 - return phutil_tag('div', array('class' => 'aphront-pager-view'), ''); 128 + return phutil_tag('div', array('class' => 'phui-pager-view'), ''); 129 129 } 130 130 } 131 131 ··· 197 197 list($index, $label, $class) = $link; 198 198 $display_index = $this->getDisplayIndex($index); 199 199 $link = $base_uri->alter($parameter, $display_index); 200 - $rendered_links[] = phutil_tag( 201 - 'a', 202 - array( 203 - 'href' => $link, 204 - 'class' => $class, 205 - ), 206 - $label); 200 + $rendered_links[] = id(new PHUIButtonView()) 201 + ->setTag('a') 202 + ->setHref($link) 203 + ->setColor(PHUIButtonView::SIMPLE) 204 + ->addClass('mml') 205 + ->addClass($class) 206 + ->setText($label); 207 207 } 208 208 209 209 return phutil_tag( 210 210 'div', 211 - array('class' => 'aphront-pager-view'), 211 + array( 212 + 'class' => 'phui-pager-view', 213 + ), 212 214 $rendered_links); 213 215 } 214 216
+12 -2
src/view/phui/PHUIButtonView.php
··· 22 22 private $dropdown; 23 23 private $icon; 24 24 private $iconFont; 25 + private $iconFirst; 25 26 private $href = null; 26 27 private $title = null; 27 28 private $disabled; ··· 87 88 return $this; 88 89 } 89 90 90 - public function setIcon(PHUIIconView $icon) { 91 + public function setIcon(PHUIIconView $icon, $first = true) { 91 92 $this->icon = $icon; 93 + $this->iconFirst = $first; 92 94 return $this; 93 95 } 94 96 ··· 138 140 $classes[] = 'has-icon'; 139 141 } 140 142 143 + if ($this->iconFirst == false) { 144 + $classes[] = 'icon-last'; 145 + } 146 + 141 147 if ($this->disabled) { 142 148 $classes[] = 'disabled'; 143 149 } ··· 184 190 $caret = phutil_tag('span', array('class' => 'caret'), ''); 185 191 } 186 192 187 - return array($icon, $text, $caret); 193 + if ($this->iconFirst == true) { 194 + return array($icon, $text, $caret); 195 + } else { 196 + return array($text, $icon); 197 + } 188 198 } 189 199 }
-39
webroot/rsrc/css/aphront/pager-view.css
··· 1 - /** 2 - * @provides aphront-pager-view-css 3 - */ 4 - 5 - .aphront-pager-view { 6 - clear: both; 7 - text-align: right; 8 - padding: 8px 4px 16px; 9 - font-weight: bold; 10 - } 11 - 12 - .phui-box .aphront-pager-view { 13 - padding: 0; 14 - } 15 - 16 - .aphront-pager-view a { 17 - padding: 3px 7px; 18 - border: 1px solid {$lightblueborder}; 19 - border-bottom: 1px solid {$blueborder}; 20 - margin: 0 2px; 21 - background: #fff; 22 - color: {$lightbluetext}; 23 - display: inline-block; 24 - border-radius: 2px; 25 - } 26 - 27 - .aphront-pager-view a:hover { 28 - text-decoration: none; 29 - border: 1px solid {$greyborder}; 30 - border-bottom: 1px solid {$darkgreyborder}; 31 - color: {$darkgreytext}; 32 - } 33 - 34 - .aphront-pager-view a.current { 35 - background: {$greybackground}; 36 - border: 1px solid {$greyborder}; 37 - border-bottom: 1px solid {$darkgreyborder}; 38 - color: {$darkgreytext}; 39 - }
+9
webroot/rsrc/css/phui/phui-button.css
··· 258 258 left: 12px; 259 259 } 260 260 261 + .button.icon-last .phui-icon-view { 262 + left: auto; 263 + right: 12px; 264 + } 265 + 261 266 .phui-button-bar .button .phui-icon-view { 262 267 left: 11px; 263 268 } 264 269 265 270 .button.has-icon .phui-button-text { 266 271 margin-left: 16px; 272 + } 273 + 274 + .button.has-icon.icon-last .phui-button-text { 275 + margin: 0 16px 0 0; 267 276 } 268 277 269 278 /* Login Buttons */
+8
webroot/rsrc/css/phui/phui-pager.css
··· 1 + /** 2 + * @provides phui-pager-css 3 + */ 4 + 5 + .phui-pager-view { 6 + clear: both; 7 + text-align: right; 8 + }