mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-25 06:50:55 +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:
parent
f90cd8a1ed
commit
12dca28193
3 changed files with 78 additions and 46 deletions
|
@ -154,24 +154,34 @@ final class PhluxEditController extends PhluxController {
|
||||||
if ($is_new) {
|
if ($is_new) {
|
||||||
$title = pht('Create Variable');
|
$title = pht('Create Variable');
|
||||||
$crumbs->addTextCrumb($title, $request->getRequestURI());
|
$crumbs->addTextCrumb($title, $request->getRequestURI());
|
||||||
|
$header_icon = 'fa-plus-square';
|
||||||
} else {
|
} else {
|
||||||
$title = pht('Edit %s', $key);
|
$title = pht('Edit Variable: %s', $key);
|
||||||
|
$header_icon = 'fa-pencil';
|
||||||
$crumbs->addTextCrumb($title, $request->getRequestURI());
|
$crumbs->addTextCrumb($title, $request->getRequestURI());
|
||||||
}
|
}
|
||||||
|
$crumbs->setBorder(true);
|
||||||
|
|
||||||
$form_box = id(new PHUIObjectBoxView())
|
$box = id(new PHUIObjectBoxView())
|
||||||
->setHeaderText($title)
|
->setHeaderText(pht('Variable'))
|
||||||
->setFormErrors($errors)
|
->setFormErrors($errors)
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
->setForm($form);
|
->setForm($form);
|
||||||
|
|
||||||
return $this->buildApplicationPage(
|
$header = id(new PHUIHeaderView())
|
||||||
array(
|
->setHeader($title)
|
||||||
$crumbs,
|
->setHeaderIcon($header_icon);
|
||||||
$form_box,
|
|
||||||
),
|
$view = id(new PHUITwoColumnView())
|
||||||
array(
|
->setHeader($header)
|
||||||
'title' => $title,
|
->setFooter(array(
|
||||||
|
$box,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
return $this->newPage()
|
||||||
|
->setTitle($title)
|
||||||
|
->setCrumbs($crumbs)
|
||||||
|
->appendChild($view);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ final class PhluxListController extends PhluxController {
|
||||||
$vars = $query->executeWithCursorPager($pager);
|
$vars = $query->executeWithCursorPager($pager);
|
||||||
|
|
||||||
$view = new PHUIObjectItemListView();
|
$view = new PHUIObjectItemListView();
|
||||||
|
$view->setFlush(true);
|
||||||
foreach ($vars as $var) {
|
foreach ($vars as $var) {
|
||||||
$key = $var->getVariableKey();
|
$key = $var->getVariableKey();
|
||||||
|
|
||||||
|
@ -28,19 +29,31 @@ final class PhluxListController extends PhluxController {
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
|
||||||
|
$box = id(new PHUIObjectBoxView())
|
||||||
|
->setHeaderText('Variables')
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
|
->appendChild($view);
|
||||||
|
|
||||||
$title = pht('Variable List');
|
$title = pht('Variable List');
|
||||||
|
$header = id(new PHUIHeaderView())
|
||||||
|
->setHeader($title)
|
||||||
|
->setHeaderIcon('fa-copy');
|
||||||
|
|
||||||
$crumbs->addTextCrumb($title, $this->getApplicationURI());
|
$crumbs->addTextCrumb($title, $this->getApplicationURI());
|
||||||
|
$crumbs->setBorder(true);
|
||||||
|
|
||||||
return $this->buildApplicationPage(
|
$view = id(new PHUITwoColumnView())
|
||||||
array(
|
->setHeader($header)
|
||||||
$crumbs,
|
->setFooter(array(
|
||||||
$view,
|
$box,
|
||||||
$pager,
|
$pager,
|
||||||
),
|
|
||||||
array(
|
|
||||||
'title' => $title,
|
|
||||||
));
|
));
|
||||||
|
|
||||||
|
return $this->newPage()
|
||||||
|
->setTitle($title)
|
||||||
|
->setCrumbs($crumbs)
|
||||||
|
->appendChild($view);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,40 +15,24 @@ final class PhluxViewController extends PhluxController {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
|
||||||
|
|
||||||
$title = $var->getVariableKey();
|
$title = $var->getVariableKey();
|
||||||
|
|
||||||
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$crumbs->addTextCrumb($title, $request->getRequestURI());
|
$crumbs->addTextCrumb($title, $request->getRequestURI());
|
||||||
|
$crumbs->setBorder(true);
|
||||||
|
|
||||||
|
$curtain = $this->buildCurtainView($var);
|
||||||
|
|
||||||
$header = id(new PHUIHeaderView())
|
$header = id(new PHUIHeaderView())
|
||||||
->setHeader($title)
|
->setHeader($title)
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setPolicyObject($var);
|
->setPolicyObject($var)
|
||||||
|
->setHeaderIcon('fa-copy');
|
||||||
$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));
|
|
||||||
|
|
||||||
$display_value = json_encode($var->getVariableValue());
|
$display_value = json_encode($var->getVariableValue());
|
||||||
|
|
||||||
$properties = id(new PHUIPropertyListView())
|
$properties = id(new PHUIPropertyListView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setObject($var)
|
|
||||||
->setActionList($actions)
|
|
||||||
->addProperty(pht('Value'), $display_value);
|
->addProperty(pht('Value'), $display_value);
|
||||||
|
|
||||||
$timeline = $this->buildTransactionTimeline(
|
$timeline = $this->buildTransactionTimeline(
|
||||||
|
@ -57,18 +41,43 @@ final class PhluxViewController extends PhluxController {
|
||||||
$timeline->setShouldTerminate(true);
|
$timeline->setShouldTerminate(true);
|
||||||
|
|
||||||
$object_box = id(new PHUIObjectBoxView())
|
$object_box = id(new PHUIObjectBoxView())
|
||||||
->setHeader($header)
|
->setHeaderText(pht('DETAILS'))
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
->addPropertyList($properties);
|
->addPropertyList($properties);
|
||||||
|
|
||||||
return $this->buildApplicationPage(
|
$view = id(new PHUITwoColumnView())
|
||||||
array(
|
->setHeader($header)
|
||||||
$crumbs,
|
->setCurtain($curtain)
|
||||||
|
->setMainColumn(array(
|
||||||
$object_box,
|
$object_box,
|
||||||
$timeline,
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue