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

PHUIButtonView class

Summary: Rough pass at a PHUIButtonView Class. Keeps phutil_tag intact and adds some image features if you use the class.

Test Plan: UIExamples

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

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

+410 -134
+2 -2
scripts/celerity_mapper.php
··· 67 67 'core.pkg.css' => array( 68 68 'phabricator-core-css', 69 69 'phabricator-zindex-css', 70 - 'phabricator-core-buttons-css', 70 + 'phui-button-css', 71 71 'phabricator-standard-page-view', 72 72 'aphront-dialog-view-css', 73 73 'aphront-form-view-css', ··· 104 104 'phabricator-crumbs-view-css', 105 105 'phabricator-object-item-list-view-css', 106 106 'global-drag-and-drop-css', 107 - 'spacing-css', 107 + 'phui-spacing-css', 108 108 'phui-form-css', 109 109 'phui-icon-view-css', 110 110
+65 -65
src/__celerity_resource_map__.php
··· 2965 2965 ), 2966 2966 'disk' => '/rsrc/css/application/contentsource/content-source-view.css', 2967 2967 ), 2968 - 'phabricator-core-buttons-css' => 2969 - array( 2970 - 'uri' => '/res/073fc5eb/rsrc/css/core/buttons.css', 2971 - 'type' => 'css', 2972 - 'requires' => 2973 - array( 2974 - ), 2975 - 'disk' => '/rsrc/css/core/buttons.css', 2976 - ), 2977 2968 'phabricator-core-css' => 2978 2969 array( 2979 2970 'uri' => '/res/dc204369/rsrc/css/core/core.css', ··· 3694 3685 ), 3695 3686 'disk' => '/rsrc/css/phui/phui-box.css', 3696 3687 ), 3688 + 'phui-button-css' => 3689 + array( 3690 + 'uri' => '/res/8fc82931/rsrc/css/phui/phui-button.css', 3691 + 'type' => 'css', 3692 + 'requires' => 3693 + array( 3694 + ), 3695 + 'disk' => '/rsrc/css/phui/phui-button.css', 3696 + ), 3697 3697 'phui-document-view-css' => 3698 3698 array( 3699 3699 'uri' => '/res/fe374dee/rsrc/css/phui/phui-document.css', ··· 3723 3723 ), 3724 3724 'phui-icon-view-css' => 3725 3725 array( 3726 - 'uri' => '/res/7fd37b96/rsrc/css/phui/phui-icon.css', 3726 + 'uri' => '/res/f78f4c64/rsrc/css/phui/phui-icon.css', 3727 3727 'type' => 'css', 3728 3728 'requires' => 3729 3729 array( ··· 3738 3738 array( 3739 3739 ), 3740 3740 'disk' => '/rsrc/css/phui/phui-list.css', 3741 + ), 3742 + 'phui-spacing-css' => 3743 + array( 3744 + 'uri' => '/res/28891fd3/rsrc/css/phui/phui-spacing.css', 3745 + 'type' => 'css', 3746 + 'requires' => 3747 + array( 3748 + ), 3749 + 'disk' => '/rsrc/css/phui/phui-spacing.css', 3741 3750 ), 3742 3751 'phui-text-css' => 3743 3752 array( ··· 3901 3910 ), 3902 3911 'disk' => '/rsrc/css/application/config/setup-issue.css', 3903 3912 ), 3904 - 'spacing-css' => 3905 - array( 3906 - 'uri' => '/res/61563661/rsrc/css/core/spacing.css', 3907 - 'type' => 'css', 3908 - 'requires' => 3909 - array( 3910 - ), 3911 - 'disk' => '/rsrc/css/core/spacing.css', 3912 - ), 3913 3913 'sprite-actions-css' => 3914 3914 array( 3915 3915 'uri' => '/res/bd43efa8/rsrc/css/sprite-actions.css', ··· 4048 4048 ), array( 4049 4049 'packages' => 4050 4050 array( 4051 - '76d08512' => 4051 + '0a101340' => 4052 4052 array( 4053 4053 'name' => 'core.pkg.css', 4054 4054 'symbols' => 4055 4055 array( 4056 4056 0 => 'phabricator-core-css', 4057 4057 1 => 'phabricator-zindex-css', 4058 - 2 => 'phabricator-core-buttons-css', 4058 + 2 => 'phui-button-css', 4059 4059 3 => 'phabricator-standard-page-view', 4060 4060 4 => 'aphront-dialog-view-css', 4061 4061 5 => 'aphront-form-view-css', ··· 4088 4088 32 => 'phabricator-crumbs-view-css', 4089 4089 33 => 'phabricator-object-item-list-view-css', 4090 4090 34 => 'global-drag-and-drop-css', 4091 - 35 => 'spacing-css', 4091 + 35 => 'phui-spacing-css', 4092 4092 36 => 'phui-form-css', 4093 4093 37 => 'phui-icon-view-css', 4094 4094 38 => 'phabricator-application-launch-view-css', ··· 4096 4096 40 => 'phabricator-property-list-view-css', 4097 4097 41 => 'phabricator-tag-view-css', 4098 4098 ), 4099 - 'uri' => '/res/pkg/76d08512/core.pkg.css', 4099 + 'uri' => '/res/pkg/0a101340/core.pkg.css', 4100 4100 'type' => 'css', 4101 4101 ), 4102 4102 'f2ad0683' => ··· 4290 4290 'reverse' => 4291 4291 array( 4292 4292 'aphront-attached-file-view-css' => 'a7ca34a9', 4293 - 'aphront-dialog-view-css' => '76d08512', 4294 - 'aphront-error-view-css' => '76d08512', 4295 - 'aphront-form-view-css' => '76d08512', 4296 - 'aphront-list-filter-view-css' => '76d08512', 4297 - 'aphront-pager-view-css' => '76d08512', 4298 - 'aphront-panel-view-css' => '76d08512', 4299 - 'aphront-table-view-css' => '76d08512', 4300 - 'aphront-tokenizer-control-css' => '76d08512', 4301 - 'aphront-tooltip-css' => '76d08512', 4302 - 'aphront-typeahead-control-css' => '76d08512', 4293 + 'aphront-dialog-view-css' => '0a101340', 4294 + 'aphront-error-view-css' => '0a101340', 4295 + 'aphront-form-view-css' => '0a101340', 4296 + 'aphront-list-filter-view-css' => '0a101340', 4297 + 'aphront-pager-view-css' => '0a101340', 4298 + 'aphront-panel-view-css' => '0a101340', 4299 + 'aphront-table-view-css' => '0a101340', 4300 + 'aphront-tokenizer-control-css' => '0a101340', 4301 + 'aphront-tooltip-css' => '0a101340', 4302 + 'aphront-typeahead-control-css' => '0a101340', 4303 4303 'differential-changeset-view-css' => 'dd27a69b', 4304 4304 'differential-core-view-css' => 'dd27a69b', 4305 4305 'differential-inline-comment-editor' => '9488bb69', ··· 4313 4313 'differential-table-of-contents-css' => 'dd27a69b', 4314 4314 'diffusion-commit-view-css' => 'c8ce2d88', 4315 4315 'diffusion-icons-css' => 'c8ce2d88', 4316 - 'global-drag-and-drop-css' => '76d08512', 4316 + 'global-drag-and-drop-css' => '0a101340', 4317 4317 'inline-comment-summary-css' => 'dd27a69b', 4318 4318 'javelin-aphlict' => 'f2ad0683', 4319 4319 'javelin-behavior' => 'a9f14d76', ··· 4387 4387 'javelin-util' => 'a9f14d76', 4388 4388 'javelin-vector' => 'a9f14d76', 4389 4389 'javelin-workflow' => 'a9f14d76', 4390 - 'lightbox-attachment-css' => '76d08512', 4390 + 'lightbox-attachment-css' => '0a101340', 4391 4391 'maniphest-task-summary-css' => 'a7ca34a9', 4392 4392 'maniphest-transaction-detail-css' => 'a7ca34a9', 4393 - 'phabricator-action-list-view-css' => '76d08512', 4394 - 'phabricator-application-launch-view-css' => '76d08512', 4393 + 'phabricator-action-list-view-css' => '0a101340', 4394 + 'phabricator-application-launch-view-css' => '0a101340', 4395 4395 'phabricator-busy' => 'f2ad0683', 4396 4396 'phabricator-content-source-view-css' => 'dd27a69b', 4397 - 'phabricator-core-buttons-css' => '76d08512', 4398 - 'phabricator-core-css' => '76d08512', 4399 - 'phabricator-crumbs-view-css' => '76d08512', 4397 + 'phabricator-core-css' => '0a101340', 4398 + 'phabricator-crumbs-view-css' => '0a101340', 4400 4399 'phabricator-drag-and-drop-file-upload' => '9488bb69', 4401 4400 'phabricator-dropdown-menu' => 'f2ad0683', 4402 4401 'phabricator-file-upload' => 'f2ad0683', 4403 - 'phabricator-filetree-view-css' => '76d08512', 4404 - 'phabricator-flag-css' => '76d08512', 4405 - 'phabricator-form-view-css' => '76d08512', 4406 - 'phabricator-header-view-css' => '76d08512', 4402 + 'phabricator-filetree-view-css' => '0a101340', 4403 + 'phabricator-flag-css' => '0a101340', 4404 + 'phabricator-form-view-css' => '0a101340', 4405 + 'phabricator-header-view-css' => '0a101340', 4407 4406 'phabricator-hovercard' => 'f2ad0683', 4408 - 'phabricator-jump-nav' => '76d08512', 4407 + 'phabricator-jump-nav' => '0a101340', 4409 4408 'phabricator-keyboard-shortcut' => 'f2ad0683', 4410 4409 'phabricator-keyboard-shortcut-manager' => 'f2ad0683', 4411 - 'phabricator-main-menu-view' => '76d08512', 4410 + 'phabricator-main-menu-view' => '0a101340', 4412 4411 'phabricator-menu-item' => 'f2ad0683', 4413 - 'phabricator-nav-view-css' => '76d08512', 4412 + 'phabricator-nav-view-css' => '0a101340', 4414 4413 'phabricator-notification' => 'f2ad0683', 4415 - 'phabricator-notification-css' => '76d08512', 4416 - 'phabricator-notification-menu-css' => '76d08512', 4417 - 'phabricator-object-item-list-view-css' => '76d08512', 4414 + 'phabricator-notification-css' => '0a101340', 4415 + 'phabricator-notification-menu-css' => '0a101340', 4416 + 'phabricator-object-item-list-view-css' => '0a101340', 4418 4417 'phabricator-object-selector-css' => 'dd27a69b', 4419 4418 'phabricator-phtize' => 'f2ad0683', 4420 4419 'phabricator-prefab' => 'f2ad0683', 4421 4420 'phabricator-project-tag-css' => 'a7ca34a9', 4422 - 'phabricator-property-list-view-css' => '76d08512', 4423 - 'phabricator-remarkup-css' => '76d08512', 4421 + 'phabricator-property-list-view-css' => '0a101340', 4422 + 'phabricator-remarkup-css' => '0a101340', 4424 4423 'phabricator-shaped-request' => '9488bb69', 4425 - 'phabricator-side-menu-view-css' => '76d08512', 4426 - 'phabricator-standard-page-view' => '76d08512', 4427 - 'phabricator-tag-view-css' => '76d08512', 4424 + 'phabricator-side-menu-view-css' => '0a101340', 4425 + 'phabricator-standard-page-view' => '0a101340', 4426 + 'phabricator-tag-view-css' => '0a101340', 4428 4427 'phabricator-textareautils' => 'f2ad0683', 4429 4428 'phabricator-tooltip' => 'f2ad0683', 4430 - 'phabricator-transaction-view-css' => '76d08512', 4431 - 'phabricator-zindex-css' => '76d08512', 4432 - 'phui-form-css' => '76d08512', 4433 - 'phui-icon-view-css' => '76d08512', 4434 - 'spacing-css' => '76d08512', 4435 - 'sprite-apps-large-css' => '76d08512', 4436 - 'sprite-gradient-css' => '76d08512', 4437 - 'sprite-icons-css' => '76d08512', 4438 - 'sprite-menu-css' => '76d08512', 4439 - 'syntax-highlighting-css' => '76d08512', 4429 + 'phabricator-transaction-view-css' => '0a101340', 4430 + 'phabricator-zindex-css' => '0a101340', 4431 + 'phui-button-css' => '0a101340', 4432 + 'phui-form-css' => '0a101340', 4433 + 'phui-icon-view-css' => '0a101340', 4434 + 'phui-spacing-css' => '0a101340', 4435 + 'sprite-apps-large-css' => '0a101340', 4436 + 'sprite-gradient-css' => '0a101340', 4437 + 'sprite-icons-css' => '0a101340', 4438 + 'sprite-menu-css' => '0a101340', 4439 + 'syntax-highlighting-css' => '0a101340', 4440 4440 ), 4441 4441 ));
+4 -2
src/__phutil_library_map__.php
··· 686 686 'PHUI' => 'view/phui/PHUI.php', 687 687 'PHUIBoxExample' => 'applications/uiexample/examples/PHUIBoxExample.php', 688 688 'PHUIBoxView' => 'view/phui/PHUIBoxView.php', 689 + 'PHUIButtonExample' => 'applications/uiexample/examples/PHUIButtonExample.php', 690 + 'PHUIButtonView' => 'view/phui/PHUIButtonView.php', 689 691 'PHUIDocumentExample' => 'applications/uiexample/examples/PHUIDocumentExample.php', 690 692 'PHUIDocumentView' => 'view/phui/PHUIDocumentView.php', 691 693 'PHUIFeedStoryExample' => 'applications/uiexample/examples/PHUIFeedStoryExample.php', ··· 835 837 'PhabricatorBotUser' => 'infrastructure/daemon/bot/target/PhabricatorBotUser.php', 836 838 'PhabricatorBotWhatsNewHandler' => 'infrastructure/daemon/bot/handler/PhabricatorBotWhatsNewHandler.php', 837 839 'PhabricatorBuiltinPatchList' => 'infrastructure/storage/patch/PhabricatorBuiltinPatchList.php', 838 - 'PhabricatorButtonsExample' => 'applications/uiexample/examples/PhabricatorButtonsExample.php', 839 840 'PhabricatorCacheDAO' => 'applications/cache/storage/PhabricatorCacheDAO.php', 840 841 'PhabricatorCacheManagementPurgeWorkflow' => 'applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php', 841 842 'PhabricatorCacheManagementWorkflow' => 'applications/cache/management/PhabricatorCacheManagementWorkflow.php', ··· 2531 2532 'OwnersPackageReplyHandler' => 'PhabricatorMailReplyHandler', 2532 2533 'PHUIBoxExample' => 'PhabricatorUIExample', 2533 2534 'PHUIBoxView' => 'AphrontTagView', 2535 + 'PHUIButtonExample' => 'PhabricatorUIExample', 2536 + 'PHUIButtonView' => 'AphrontTagView', 2534 2537 'PHUIDocumentExample' => 'PhabricatorUIExample', 2535 2538 'PHUIDocumentView' => 'AphrontTagView', 2536 2539 'PHUIFeedStoryExample' => 'PhabricatorUIExample', ··· 2683 2686 'PhabricatorBotUser' => 'PhabricatorBotTarget', 2684 2687 'PhabricatorBotWhatsNewHandler' => 'PhabricatorBotHandler', 2685 2688 'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList', 2686 - 'PhabricatorButtonsExample' => 'PhabricatorUIExample', 2687 2689 'PhabricatorCacheDAO' => 'PhabricatorLiskDAO', 2688 2690 'PhabricatorCacheManagementPurgeWorkflow' => 'PhabricatorSearchManagementWorkflow', 2689 2691 'PhabricatorCacheManagementWorkflow' => 'PhutilArgumentWorkflow',
+185
src/applications/uiexample/examples/PHUIButtonExample.php
··· 1 + <?php 2 + 3 + final class PHUIButtonExample extends PhabricatorUIExample { 4 + 5 + public function getName() { 6 + return 'Buttons'; 7 + } 8 + 9 + public function getDescription() { 10 + return hsprintf('Use <tt>&lt;button&gt;</tt> to render buttons.'); 11 + } 12 + 13 + public function renderExample() { 14 + $request = $this->getRequest(); 15 + $user = $request->getUser(); 16 + 17 + $colors = array('', 'green', 'grey', 'black', 'disabled'); 18 + $sizes = array('', 'small'); 19 + $tags = array('a', 'button'); 20 + 21 + // phutil_tag 22 + 23 + $column = array(); 24 + foreach ($tags as $tag) { 25 + foreach ($colors as $color) { 26 + foreach ($sizes as $key => $size) { 27 + $class = implode(' ', array($color, $size)); 28 + 29 + if ($tag == 'a') { 30 + $class .= ' button'; 31 + } 32 + 33 + $column[$key][] = phutil_tag( 34 + $tag, 35 + array( 36 + 'class' => $class, 37 + ), 38 + phutil_utf8_ucwords($size.' '.$color.' '.$tag)); 39 + 40 + $column[$key][] = hsprintf('<br /><br />'); 41 + } 42 + } 43 + } 44 + 45 + $column3 = array(); 46 + foreach ($colors as $color) { 47 + $caret = phutil_tag('span', array('class' => 'caret'), ''); 48 + $column3[] = phutil_tag( 49 + 'a', 50 + array( 51 + 'class' => $color.' button dropdown' 52 + ), 53 + array( 54 + phutil_utf8_ucwords($color.' Dropdown'), 55 + $caret, 56 + )); 57 + $column3[] = hsprintf('<br /><br />'); 58 + } 59 + 60 + $layout1 = id(new AphrontMultiColumnView()) 61 + ->addColumn($column[0]) 62 + ->addColumn($column[1]) 63 + ->addColumn($column3) 64 + ->setFluidLayout(true) 65 + ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); 66 + 67 + // PHUIButtonView 68 + 69 + $colors = array(null, 70 + PHUIButtonView::GREEN, 71 + PHUIButtonView::GREY, 72 + PHUIButtonView::BLACK, 73 + PHUIButtonView::DISABLED); 74 + $sizes = array(null, PHUIButtonView::SMALL); 75 + $column = array(); 76 + foreach ($colors as $color) { 77 + foreach ($sizes as $key => $size) { 78 + $column[$key][] = id(new PHUIButtonView()) 79 + ->setColor($color) 80 + ->setSize($size) 81 + ->setTag('a') 82 + ->setText('Clicky'); 83 + $column[$key][] = hsprintf('<br /><br />'); 84 + } 85 + } 86 + foreach ($colors as $color) { 87 + $column[2][] = id(new PHUIButtonView()) 88 + ->setColor($color) 89 + ->setTag('button') 90 + ->setText('Button') 91 + ->setDropdown(true); 92 + $column[2][] = hsprintf('<br /><br />'); 93 + } 94 + 95 + $layout2 = id(new AphrontMultiColumnView()) 96 + ->addColumn($column[0]) 97 + ->addColumn($column[1]) 98 + ->addColumn($column[2]) 99 + ->setFluidLayout(true) 100 + ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); 101 + 102 + // Icon Buttons 103 + 104 + $column = array(); 105 + $icons = array( 106 + 'Comment' => 'comment', 107 + 'Give Token' => 'like', 108 + 'Reverse Time' => 'history', 109 + 'Implode Earth' => 'warning'); 110 + foreach ($icons as $text => $icon) { 111 + $image = id(new PHUIIconView()) 112 + ->setSpriteSheet(PHUIIconView::SPRITE_ICONS) 113 + ->setSpriteIcon($icon); 114 + $column[] = id(new PHUIButtonView()) 115 + ->setTag('a') 116 + ->setColor(PHUIButtonView::GREY) 117 + ->setIcon($image) 118 + ->setText($text) 119 + ->addClass(PHUI::MARGIN_SMALL_RIGHT); 120 + } 121 + 122 + $layout3 = id(new AphrontMultiColumnView()) 123 + ->addColumn($column) 124 + ->setFluidLayout(true) 125 + ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); 126 + 127 + 128 + // Baby Got Back Buttons 129 + 130 + $column = array(); 131 + $icons = array('Asana', 'Github', 'Facebook', 'Google', 'LDAP'); 132 + foreach ($icons as $icon) { 133 + $image = id(new PHUIIconView()) 134 + ->setSpriteSheet(PHUIIconView::SPRITE_LOGIN) 135 + ->setSpriteIcon($icon); 136 + $column[] = id(new PHUIButtonView()) 137 + ->setTag('a') 138 + ->setSize(PHUIButtonView::BIG) 139 + ->setColor(PHUIButtonView::GREY) 140 + ->setIcon($image) 141 + ->setText('Login or Register') 142 + ->setSubtext($icon) 143 + ->addClass(PHUI::MARGIN_MEDIUM_RIGHT); 144 + } 145 + 146 + $layout4 = id(new AphrontMultiColumnView()) 147 + ->addColumn($column) 148 + ->setFluidLayout(true) 149 + ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); 150 + 151 + 152 + // Set it and forget it 153 + 154 + $head1 = id(new PhabricatorHeaderView()) 155 + ->setHeader('phutil_tag'); 156 + 157 + $head2 = id(new PhabricatorHeaderView()) 158 + ->setHeader('PHUIButtonView'); 159 + 160 + $head3 = id(new PhabricatorHeaderView()) 161 + ->setHeader('Icon Buttons'); 162 + 163 + $head4 = id(new PhabricatorHeaderView()) 164 + ->setHeader('Big Icon Buttons'); 165 + 166 + $wrap1 = id(new PHUIBoxView()) 167 + ->appendChild($layout1) 168 + ->addMargin(PHUI::MARGIN_LARGE); 169 + 170 + $wrap2 = id(new PHUIBoxView()) 171 + ->appendChild($layout2) 172 + ->addMargin(PHUI::MARGIN_LARGE); 173 + 174 + $wrap3 = id(new PHUIBoxView()) 175 + ->appendChild($layout3) 176 + ->addMargin(PHUI::MARGIN_LARGE); 177 + 178 + $wrap4 = id(new PHUIBoxView()) 179 + ->appendChild($layout4) 180 + ->addMargin(PHUI::MARGIN_LARGE); 181 + 182 + return array($head1, $wrap1, $head2, $wrap2, $head3, $wrap3, 183 + $head4, $wrap4); 184 + } 185 + }
-59
src/applications/uiexample/examples/PhabricatorButtonsExample.php
··· 1 - <?php 2 - 3 - final class PhabricatorButtonsExample extends PhabricatorUIExample { 4 - 5 - public function getName() { 6 - return 'Buttons'; 7 - } 8 - 9 - public function getDescription() { 10 - return hsprintf('Use <tt>&lt;button&gt;</tt> to render buttons.'); 11 - } 12 - 13 - public function renderExample() { 14 - $request = $this->getRequest(); 15 - $user = $request->getUser(); 16 - 17 - $colors = array('', 'green', 'grey', 'black', 'disabled'); 18 - $sizes = array('', 'small'); 19 - $tags = array('a', 'button'); 20 - 21 - $view = array(); 22 - foreach ($tags as $tag) { 23 - foreach ($colors as $color) { 24 - foreach ($sizes as $size) { 25 - $class = implode(' ', array($color, $size)); 26 - 27 - if ($tag == 'a') { 28 - $class .= ' button'; 29 - } 30 - 31 - $view[] = phutil_tag( 32 - $tag, 33 - array( 34 - 'class' => $class, 35 - ), 36 - phutil_utf8_ucwords($size.' '.$color.' '.$tag)); 37 - 38 - $view[] = hsprintf('<br /><br />'); 39 - } 40 - } 41 - } 42 - 43 - foreach ($colors as $color) { 44 - $caret = phutil_tag('span', array('class' => 'caret'), ''); 45 - $view[] = phutil_tag( 46 - 'a', 47 - array( 48 - 'class' => $color.' button dropdown' 49 - ), 50 - array( 51 - phutil_utf8_ucwords($color.' Dropdown'), 52 - $caret, 53 - )); 54 - $view[] = hsprintf('<br /><br />'); 55 - } 56 - 57 - return phutil_tag('div', array('style' => 'margin: 1em 2em;'), $view); 58 - } 59 - }
+3 -3
src/view/page/PhabricatorStandardPageView.php
··· 128 128 129 129 require_celerity_resource('phabricator-core-css'); 130 130 require_celerity_resource('phabricator-zindex-css'); 131 - require_celerity_resource('phabricator-core-buttons-css'); 132 - require_celerity_resource('spacing-css'); 133 - require_celerity_resource('phui-form-css'); // Evan will hate this 131 + require_celerity_resource('phui-button-css'); 132 + require_celerity_resource('phui-spacing-css'); 133 + require_celerity_resource('phui-form-css'); 134 134 require_celerity_resource('sprite-gradient-css'); 135 135 require_celerity_resource('phabricator-standard-page-view'); 136 136
+110
src/view/phui/PHUIButtonView.php
··· 1 + <?php 2 + 3 + final class PHUIButtonView extends AphrontTagView { 4 + 5 + const GREEN = 'green'; 6 + const GREY = 'grey'; 7 + const BLACK = 'black'; 8 + const DISABLED = 'disabled'; 9 + 10 + const SMALL = 'small'; 11 + const BIG = 'big'; 12 + 13 + private $size; 14 + private $text; 15 + private $subtext; 16 + private $color; 17 + private $tag = 'a'; 18 + private $dropdown; 19 + private $icon; 20 + 21 + public function setText($text) { 22 + $this->text = $text; 23 + return $this; 24 + } 25 + 26 + public function setSubtext($subtext) { 27 + $this->subtext = $subtext; 28 + return $this; 29 + } 30 + 31 + public function setColor($color) { 32 + $this->color = $color; 33 + return $this; 34 + } 35 + 36 + public function setTag($tag) { 37 + $this->tag = $tag; 38 + return $this; 39 + } 40 + 41 + public function setSize($size) { 42 + $this->size = $size; 43 + return $this; 44 + } 45 + 46 + public function setDropdown($dd) { 47 + $this->dropdown = $dd; 48 + return $this; 49 + } 50 + 51 + public function setIcon(PHUIIconView $icon) { 52 + $this->icon = $icon; 53 + return $this; 54 + } 55 + 56 + public function getTagName() { 57 + return $this->tag; 58 + } 59 + 60 + protected function getTagAttributes() { 61 + 62 + require_celerity_resource('phui-button-css'); 63 + 64 + $classes = array(); 65 + $classes[] = 'button'; 66 + 67 + if ($this->color) { 68 + $classes[] = $this->color; 69 + } 70 + 71 + if ($this->size) { 72 + $classes[] = $this->size; 73 + } 74 + 75 + if ($this->dropdown) { 76 + $classes[] = 'dropdown'; 77 + } 78 + 79 + if ($this->icon) { 80 + $classes[] = 'has-icon'; 81 + } 82 + 83 + return array('class' => $classes); 84 + } 85 + 86 + protected function getTagContent() { 87 + 88 + $icon = null; 89 + $text = $this->text; 90 + if ($this->icon) { 91 + $icon = $this->icon; 92 + 93 + $subtext = null; 94 + if ($this->subtext) { 95 + $subtext = phutil_tag( 96 + 'span', array('class' => 'phui-button-subtext'), $this->subtext); 97 + $subtext = hsprintf('<br />%s', $subtext); 98 + } 99 + $text = phutil_tag( 100 + 'div', array('class' => 'phui-button-text'), array($text, $subtext)); 101 + } 102 + 103 + $caret = null; 104 + if ($this->dropdown) { 105 + $caret = phutil_tag('span', array('class' => 'caret'), ''); 106 + } 107 + 108 + return array($icon, $text, $caret); 109 + } 110 + }
+38 -1
webroot/rsrc/css/core/buttons.css webroot/rsrc/css/phui/phui-button.css
··· 1 1 /** 2 - * @provides phabricator-core-buttons-css 2 + * @provides phui-button-css 3 3 */ 4 4 5 5 ··· 224 224 .grey.dropdown .caret { 225 225 border-top-color: #000; 226 226 } 227 + 228 + /* Icons */ 229 + .button.has-icon { 230 + position: relative; 231 + } 232 + 233 + .button .phui-icon-view { 234 + display: inline-block; 235 + position: absolute; 236 + top: 5px; 237 + left: 8px; 238 + } 239 + 240 + .button.has_icon .phui-button-text { 241 + margin-left: 16px; 242 + } 243 + 244 + /* Login Buttons */ 245 + 246 + .button.big.has-icon { 247 + padding: 6px 20px 6px 12px; 248 + border-radius: 4px; 249 + } 250 + 251 + .button.big.has-icon .phui-button-text { 252 + margin-left: 36px; 253 + font-size: 14px; 254 + display: block; 255 + } 256 + 257 + .button.big.has-icon .phui-button-subtext { 258 + color: #888; 259 + font-size: 12px; 260 + line-height: 16px; 261 + font-weight: normal; 262 + float: left; 263 + }
+1 -1
webroot/rsrc/css/core/spacing.css webroot/rsrc/css/phui/phui-spacing.css
··· 1 1 /** 2 - * @provides spacing-css 2 + * @provides phui-spacing-css 3 3 */ 4 4 5 5 .pl {
+2 -1
webroot/rsrc/css/phui/phui-icon.css
··· 17 17 width: 24px; 18 18 } 19 19 20 - .phui-icon-view.sprite-apps { 20 + .phui-icon-view.sprite-apps, 21 + .phui-icon-view.sprite-icons { 21 22 height: 14px; 22 23 width: 14px; 23 24 }