1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 21:32:43 +01:00

Update Files to new UI

Summary: Modernize Files a bit, use newPage

Test Plan: New file, drag and drop file, view file, edit file

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15631
This commit is contained in:
Chad Little 2016-04-05 15:55:04 -07:00
parent 46881c4ce5
commit 1914ea28eb
7 changed files with 89 additions and 68 deletions

View file

@ -155,8 +155,7 @@ final class PhabricatorFileComposeController
'defaultIcon' => $value_icon,
));
$dialog = id(new AphrontDialogView())
->setUser($viewer)
return $this->newDialog()
->setFormID($dialog_id)
->setClass('compose-dialog')
->setTitle(pht('Compose Image'))
@ -188,8 +187,6 @@ final class PhabricatorFileComposeController
->appendChild($icon_input)
->addCancelButton('/')
->addSubmitButton(pht('Save Image'));
return id(new AphrontDialogResponse())->setDialog($dialog);
}
private function getIconMap() {

View file

@ -29,17 +29,14 @@ final class PhabricatorFileDeleteController extends PhabricatorFileController {
return id(new AphrontRedirectResponse())->setURI('/file/');
}
$dialog = new AphrontDialogView();
$dialog->setUser($viewer);
$dialog->setTitle(pht('Really delete file?'));
$dialog->appendChild(hsprintf(
return $this->newDialog()
->setTitle(pht('Really delete file?'))
->appendChild(hsprintf(
'<p>%s</p>',
pht(
"Permanently delete '%s'? This action can not be undone.",
$file->getName())));
$dialog->addSubmitButton(pht('Delete'));
$dialog->addCancelButton($file->getInfoURI());
return id(new AphrontDialogResponse())->setDialog($dialog);
'Permanently delete "%s"? This action can not be undone.',
$file->getName())))
->addSubmitButton(pht('Delete'))
->addCancelButton($file->getInfoURI());
}
}

View file

@ -19,8 +19,9 @@ final class PhabricatorFileEditController extends PhabricatorFileController {
return new Aphront404Response();
}
$title = pht('Edit %s', $file->getName());
$title = pht('Edit File: %s', $file->getName());
$file_name = $file->getName();
$header_icon = 'fa-pencil';
$view_uri = '/'.$file->getMonogram();
$error_name = true;
$validation_exception = null;
@ -86,21 +87,28 @@ final class PhabricatorFileEditController extends PhabricatorFileController {
$crumbs = $this->buildApplicationCrumbs()
->addTextCrumb($file->getMonogram(), $view_uri)
->addTextCrumb(pht('Edit'));
->addTextCrumb(pht('Edit'))
->setBorder(true);
$object_box = id(new PHUIObjectBoxView())
$box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setValidationException($validation_exception)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->appendChild($form);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
));
$header = id(new PHUIHeaderView())
->setHeader($title)
->setHeaderIcon($header_icon);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter($box);
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
}
}

View file

@ -35,7 +35,8 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
$header = id(new PHUIHeaderView())
->setUser($viewer)
->setPolicyObject($file)
->setHeader($file->getName());
->setHeader($file->getName())
->setHeaderIcon('fa-file-o');
$ttl = $file->getTTL();
if ($ttl !== null) {
@ -55,28 +56,35 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
$header->addTag($partial_tag);
}
$actions = $this->buildActionView($file);
$curtain = $this->buildCurtainView($file);
$timeline = $this->buildTransactionView($file);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(
'F'.$file->getID(),
$this->getApplicationURI("/info/{$phid}/"));
$crumbs->setBorder(true);
$object_box = id(new PHUIObjectBoxView())
->setHeader($header);
->setHeaderText(pht('File'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
$this->buildPropertyViews($object_box, $file, $actions);
$this->buildPropertyViews($object_box, $file);
$title = $file->getName();
return $this->buildApplicationPage(
array(
$crumbs,
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setCurtain($curtain)
->setMainColumn(array(
$object_box,
$timeline,
),
array(
'title' => $file->getName(),
'pageObjects' => array($file->getPHID()),
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->setPageObjectPHIDs(array($file->getPHID()))
->appendChild($view);
}
private function buildTransactionView(PhabricatorFile $file) {
@ -108,7 +116,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
);
}
private function buildActionView(PhabricatorFile $file) {
private function buildCurtainView(PhabricatorFile $file) {
$viewer = $this->getViewer();
$id = $file->getID();
@ -118,14 +126,12 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
$file,
PhabricatorPolicyCapability::CAN_EDIT);
$view = id(new PhabricatorActionListView())
->setUser($viewer)
->setObject($file);
$curtain = $this->newCurtainView($file);
$can_download = !$file->getIsPartial();
if ($file->isViewableInBrowser()) {
$view->addAction(
$curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('View File'))
->setIcon('fa-file-o')
@ -133,7 +139,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
->setDisabled(!$can_download)
->setWorkflow(!$can_download));
} else {
$view->addAction(
$curtain->addAction(
id(new PhabricatorActionView())
->setUser($viewer)
->setRenderAsForm($can_download)
@ -145,7 +151,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
->setWorkflow(!$can_download));
}
$view->addAction(
$curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit File'))
->setIcon('fa-pencil')
@ -153,7 +159,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
->setWorkflow(!$can_edit)
->setDisabled(!$can_edit));
$view->addAction(
$curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Delete File'))
->setIcon('fa-times')
@ -161,24 +167,22 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
->setWorkflow(true)
->setDisabled(!$can_edit));
$view->addAction(
$curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('View Transforms'))
->setIcon('fa-crop')
->setHref($this->getApplicationURI("/transforms/{$id}/")));
return $view;
return $curtain;
}
private function buildPropertyViews(
PHUIObjectBoxView $box,
PhabricatorFile $file,
PhabricatorActionListView $actions) {
PhabricatorFile $file) {
$request = $this->getRequest();
$viewer = $request->getUser();
$properties = id(new PHUIPropertyListView());
$properties->setActionList($actions);
$box->addPropertyList($properties, pht('Details'));
if ($file->getAuthorPHID()) {

View file

@ -113,26 +113,35 @@ final class PhabricatorFileTransformListController
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($monogram, '/'.$monogram);
$crumbs->addTextCrumb(pht('Transforms'));
$crumbs->setBorder(true);
$dst_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('File Sources'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($dst_table);
$src_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Available Transforms'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($src_table);
return $this->buildApplicationPage(
array(
$crumbs,
$title = pht('%s Transforms', $file->getName());
$header = id(new PHUIHeaderView())
->setHeader($title)
->setHeaderIcon('fa-arrows-alt');
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter(array(
$dst_box,
$src_box,
),
array(
'title' => array(
pht('%s %s', $monogram, $file->getName()),
pht('Tranforms'),
),
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
}
}

View file

@ -81,6 +81,7 @@ final class PhabricatorFileUploadController extends PhabricatorFileController {
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Upload'), $request->getRequestURI());
$crumbs->setBorder(true);
$title = pht('Upload File');
@ -89,19 +90,26 @@ final class PhabricatorFileUploadController extends PhabricatorFileController {
->setShowIfSupportedID($support_id);
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setHeaderText(pht('File'))
->setFormErrors($errors)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$header = id(new PHUIHeaderView())
->setHeader($title)
->setHeaderIcon('fa-upload');
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter(array(
$form_box,
$global_upload,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
}
}

View file

@ -6,14 +6,12 @@ final class PhabricatorFileUploadDialogController
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$dialog = id(new AphrontDialogView())
->setUser($viewer)
return $this->newDialog()
->setTitle(pht('Upload File'))
->appendChild(pht(
'To add files, drag and drop them into the comment text area.'))
->addCancelButton('/', pht('Close'));
return id(new AphrontDialogResponse())->setDialog($dialog);
}
}