1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Add project tags to Pholio

Summary: T2628, adding project tags to pholio mocks

Test Plan: Create pholio mock, add project tag, save, project tag should show in mock properties on mock view.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9420
This commit is contained in:
lkassianik 2014-06-07 13:54:40 -07:00 committed by epriestley
parent 96d5a9b4c2
commit bfc594b3eb
3 changed files with 35 additions and 1 deletions

View file

@ -47,6 +47,15 @@ final class PholioMockEditController extends PholioController {
$mock_images = array();
}
if ($is_new) {
$v_projects = array();
} else {
$v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs(
$mock->getPHID(),
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT);
$v_projects = array_reverse($v_projects);
}
$e_name = true;
$e_images = true;
$errors = array();
@ -73,6 +82,7 @@ final class PholioMockEditController extends PholioController {
$v_status = $request->getStr('status');
$v_view = $request->getStr('can_view');
$v_cc = $request->getArr('cc');
$v_projects = $request->getArr('projects');
$mock_xactions = array();
$mock_xactions[$type_name] = $v_name;
@ -177,6 +187,7 @@ final class PholioMockEditController extends PholioController {
PholioTransactionType::TYPE_IMAGE_SEQUENCE)
->setNewValue(
array($existing_image->getPHID() => $sequence));
$posted_mock_images[] = $existing_image;
}
}
@ -191,6 +202,12 @@ final class PholioMockEditController extends PholioController {
}
if (!$errors) {
$proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT;
$xactions[] = id(new PholioTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
->setMetadataValue('edge:type', $proj_edge_type)
->setNewValue(array('=' => array_fuse($v_projects)));
$mock->openTransaction();
$editor = id(new PholioMockEditor())
->setContentSourceFromRequest($request)
@ -286,6 +303,12 @@ final class PholioMockEditController extends PholioController {
),
));
if ($v_projects) {
$project_handles = $this->loadViewerHandles($v_projects);
} else {
$project_handles = array();
}
require_celerity_resource('pholio-edit-css');
$form = id(new AphrontFormView())
->setUser($user)
@ -308,6 +331,12 @@ final class PholioMockEditController extends PholioController {
->setName('status')
->setValue($mock->getStatus())
->setOptions($mock->getStatuses()))
->appendChild(
id(new AphrontFormTokenizerControl())
->setLabel(pht('Projects'))
->setName('projects')
->setValue($project_handles)
->setDatasource('/typeahead/common/projects/'))
->appendChild(
id(new AphrontFormTokenizerControl())
->setLabel(pht('CC'))

View file

@ -203,6 +203,8 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
case PholioTransactionType::TYPE_STATUS:
$object->setStatus($xaction->getNewValue());
break;
case PhabricatorTransactions::TYPE_EDGE:
return;
}
}
@ -270,6 +272,8 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
$image->setSequence($value);
$image->save();
break;
case PhabricatorTransactions::TYPE_EDGE:
return;
}
}

View file

@ -7,7 +7,8 @@ final class PholioMock extends PholioDAO
PhabricatorSubscribableInterface,
PhabricatorTokenReceiverInterface,
PhabricatorFlaggableInterface,
PhabricatorApplicationTransactionInterface {
PhabricatorApplicationTransactionInterface,
PhabricatorProjectInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:description';