diff --git a/resources/sprite/manifest/payments.json b/resources/sprite/manifest/payments.json new file mode 100644 index 0000000000..29f40c7b1e --- /dev/null +++ b/resources/sprite/manifest/payments.json @@ -0,0 +1,45 @@ +{ + "version" : 1, + "sprites" : { + "payments-americanexpress" : { + "name" : "payments-americanexpress", + "rule" : ".payments-americanexpress", + "hash" : "ace986273a0bae308c4018e02cdd60f2" + }, + "payments-discover" : { + "name" : "payments-discover", + "rule" : ".payments-discover", + "hash" : "0b60e5e4c25e0d3bf2c3cb780d7eaf00" + }, + "payments-googlecheckout" : { + "name" : "payments-googlecheckout", + "rule" : ".payments-googlecheckout", + "hash" : "1f00e015545898e059ca09fa49b239e7" + }, + "payments-mastercard" : { + "name" : "payments-mastercard", + "rule" : ".payments-mastercard", + "hash" : "49a742b837610f7b37b565ba4899c95c" + }, + "payments-paypal" : { + "name" : "payments-paypal", + "rule" : ".payments-paypal", + "hash" : "5664cf7acd9fe65d60e1449a33f56ce2" + }, + "payments-visa" : { + "name" : "payments-visa", + "rule" : ".payments-visa", + "hash" : "ff2ffac55927dbe7a1bf02fdfac561ea" + }, + "payments-worldpay" : { + "name" : "payments-worldpay", + "rule" : ".payments-worldpay", + "hash" : "acc037ffa26f6caccf290006e39ba1fc" + } + }, + "scales" : [ + 1 + ], + "header" : "\/**\n * @provides sprite-payments-css\n * @generated\n *\/\n\n.sprite-payments {\n background-image: url(\/rsrc\/image\/sprite-payments.png);\n background-repeat: no-repeat;\n}\n\n@media\nonly screen and (min-device-pixel-ratio: 1.5),\nonly screen and (-webkit-min-device-pixel-ratio: 1.5) {\n .sprite-payments {\n background-image: url(\/rsrc\/image\/sprite-payments-X2.png);\n background-size: {X}px {Y}px;\n }\n}\n", + "type" : "standard" +} diff --git a/resources/sprite/payments_2x/americanexpress.png b/resources/sprite/payments_2x/americanexpress.png new file mode 100644 index 0000000000..022b0a770a Binary files /dev/null and b/resources/sprite/payments_2x/americanexpress.png differ diff --git a/resources/sprite/payments_2x/discover.png b/resources/sprite/payments_2x/discover.png new file mode 100644 index 0000000000..7c055b92bc Binary files /dev/null and b/resources/sprite/payments_2x/discover.png differ diff --git a/resources/sprite/payments_2x/googlecheckout.png b/resources/sprite/payments_2x/googlecheckout.png new file mode 100644 index 0000000000..da186abfd2 Binary files /dev/null and b/resources/sprite/payments_2x/googlecheckout.png differ diff --git a/resources/sprite/payments_2x/mastercard.png b/resources/sprite/payments_2x/mastercard.png new file mode 100644 index 0000000000..405a68f8c0 Binary files /dev/null and b/resources/sprite/payments_2x/mastercard.png differ diff --git a/resources/sprite/payments_2x/paypal.png b/resources/sprite/payments_2x/paypal.png new file mode 100644 index 0000000000..c52765e1ea Binary files /dev/null and b/resources/sprite/payments_2x/paypal.png differ diff --git a/resources/sprite/payments_2x/visa.png b/resources/sprite/payments_2x/visa.png new file mode 100644 index 0000000000..a2d9661d26 Binary files /dev/null and b/resources/sprite/payments_2x/visa.png differ diff --git a/resources/sprite/payments_2x/worldpay.png b/resources/sprite/payments_2x/worldpay.png new file mode 100644 index 0000000000..9554293ace Binary files /dev/null and b/resources/sprite/payments_2x/worldpay.png differ diff --git a/scripts/celerity/generate_sprites.php b/scripts/celerity/generate_sprites.php index 1932945298..911fb5d761 100755 --- a/scripts/celerity/generate_sprites.php +++ b/scripts/celerity/generate_sprites.php @@ -34,6 +34,7 @@ $sheets = array( 'minicons' => $generator->buildMiniconsSheet(), 'conpherence' => $generator->buildConpherenceSheet(), 'apps-large' => $generator->buildAppsLargeSheet(), + 'payments' => $generator->buildPaymentsSheet(), 'tokens' => $generator->buildTokenSheet(), 'docs' => $generator->buildDocsSheet(), 'gradient' => $generator->buildGradientSheet(), diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 1d136539cf..9aca942fe8 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -637,6 +637,20 @@ celerity_register_resource_map(array( 'disk' => '/rsrc/image/sprite-minicons.png', 'type' => 'png', ), + '/rsrc/image/sprite-payments-X2.png' => + array( + 'hash' => 'a896e11842db04bde8c3dc18d6efacd3', + 'uri' => '/res/a896e118/rsrc/image/sprite-payments-X2.png', + 'disk' => '/rsrc/image/sprite-payments-X2.png', + 'type' => 'png', + ), + '/rsrc/image/sprite-payments.png' => + array( + 'hash' => '5ac5b872d19a862eabc508c8bf97a53b', + 'uri' => '/res/5ac5b872/rsrc/image/sprite-payments.png', + 'disk' => '/rsrc/image/sprite-payments.png', + 'type' => 'png', + ), '/rsrc/image/sprite-tokens.png' => array( 'hash' => '67c46fd75c885b76ecbfe46e71a476cc', @@ -3609,7 +3623,7 @@ celerity_register_resource_map(array( ), 'phui-icon-view-css' => array( - 'uri' => '/res/4d0588b4/rsrc/css/phui/phui-icon.css', + 'uri' => '/res/9d05b3f3/rsrc/css/phui/phui-icon.css', 'type' => 'css', 'requires' => array( @@ -3886,6 +3900,15 @@ celerity_register_resource_map(array( ), 'disk' => '/rsrc/css/sprite-minicons.css', ), + 'sprite-payments-css' => + array( + 'uri' => '/res/dcb6e856/rsrc/css/sprite-payments.css', + 'type' => 'css', + 'requires' => + array( + ), + 'disk' => '/rsrc/css/sprite-payments.css', + ), 'sprite-tokens-css' => array( 'uri' => '/res/edb4e341/rsrc/css/sprite-tokens.css', diff --git a/src/applications/uiexample/examples/PHUIIconExample.php b/src/applications/uiexample/examples/PHUIIconExample.php index a6a0116298..a2114a529f 100644 --- a/src/applications/uiexample/examples/PHUIIconExample.php +++ b/src/applications/uiexample/examples/PHUIIconExample.php @@ -48,6 +48,30 @@ final class PHUIIconExample extends PhabricatorUIExample { $person6->setImage( celerity_get_resource_uri('/rsrc/image/people/taft.png')); + $card1 = id(new PHUIIconView()) + ->setSpriteSheet(PHUIIconView::SPRITE_PAYMENTS) + ->setSpriteIcon('visa') + ->addClass(PHUI::MARGIN_SMALL_RIGHT); + + $card2 = id(new PHUIIconView()) + ->setSpriteSheet(PHUIIconView::SPRITE_PAYMENTS) + ->setSpriteIcon('mastercard') + ->addClass(PHUI::MARGIN_SMALL_RIGHT); + + $card3 = id(new PHUIIconView()) + ->setSpriteSheet(PHUIIconView::SPRITE_PAYMENTS) + ->setSpriteIcon('paypal') + ->addClass(PHUI::MARGIN_SMALL_RIGHT); + + $card4 = id(new PHUIIconView()) + ->setSpriteSheet(PHUIIconView::SPRITE_PAYMENTS) + ->setSpriteIcon('americanexpress') + ->addClass(PHUI::MARGIN_SMALL_RIGHT); + + $card5 = id(new PHUIIconView()) + ->setSpriteSheet(PHUIIconView::SPRITE_PAYMENTS) + ->setSpriteIcon('googlecheckout'); + $actions = array( 'settings-grey', 'heart-grey', @@ -108,6 +132,14 @@ final class PHUIIconExample extends PhabricatorUIExample { ->addPadding(PHUI::PADDING_SMALL) ->setShadow(true)); + $layout4 = + array( + id(new PHUIBoxView()) + ->appendChild(array($card1, $card2, $card3, $card4, $card5)) + ->addMargin(PHUI::MARGIN_MEDIUM) + ->addPadding(PHUI::PADDING_MEDIUM) + ->setShadow(true)); + $head1 = id(new PhabricatorHeaderView()) ->setHeader(pht('Action Icons!')); @@ -117,6 +149,9 @@ final class PHUIIconExample extends PhabricatorUIExample { $head3 = id(new PhabricatorHeaderView()) ->setHeader(pht('Tokens')); + $head4 = id(new PhabricatorHeaderView()) + ->setHeader(pht('Payments')); + $wrap1 = id(new PHUIBoxView()) ->appendChild($layout1) ->addMargin(PHUI::MARGIN_LARGE); @@ -129,6 +164,10 @@ final class PHUIIconExample extends PhabricatorUIExample { ->appendChild($layout3) ->addMargin(PHUI::MARGIN_LARGE); + $wrap4 = id(new PHUIBoxView()) + ->appendChild($layout4) + ->addMargin(PHUI::MARGIN_LARGE); + return phutil_tag( 'div', array(), @@ -138,7 +177,9 @@ final class PHUIIconExample extends PhabricatorUIExample { $head2, $wrap2, $head3, - $wrap3 + $wrap3, + $head4, + $wrap4 )); } } diff --git a/src/infrastructure/celerity/CeleritySpriteGenerator.php b/src/infrastructure/celerity/CeleritySpriteGenerator.php index 75d1b68831..f7578468d0 100644 --- a/src/infrastructure/celerity/CeleritySpriteGenerator.php +++ b/src/infrastructure/celerity/CeleritySpriteGenerator.php @@ -332,6 +332,37 @@ final class CeleritySpriteGenerator { return $sheet; } + public function buildPaymentsSheet() { + $icons = $this->getDirectoryList('payments_2x'); + $scales = array( + '2x' => 1, + ); + $template = id(new PhutilSprite()) + ->setSourceSize(60, 32); + + $sprites = array(); + $prefix = 'payments_'; + foreach ($icons as $icon) { + $sprite = id(clone $template) + ->setName('payments-'.$icon) + ->setTargetCSS('.payments-'.$icon); + + foreach ($scales as $scale_key => $scale) { + $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); + $sprite->setSourceFile($path, $scale); + } + $sprites[] = $sprite; + } + + $sheet = $this->buildSheet('payments', true); + $sheet->setScales($scales); + foreach ($sprites as $sprite) { + $sheet->addSprite($sprite); + } + + return $sheet; + } + public function buildConpherenceSheet() { $name = 'conpherence'; diff --git a/src/view/phui/PHUIIconView.php b/src/view/phui/PHUIIconView.php index 57abce3ecc..e25bf6d7b9 100644 --- a/src/view/phui/PHUIIconView.php +++ b/src/view/phui/PHUIIconView.php @@ -6,6 +6,7 @@ final class PHUIIconView extends AphrontTagView { const SPRITE_ACTIONS = 'actions'; const SPRITE_APPS = 'apps'; const SPRITE_TOKENS = 'tokens'; + const SPRITE_PAYMENTS = 'payments'; const HEAD_SMALL = 'phuihead-small'; const HEAD_MEDIUM = 'phuihead-medium'; diff --git a/webroot/rsrc/css/phui/phui-icon.css b/webroot/rsrc/css/phui/phui-icon.css index 6d55b6d4b6..2942f77e57 100644 --- a/webroot/rsrc/css/phui/phui-icon.css +++ b/webroot/rsrc/css/phui/phui-icon.css @@ -27,6 +27,11 @@ width: 16px; } +.phui-icon-item-link.sprite-payments { + height: 32px; + width: 60px; +} + .phui-icon-item-link.phuihead-medium { height: 50px; width: 50px; diff --git a/webroot/rsrc/css/sprite-payments.css b/webroot/rsrc/css/sprite-payments.css new file mode 100644 index 0000000000..b6ff1c9c23 --- /dev/null +++ b/webroot/rsrc/css/sprite-payments.css @@ -0,0 +1,47 @@ +/** + * @provides sprite-payments-css + * @generated + */ + +.sprite-payments { + background-image: url(/rsrc/image/sprite-payments.png); + background-repeat: no-repeat; +} + +@media +only screen and (min-device-pixel-ratio: 1.5), +only screen and (-webkit-min-device-pixel-ratio: 1.5) { + .sprite-payments { + background-image: url(/rsrc/image/sprite-payments-X2.png); + background-size: 122px 132px; + } +} + + +.payments-americanexpress { + background-position: 0px 0px; +} + +.payments-discover { + background-position: -61px 0px; +} + +.payments-googlecheckout { + background-position: 0px -33px; +} + +.payments-mastercard { + background-position: -61px -33px; +} + +.payments-paypal { + background-position: 0px -66px; +} + +.payments-visa { + background-position: -61px -66px; +} + +.payments-worldpay { + background-position: 0px -99px; +} diff --git a/webroot/rsrc/image/sprite-payments.png b/webroot/rsrc/image/sprite-payments.png new file mode 100644 index 0000000000..bf96741b77 Binary files /dev/null and b/webroot/rsrc/image/sprite-payments.png differ