1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-09 06:11:01 +01:00
phorge-phorge/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsCurtainExtension.php
epriestley 61f82bb97b Introduce "Curtain" views, panels, and extensions
Summary:
This opens up the new action column to have specialized rendering and behavior. Briefly:

  - Converted applications (right now, only Paste) render a `CurtainView` to build the column content.
  - This view uses new extensions to build panels (projects, subscribers, tokens).
  - The panel extension code and rendering can be changed without breaking old stuff.

Minor changes:

  - Token awards now load their tokens, for consistency/simplicity.
  - Removed the rest of the "fork of" / "forked from" UI in Paste -- I essentially removed these features a while ago, and no one has complained.

Test Plan:
UI is a bit rough, but works, and it's going to get changed now anyway:

{F1160550}

{F1160551}

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15414
2016-03-06 09:27:55 -08:00

39 lines
1 KiB
PHP

<?php
final class PhabricatorSubscriptionsCurtainExtension
extends PHUICurtainExtension {
const EXTENSIONKEY = 'subscriptions.subscribers';
public function shouldEnableForObject($object) {
return ($object instanceof PhabricatorSubscribableInterface);
}
public function getExtensionApplication() {
return new PhabricatorSubscriptionsApplication();
}
public function buildCurtainPanel($object) {
$viewer = $this->getViewer();
$object_phid = $object->getPHID();
$subscriber_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
$object_phid);
$handles = $viewer->loadHandles($subscriber_phids);
// TODO: This class can't accept a HandleList yet.
$handles = iterator_to_array($handles);
$susbscribers_view = id(new SubscriptionListStringBuilder())
->setObjectPHID($object_phid)
->setHandles($handles)
->buildPropertyString();
return $this->newPanel()
->setHeaderText(pht('Subscribers'))
->setOrder(20000)
->appendChild($susbscribers_view);
}
}