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

Make Phortune account page a little more usable

Summary: Ref T2787. Minor UI improvements.

Test Plan: {F214945}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: chad, epriestley

Maniphest Tasks: T2787

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

+80 -53
+4
src/applications/fund/phortune/FundBackerCart.php
··· 23 23 return $this->initiative; 24 24 } 25 25 26 + public function getName() { 27 + return pht('Fund Initiative'); 28 + } 29 + 26 30 public function willCreateCart( 27 31 PhabricatorUser $viewer, 28 32 PhortuneCart $cart) {
+1 -1
src/applications/fund/phortune/FundBackerProduct.php
··· 22 22 public function getName(PhortuneProduct $product) { 23 23 $initiative = $this->getInitiative(); 24 24 return pht( 25 - 'Back Initiative %s %s', 25 + 'Fund %s %s', 26 26 $initiative->getMonogram(), 27 27 $initiative->getName()); 28 28 }
+2
src/applications/phortune/cart/PhortuneCartImplementation.php
··· 12 12 PhabricatorUser $viewer, 13 13 array $carts); 14 14 15 + abstract public function getName(); 16 + 15 17 abstract public function getCancelURI(PhortuneCart $cart); 16 18 abstract public function getDoneURI(PhortuneCart $cart); 17 19
+35 -30
src/applications/phortune/controller/PhortuneAccountViewController.php
··· 51 51 ->setObject($account) 52 52 ->setUser($user); 53 53 54 - $properties->addProperty(pht('Balance'), '-'); 55 54 $properties->setActionList($actions); 56 55 57 56 $payment_methods = $this->buildPaymentMethodsSection($account); ··· 163 162 )) 164 163 ->execute(); 165 164 165 + $phids = array(); 166 + foreach ($carts as $cart) { 167 + $phids[] = $cart->getPHID(); 168 + foreach ($cart->getPurchases() as $purchase) { 169 + $phids[] = $purchase->getPHID(); 170 + } 171 + } 172 + $handles = $this->loadViewerHandles($phids); 173 + 166 174 $rows = array(); 167 175 $rowc = array(); 168 176 foreach ($carts as $cart) { 169 - $cart_link = phutil_tag( 170 - 'a', 171 - array( 172 - 'href' => $this->getApplicationURI('cart/'.$cart->getID().'/'), 173 - ), 174 - pht('Cart %d', $cart->getID())); 177 + $cart_link = $handles[$cart->getPHID()]->renderLink(); 178 + $purchases = $cart->getPurchases(); 175 179 176 - $rowc[] = 'highlighted'; 180 + if (count($purchases) == 1) { 181 + $purchase_name = $handles[$purchase->getPHID()]->renderLink(); 182 + $purchases = array(); 183 + } else { 184 + $purchase_name = ''; 185 + } 186 + 187 + $rowc[] = ''; 177 188 $rows[] = array( 178 - phutil_tag('strong', array(), $cart_link), 179 - '', 180 - '', 189 + phutil_tag( 190 + 'strong', 191 + array(), 192 + $cart_link), 193 + $purchase_name, 194 + phutil_tag( 195 + 'strong', 196 + array(), 197 + $cart->getTotalPriceAsCurrency()->formatForDisplay()), 198 + phabricator_datetime($cart->getDateModified(), $viewer), 181 199 ); 182 - foreach ($cart->getPurchases() as $purchase) { 200 + foreach ($purchases as $purchase) { 183 201 $id = $purchase->getID(); 184 202 185 203 $price = $purchase->getTotalPriceAsCurrency()->formatForDisplay(); 186 - 187 - $purchase_link = phutil_tag( 188 - 'a', 189 - array( 190 - 'href' => $this->getApplicationURI('purchase/'.$id.'/'), 191 - ), 192 - $purchase->getFullDisplayName()); 193 204 194 205 $rowc[] = ''; 195 206 $rows[] = array( 196 207 '', 197 - $purchase_link, 208 + $handles[$purchase->getPHID()]->renderLink(), 198 209 $price, 210 + '', 199 211 ); 200 212 } 201 213 } ··· 207 219 pht('Cart'), 208 220 pht('Purchase'), 209 221 pht('Amount'), 222 + pht('Updated'), 210 223 )) 211 224 ->setColumnClasses( 212 225 array( 213 226 '', 214 227 'wide', 228 + 'right', 215 229 'right', 216 230 )); 217 231 ··· 239 253 private function buildAccountHistorySection(PhortuneAccount $account) { 240 254 $request = $this->getRequest(); 241 255 $user = $request->getUser(); 242 - 243 - $header = id(new PHUIHeaderView()) 244 - ->setHeader(pht('Account History')); 245 256 246 257 $xactions = id(new PhortuneAccountTransactionQuery()) 247 258 ->setViewer($user) ··· 257 268 ->setTransactions($xactions) 258 269 ->setMarkupEngine($engine); 259 270 260 - $box = id(new PHUIObjectBoxView()) 261 - ->setHeader($header); 262 - 263 - return array( 264 - $box, 265 - $xaction_view, 266 - ); 271 + return $xaction_view; 267 272 } 268 273 269 274 }
+18 -15
src/applications/phortune/controller/PhortuneController.php
··· 12 12 $request = $this->getRequest(); 13 13 $viewer = $request->getUser(); 14 14 15 + $phids = array(); 16 + foreach ($charges as $charge) { 17 + $phids[] = $charge->getProviderPHID(); 18 + $phids[] = $charge->getCartPHID(); 19 + $phids[] = $charge->getMerchantPHID(); 20 + $phids[] = $charge->getPaymentMethodPHID(); 21 + } 22 + 23 + $handles = $this->loadViewerHandles($phids); 24 + 15 25 $rows = array(); 16 26 foreach ($charges as $charge) { 17 - $cart = $charge->getCart(); 18 - $cart_id = $cart->getID(); 19 - $cart_uri = $this->getApplicationURI("cart/{$cart_id}/"); 20 - $cart_href = phutil_tag( 21 - 'a', 22 - array( 23 - 'href' => $cart_uri, 24 - ), 25 - pht('Cart %d', $cart_id)); 26 - 27 27 $rows[] = array( 28 28 $charge->getID(), 29 - $cart_href, 30 - $charge->getProviderPHID(), 31 - $charge->getPaymentMethodPHID(), 29 + $handles[$charge->getCartPHID()]->renderLink(), 30 + $handles[$charge->getProviderPHID()]->renderLink(), 31 + $handles[$charge->getPaymentMethodPHID()]->renderLink(), 32 + $handles[$charge->getMerchantPHID()]->renderLink(), 32 33 $charge->getAmountAsCurrency()->formatForDisplay(), 33 - $charge->getStatus(), 34 + PhortuneCharge::getNameForStatus($charge->getStatus()), 34 35 phabricator_datetime($charge->getDateCreated(), $viewer), 35 36 ); 36 37 } ··· 42 43 pht('Cart'), 43 44 pht('Provider'), 44 45 pht('Method'), 46 + pht('Merchant'), 45 47 pht('Amount'), 46 48 pht('Status'), 47 49 pht('Created'), ··· 49 51 ->setColumnClasses( 50 52 array( 51 53 '', 52 - 'strong', 54 + '', 55 + '', 53 56 '', 54 57 '', 55 58 'wide right',
+2 -1
src/applications/phortune/phid/PhortuneCartPHIDType.php
··· 29 29 $cart = $objects[$phid]; 30 30 31 31 $id = $cart->getID(); 32 + $name = $cart->getImplementation()->getName(); 32 33 33 - $handle->setName(pht('Cart %d', $id)); 34 + $handle->setName($name); 34 35 $handle->setURI("/phortune/cart/{$id}/"); 35 36 } 36 37 }
+1 -1
src/applications/phortune/phid/PhortuneMerchantPHIDType.php
··· 30 30 31 31 $id = $merchant->getID(); 32 32 33 - $handle->setName(pht('Merchant %d %s', $id, $merchant->getName())); 33 + $handle->setName($merchant->getName()); 34 34 $handle->setURI("/phortune/merchant/{$id}/"); 35 35 } 36 36 }
+1 -1
src/applications/phortune/phid/PhortunePaymentMethodPHIDType.php
··· 30 30 31 31 $id = $method->getID(); 32 32 33 - $handle->setName(pht('Method %d', $id)); 33 + $handle->setName($method->getFullDisplayName()); 34 34 $handle->setURI("/phortune/method/{$id}/"); 35 35 } 36 36 }
+1 -2
src/applications/phortune/phid/PhortunePaymentProviderPHIDType.php
··· 30 30 31 31 $id = $provider_config->getID(); 32 32 33 - $handle->setName(pht('Payment Provider %d', $id)); 34 - $handle->setURI("/phortune/provider/{$id}/"); 33 + $handle->setName($provider_config->buildProvider()->getName()); 35 34 } 36 35 } 37 36
+1 -1
src/applications/phortune/phid/PhortunePurchasePHIDType.php
··· 30 30 31 31 $id = $purchase->getID(); 32 32 33 - $handle->setName(pht('Purchase %d', $id)); 33 + $handle->setName($purchase->getFullDisplayName()); 34 34 $handle->setURI("/phortune/purchase/{$id}/"); 35 35 } 36 36 }
+12
src/applications/phortune/storage/PhortuneCharge.php
··· 63 63 ) + parent::getConfiguration(); 64 64 } 65 65 66 + public static function getStatusNameMap() { 67 + return array( 68 + self::STATUS_CHARGING => pht('Charging'), 69 + self::STATUS_CHARGED => pht('Charged'), 70 + self::STATUS_FAILED => pht('Failed'), 71 + ); 72 + } 73 + 74 + public static function getNameForStatus($status) { 75 + return idx(self::getStatusNameMap(), $status, pht('Unknown')); 76 + } 77 + 66 78 public function generatePHID() { 67 79 return PhabricatorPHID::generateNewPHID( 68 80 PhortuneChargePHIDType::TYPECONST);
+2 -1
src/applications/phortune/storage/PhortunePurchase.php
··· 60 60 } 61 61 62 62 public function generatePHID() { 63 - return PhabricatorPHID::generateNewPHID(PhortuneChargePHIDType::TYPECONST); 63 + return PhabricatorPHID::generateNewPHID( 64 + PhortunePurchasePHIDType::TYPECONST); 64 65 } 65 66 66 67 public function attachCart(PhortuneCart $cart) {