Skip to content

Commit 3643fe1

Browse files
author
epriestley
committed
Use property tabs in Files
Summary: See screenshots. Some simplifications: - Tabbed and non-tabbed lists are now allowed to be mixed. We just make the non-tabbed lists permanent and put them on the bottom (e.g., image and audio data in Files). - You can provide a tab name instead of an entire tab object and we'll build an object for you. - We respect `setSelected()` on the tab objects now. Test Plan: See screenshots. Reviewers: chad, btrahan Reviewed By: chad CC: chad, aran Differential Revision: https://secure.phabricator.com/D7362
1 parent 2228029 commit 3643fe1

File tree

6 files changed

+125
-121
lines changed

6 files changed

+125
-121
lines changed

src/__celerity_resource_map__.php

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3921,7 +3921,7 @@
39213921
),
39223922
'phui-property-list-view-css' =>
39233923
array(
3924-
'uri' => '/res/7c39fbe1/rsrc/css/phui/phui-property-list-view.css',
3924+
'uri' => '/res/81bdc80f/rsrc/css/phui/phui-property-list-view.css',
39253925
'type' => 'css',
39263926
'requires' =>
39273927
array(
@@ -4309,7 +4309,7 @@
43094309
), array(
43104310
'packages' =>
43114311
array(
4312-
'7a1959db' =>
4312+
'71e32b00' =>
43134313
array(
43144314
'name' => 'core.pkg.css',
43154315
'symbols' =>
@@ -4358,7 +4358,7 @@
43584358
41 => 'phabricator-tag-view-css',
43594359
42 => 'phui-list-view-css',
43604360
),
4361-
'uri' => '/res/pkg/7a1959db/core.pkg.css',
4361+
'uri' => '/res/pkg/71e32b00/core.pkg.css',
43624362
'type' => 'css',
43634363
),
43644364
'2c1dba03' =>
@@ -4550,15 +4550,15 @@
45504550
),
45514551
'reverse' =>
45524552
array(
4553-
'aphront-dialog-view-css' => '7a1959db',
4554-
'aphront-error-view-css' => '7a1959db',
4555-
'aphront-list-filter-view-css' => '7a1959db',
4556-
'aphront-pager-view-css' => '7a1959db',
4557-
'aphront-panel-view-css' => '7a1959db',
4558-
'aphront-table-view-css' => '7a1959db',
4559-
'aphront-tokenizer-control-css' => '7a1959db',
4560-
'aphront-tooltip-css' => '7a1959db',
4561-
'aphront-typeahead-control-css' => '7a1959db',
4553+
'aphront-dialog-view-css' => '71e32b00',
4554+
'aphront-error-view-css' => '71e32b00',
4555+
'aphront-list-filter-view-css' => '71e32b00',
4556+
'aphront-pager-view-css' => '71e32b00',
4557+
'aphront-panel-view-css' => '71e32b00',
4558+
'aphront-table-view-css' => '71e32b00',
4559+
'aphront-tokenizer-control-css' => '71e32b00',
4560+
'aphront-tooltip-css' => '71e32b00',
4561+
'aphront-typeahead-control-css' => '71e32b00',
45624562
'differential-changeset-view-css' => '7cd7e387',
45634563
'differential-core-view-css' => '7cd7e387',
45644564
'differential-inline-comment-editor' => '5e9e5c4e',
@@ -4572,7 +4572,7 @@
45724572
'differential-table-of-contents-css' => '7cd7e387',
45734573
'diffusion-commit-view-css' => '270f4eb4',
45744574
'diffusion-icons-css' => '270f4eb4',
4575-
'global-drag-and-drop-css' => '7a1959db',
4575+
'global-drag-and-drop-css' => '71e32b00',
45764576
'inline-comment-summary-css' => '7cd7e387',
45774577
'javelin-aphlict' => '2c1dba03',
45784578
'javelin-behavior' => '3e3be199',
@@ -4647,56 +4647,56 @@
46474647
'javelin-util' => '3e3be199',
46484648
'javelin-vector' => '3e3be199',
46494649
'javelin-workflow' => '3e3be199',
4650-
'lightbox-attachment-css' => '7a1959db',
4650+
'lightbox-attachment-css' => '71e32b00',
46514651
'maniphest-task-summary-css' => '49898640',
4652-
'phabricator-action-list-view-css' => '7a1959db',
4653-
'phabricator-application-launch-view-css' => '7a1959db',
4652+
'phabricator-action-list-view-css' => '71e32b00',
4653+
'phabricator-application-launch-view-css' => '71e32b00',
46544654
'phabricator-busy' => '2c1dba03',
46554655
'phabricator-content-source-view-css' => '7cd7e387',
4656-
'phabricator-core-css' => '7a1959db',
4657-
'phabricator-crumbs-view-css' => '7a1959db',
4656+
'phabricator-core-css' => '71e32b00',
4657+
'phabricator-crumbs-view-css' => '71e32b00',
46584658
'phabricator-drag-and-drop-file-upload' => '5e9e5c4e',
46594659
'phabricator-dropdown-menu' => '2c1dba03',
46604660
'phabricator-file-upload' => '2c1dba03',
4661-
'phabricator-filetree-view-css' => '7a1959db',
4662-
'phabricator-flag-css' => '7a1959db',
4661+
'phabricator-filetree-view-css' => '71e32b00',
4662+
'phabricator-flag-css' => '71e32b00',
46634663
'phabricator-hovercard' => '2c1dba03',
4664-
'phabricator-jump-nav' => '7a1959db',
4664+
'phabricator-jump-nav' => '71e32b00',
46654665
'phabricator-keyboard-shortcut' => '2c1dba03',
46664666
'phabricator-keyboard-shortcut-manager' => '2c1dba03',
4667-
'phabricator-main-menu-view' => '7a1959db',
4667+
'phabricator-main-menu-view' => '71e32b00',
46684668
'phabricator-menu-item' => '2c1dba03',
4669-
'phabricator-nav-view-css' => '7a1959db',
4669+
'phabricator-nav-view-css' => '71e32b00',
46704670
'phabricator-notification' => '2c1dba03',
4671-
'phabricator-notification-css' => '7a1959db',
4672-
'phabricator-notification-menu-css' => '7a1959db',
4671+
'phabricator-notification-css' => '71e32b00',
4672+
'phabricator-notification-menu-css' => '71e32b00',
46734673
'phabricator-object-selector-css' => '7cd7e387',
46744674
'phabricator-phtize' => '2c1dba03',
46754675
'phabricator-prefab' => '2c1dba03',
46764676
'phabricator-project-tag-css' => '49898640',
4677-
'phabricator-remarkup-css' => '7a1959db',
4677+
'phabricator-remarkup-css' => '71e32b00',
46784678
'phabricator-shaped-request' => '5e9e5c4e',
4679-
'phabricator-side-menu-view-css' => '7a1959db',
4680-
'phabricator-standard-page-view' => '7a1959db',
4681-
'phabricator-tag-view-css' => '7a1959db',
4679+
'phabricator-side-menu-view-css' => '71e32b00',
4680+
'phabricator-standard-page-view' => '71e32b00',
4681+
'phabricator-tag-view-css' => '71e32b00',
46824682
'phabricator-textareautils' => '2c1dba03',
46834683
'phabricator-tooltip' => '2c1dba03',
4684-
'phabricator-transaction-view-css' => '7a1959db',
4685-
'phabricator-zindex-css' => '7a1959db',
4686-
'phui-button-css' => '7a1959db',
4687-
'phui-form-css' => '7a1959db',
4688-
'phui-form-view-css' => '7a1959db',
4689-
'phui-header-view-css' => '7a1959db',
4690-
'phui-icon-view-css' => '7a1959db',
4691-
'phui-list-view-css' => '7a1959db',
4692-
'phui-object-item-list-view-css' => '7a1959db',
4693-
'phui-property-list-view-css' => '7a1959db',
4694-
'phui-spacing-css' => '7a1959db',
4695-
'sprite-apps-large-css' => '7a1959db',
4696-
'sprite-gradient-css' => '7a1959db',
4697-
'sprite-icons-css' => '7a1959db',
4698-
'sprite-menu-css' => '7a1959db',
4699-
'sprite-status-css' => '7a1959db',
4700-
'syntax-highlighting-css' => '7a1959db',
4684+
'phabricator-transaction-view-css' => '71e32b00',
4685+
'phabricator-zindex-css' => '71e32b00',
4686+
'phui-button-css' => '71e32b00',
4687+
'phui-form-css' => '71e32b00',
4688+
'phui-form-view-css' => '71e32b00',
4689+
'phui-header-view-css' => '71e32b00',
4690+
'phui-icon-view-css' => '71e32b00',
4691+
'phui-list-view-css' => '71e32b00',
4692+
'phui-object-item-list-view-css' => '71e32b00',
4693+
'phui-property-list-view-css' => '71e32b00',
4694+
'phui-spacing-css' => '71e32b00',
4695+
'sprite-apps-large-css' => '71e32b00',
4696+
'sprite-gradient-css' => '71e32b00',
4697+
'sprite-icons-css' => '71e32b00',
4698+
'sprite-menu-css' => '71e32b00',
4699+
'sprite-status-css' => '71e32b00',
4700+
'syntax-highlighting-css' => '71e32b00',
47014701
),
47024702
));

src/applications/files/controller/PhabricatorFileInfoController.php

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public function processRequest() {
4444
}
4545

4646
$actions = $this->buildActionView($file);
47-
$properties_array = $this->buildPropertyView($file, $actions);
4847
$timeline = $this->buildTransactionView($file, $xactions);
4948
$crumbs = $this->buildApplicationCrumbs();
5049
$crumbs->setActionList($actions);
@@ -56,9 +55,7 @@ public function processRequest() {
5655
$object_box = id(new PHUIObjectBoxView())
5756
->setHeader($header);
5857

59-
foreach ($properties_array as $property_item) {
60-
$object_box->addPropertyList($property_item);
61-
}
58+
$this->buildPropertyViews($object_box, $file, $actions);
6259

6360
return $this->buildApplicationPage(
6461
array(
@@ -164,15 +161,17 @@ private function buildActionView(PhabricatorFile $file) {
164161
return $view;
165162
}
166163

167-
private function buildPropertyView(
164+
private function buildPropertyViews(
165+
PHUIObjectBoxView $box,
168166
PhabricatorFile $file,
169167
PhabricatorActionListView $actions) {
170168
$request = $this->getRequest();
171169
$user = $request->getUser();
172170

173-
$listview = array();
171+
174172
$properties = id(new PHUIPropertyListView());
175173
$properties->setActionList($actions);
174+
$box->addPropertyList($properties, pht('Details'));
176175

177176
if ($file->getAuthorPHID()) {
178177
$properties->addProperty(
@@ -184,55 +183,61 @@ private function buildPropertyView(
184183
pht('Created'),
185184
phabricator_datetime($file->getDateCreated(), $user));
186185

187-
$properties->addProperty(
186+
187+
$finfo = id(new PHUIPropertyListView());
188+
$box->addPropertyList($finfo, pht('File Info'));
189+
190+
$finfo->addProperty(
188191
pht('Size'),
189192
phabricator_format_bytes($file->getByteSize()));
190193

191-
$properties->addSectionHeader(pht('Technical Details'));
192-
193-
$properties->addProperty(
194+
$finfo->addProperty(
194195
pht('Mime Type'),
195196
$file->getMimeType());
196197

197-
$properties->addProperty(
198+
$width = $file->getImageWidth();
199+
if ($width) {
200+
$finfo->addProperty(
201+
pht('Width'),
202+
pht('%s px', new PhutilNumber($width)));
203+
}
204+
205+
$height = $file->getImageHeight();
206+
if ($height) {
207+
$finfo->addProperty(
208+
pht('Height'),
209+
pht('%s px', new PhutilNumber($height)));
210+
}
211+
212+
213+
$storage_properties = new PHUIPropertyListView();
214+
$box->addPropertyList($storage_properties, pht('Storage'));
215+
216+
$storage_properties->addProperty(
198217
pht('Engine'),
199218
$file->getStorageEngine());
200219

201-
$properties->addProperty(
220+
$storage_properties->addProperty(
202221
pht('Format'),
203222
$file->getStorageFormat());
204223

205-
$properties->addProperty(
224+
$storage_properties->addProperty(
206225
pht('Handle'),
207226
$file->getStorageHandle());
208227

209-
$listview[] = $properties;
210-
211-
$metadata = $file->getMetadata();
212-
if (!empty($metadata)) {
213-
$mdata = id(new PHUIPropertyListView())
214-
->addSectionHeader(pht('Metadata'));
215-
216-
foreach ($metadata as $key => $value) {
217-
$mdata->addProperty(
218-
PhabricatorFile::getMetadataName($key),
219-
$value);
220-
}
221-
$listview[] = $mdata;
222-
}
223228

224229
$phids = $file->getObjectPHIDs();
225230
if ($phids) {
226231
$attached = new PHUIPropertyListView();
227-
$attached->addSectionHeader(pht('Attached'));
232+
$box->addPropertyList($attached, pht('Attached'));
233+
228234
$attached->addProperty(
229235
pht('Attached To'),
230236
$this->renderHandlesForPHIDs($phids));
231-
$listview[] = $attached;
232237
}
233238

234-
if ($file->isViewableImage()) {
235239

240+
if ($file->isViewableImage()) {
236241
$image = phutil_tag(
237242
'img',
238243
array(
@@ -249,7 +254,8 @@ private function buildPropertyView(
249254

250255
$media = id(new PHUIPropertyListView())
251256
->addImageContent($linked_image);
252-
$listview[] = $media;
257+
258+
$box->addPropertyList($media);
253259
} else if ($file->isAudio()) {
254260
$audio = phutil_tag(
255261
'audio',
@@ -265,10 +271,9 @@ private function buildPropertyView(
265271
)));
266272
$media = id(new PHUIPropertyListView())
267273
->addImageContent($audio);
268-
$listview[] = $media;
269-
}
270274

271-
return $listview;
275+
$box->addPropertyList($media);
276+
}
272277
}
273278

274279
}

src/applications/files/storage/PhabricatorFile.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -725,22 +725,6 @@ public function copyDimensions(PhabricatorFile $file) {
725725
return $this;
726726
}
727727

728-
public static function getMetadataName($metadata) {
729-
switch ($metadata) {
730-
case self::METADATA_IMAGE_WIDTH:
731-
$name = pht('Width');
732-
break;
733-
case self::METADATA_IMAGE_HEIGHT:
734-
$name = pht('Height');
735-
break;
736-
default:
737-
$name = ucfirst($metadata);
738-
break;
739-
}
740-
741-
return $name;
742-
}
743-
744728

745729
/**
746730
* Load (or build) the {@class:PhabricatorFile} objects for builtin file

src/applications/uiexample/examples/PHUIPropertyListExample.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@ public function renderExample() {
1717

1818
$details1 = id(new PHUIListItemView())
1919
->setName('Details')
20-
->setSelected(true)
21-
->setType(PHUIListItemView::TYPE_LINK);
20+
->setSelected(true);
2221

2322
$details2 = id(new PHUIListItemView())
2423
->setName('Rainbow Info')
25-
->setStatusColor(PHUIListItemView::STATUS_WARN)
26-
->setType(PHUIListItemView::TYPE_LINK);
24+
->setStatusColor(PHUIListItemView::STATUS_WARN);
2725

2826
$details3 = id(new PHUIListItemView())
2927
->setName('Pasta Haiku')
30-
->setStatusColor(PHUIListItemView::STATUS_FAIL)
31-
->setType(PHUIListItemView::TYPE_LINK);
28+
->setStatusColor(PHUIListItemView::STATUS_FAIL);
3229

3330
$statustabs = id(new PHUIListView())
3431
->setType(PHUIListView::NAVBAR_LIST)

0 commit comments

Comments
 (0)