1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-22 20:51:10 +01:00

Make content more prominent in Files and move some details to the curtain

Summary: Ref T13528. Now that we're hinting users into Files, put the content first and move the detail panel under it. Move the most-useful details (author, size, dimensions) into the curtain.

Test Plan: {F7409925}

Maniphest Tasks: T13528

Differential Revision: https://secure.phabricator.com/D21201
This commit is contained in:
epriestley 2020-05-01 07:38:04 -07:00
parent 1edca1ee2a
commit fbbd2e35cb

View file

@ -81,8 +81,8 @@ final class PhabricatorFileViewController extends PhabricatorFileController {
->setCurtain($curtain)
->setMainColumn(
array(
$object_box,
$file_content,
$object_box,
$timeline,
));
@ -171,6 +171,47 @@ final class PhabricatorFileViewController extends PhabricatorFileController {
->setIcon('fa-crop')
->setHref($this->getApplicationURI("/transforms/{$id}/")));
$phids = array();
$viewer_phid = $viewer->getPHID();
$author_phid = $file->getAuthorPHID();
if ($author_phid) {
$phids[] = $author_phid;
}
$handles = $viewer->loadHandles($phids);
if ($author_phid) {
$author_refs = id(new PHUICurtainObjectRefListView())
->setViewer($viewer);
$author_ref = $author_refs->newObjectRefView()
->setHandle($handles[$author_phid])
->setEpoch($file->getDateCreated())
->setHighlighted($author_phid === $viewer_phid);
$curtain->newPanel()
->setHeaderText(pht('Authored By'))
->appendChild($author_refs);
}
$curtain->newPanel()
->setHeaderText(pht('Size'))
->appendChild(phutil_format_bytes($file->getByteSize()));
$width = $file->getImageWidth();
$height = $file->getImageHeight();
if ($width || $height) {
$curtain->newPanel()
->setHeaderText(pht('Dimensions'))
->appendChild(
pht(
"%spx \xC3\x97 %spx",
new PhutilNumber($width),
new PhutilNumber($height)));
}
return $curtain;
}
@ -183,36 +224,14 @@ final class PhabricatorFileViewController extends PhabricatorFileController {
$tab_group = id(new PHUITabGroupView());
$box->addTabGroup($tab_group);
$properties = id(new PHUIPropertyListView());
$finfo = new PHUIPropertyListView();
$tab_group->addTab(
id(new PHUITabView())
->setName(pht('Details'))
->setKey('details')
->appendChild($properties));
if ($file->getAuthorPHID()) {
$properties->addProperty(
pht('Author'),
$viewer->renderHandle($file->getAuthorPHID()));
}
$properties->addProperty(
pht('Created'),
phabricator_datetime($file->getDateCreated(), $viewer));
$finfo = id(new PHUIPropertyListView());
$tab_group->addTab(
id(new PHUITabView())
->setName(pht('File Info'))
->setKey('info')
->appendChild($finfo));
$finfo->addProperty(
pht('Size'),
phutil_format_bytes($file->getByteSize()));
$finfo->addProperty(
pht('Mime Type'),
$file->getMimeType());
@ -229,20 +248,6 @@ final class PhabricatorFileViewController extends PhabricatorFileController {
phutil_format_relative_time_detailed($delta)));
}
$width = $file->getImageWidth();
if ($width) {
$finfo->addProperty(
pht('Width'),
pht('%s px', new PhutilNumber($width)));
}
$height = $file->getImageHeight();
if ($height) {
$finfo->addProperty(
pht('Height'),
pht('%s px', new PhutilNumber($height)));
}
$is_image = $file->isViewableImage();
if ($is_image) {
$image_string = pht('Yes');
@ -283,16 +288,8 @@ final class PhabricatorFileViewController extends PhabricatorFileController {
$finfo->addProperty(pht('Attributes'), $types);
}
$storage_properties = new PHUIPropertyListView();
$tab_group->addTab(
id(new PHUITabView())
->setName(pht('Storage'))
->setKey('storage')
->appendChild($storage_properties));
$storage_properties->addProperty(
pht('Engine'),
$finfo->addProperty(
pht('Storage Engine'),
$file->getStorageEngine());
$engine = $this->loadStorageEngine($file);
@ -307,10 +304,10 @@ final class PhabricatorFileViewController extends PhabricatorFileController {
$format_name = pht('Unknown ("%s")', $format_key);
}
}
$storage_properties->addProperty(pht('Format'), $format_name);
$finfo->addProperty(pht('Storage Format'), $format_name);
$storage_properties->addProperty(
pht('Handle'),
$finfo->addProperty(
pht('Storage Handle'),
$file->getStorageHandle());