1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Update Phlux to new UI

Summary: Updates view, list, edit pages on Phlux.

Test Plan: Create a variable, see variable, edit variable, view lists.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15602
This commit is contained in:
Chad Little 2016-04-03 14:59:11 -07:00
parent f90cd8a1ed
commit 12dca28193
3 changed files with 78 additions and 46 deletions

View file

@ -154,24 +154,34 @@ final class PhluxEditController extends PhluxController {
if ($is_new) {
$title = pht('Create Variable');
$crumbs->addTextCrumb($title, $request->getRequestURI());
$header_icon = 'fa-plus-square';
} else {
$title = pht('Edit %s', $key);
$title = pht('Edit Variable: %s', $key);
$header_icon = 'fa-pencil';
$crumbs->addTextCrumb($title, $request->getRequestURI());
}
$crumbs->setBorder(true);
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
$box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Variable'))
->setFormErrors($errors)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$form_box,
),
array(
'title' => $title,
$header = id(new PHUIHeaderView())
->setHeader($title)
->setHeaderIcon($header_icon);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter(array(
$box,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
}
}

View file

@ -13,6 +13,7 @@ final class PhluxListController extends PhluxController {
$vars = $query->executeWithCursorPager($pager);
$view = new PHUIObjectItemListView();
$view->setFlush(true);
foreach ($vars as $var) {
$key = $var->getVariableKey();
@ -28,19 +29,31 @@ final class PhluxListController extends PhluxController {
$crumbs = $this->buildApplicationCrumbs();
$box = id(new PHUIObjectBoxView())
->setHeaderText('Variables')
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->appendChild($view);
$title = pht('Variable List');
$header = id(new PHUIHeaderView())
->setHeader($title)
->setHeaderIcon('fa-copy');
$crumbs->addTextCrumb($title, $this->getApplicationURI());
$crumbs->setBorder(true);
return $this->buildApplicationPage(
array(
$crumbs,
$view,
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter(array(
$box,
$pager,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
}
}

View file

@ -15,40 +15,24 @@ final class PhluxViewController extends PhluxController {
return new Aphront404Response();
}
$crumbs = $this->buildApplicationCrumbs();
$title = $var->getVariableKey();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($title, $request->getRequestURI());
$crumbs->setBorder(true);
$curtain = $this->buildCurtainView($var);
$header = id(new PHUIHeaderView())
->setHeader($title)
->setUser($viewer)
->setPolicyObject($var);
$actions = id(new PhabricatorActionListView())
->setUser($viewer)
->setObject($var);
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$var,
PhabricatorPolicyCapability::CAN_EDIT);
$actions->addAction(
id(new PhabricatorActionView())
->setIcon('fa-pencil')
->setName(pht('Edit Variable'))
->setHref($this->getApplicationURI('/edit/'.$var->getVariableKey().'/'))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
->setPolicyObject($var)
->setHeaderIcon('fa-copy');
$display_value = json_encode($var->getVariableValue());
$properties = id(new PHUIPropertyListView())
->setUser($viewer)
->setObject($var)
->setActionList($actions)
->addProperty(pht('Value'), $display_value);
$timeline = $this->buildTransactionTimeline(
@ -57,18 +41,43 @@ final class PhluxViewController extends PhluxController {
$timeline->setShouldTerminate(true);
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->setHeaderText(pht('DETAILS'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->addPropertyList($properties);
return $this->buildApplicationPage(
array(
$crumbs,
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setCurtain($curtain)
->setMainColumn(array(
$object_box,
$timeline,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
}
private function buildCurtainView(PhluxVariable $var) {
$viewer = $this->getViewer();
$curtain = $this->newCurtainView($var);
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$var,
PhabricatorPolicyCapability::CAN_EDIT);
$curtain->addAction(
id(new PhabricatorActionView())
->setIcon('fa-pencil')
->setName(pht('Edit Variable'))
->setHref($this->getApplicationURI('/edit/'.$var->getVariableKey().'/'))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
return $curtain;
}
}