Skip to content

Commit dd76143

Browse files
author
epriestley
committed
Pholio - make the form maintain client side edits between file uploads
Summary: Fixes T3553. Did it by adding some code that refreshes the File object on keyup events within a given file entry. also fixes an html derp I found trying to fix this. Test Plan: added cool things like 'bbb' to every field and noted they were maintained when I added more files Reviewers: btrahan Reviewed By: btrahan CC: aran, Korvin, chad Maniphest Tasks: T3553 Differential Revision: https://secure.phabricator.com/D6488
1 parent 33bc4d8 commit dd76143

17 files changed

+290
-452
lines changed

scripts/celerity_mapper.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@
141141
'javelin-behavior-differential-comment-jump',
142142
'javelin-behavior-differential-add-reviewers-and-ccs',
143143
'javelin-behavior-differential-keyboard-navigation',
144-
'javelin-behavior-aphront-drag-and-drop',
145144
'javelin-behavior-aphront-drag-and-drop-textarea',
146145
'javelin-behavior-phabricator-object-selector',
147146
'javelin-behavior-repository-crossreference',
@@ -164,7 +163,6 @@
164163
'maniphest.pkg.css' => array(
165164
'maniphest-task-summary-css',
166165
'maniphest-transaction-detail-css',
167-
'aphront-attached-file-view-css',
168166
'phabricator-project-tag-css',
169167
),
170168
'maniphest.pkg.js' => array(

src/__celerity_resource_map__.php

Lines changed: 51 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -798,15 +798,6 @@
798798
'disk' => '/rsrc/swf/aphlict.swf',
799799
'type' => 'swf',
800800
),
801-
'aphront-attached-file-view-css' =>
802-
array(
803-
'uri' => '/res/a6ca5487/rsrc/css/aphront/attached-file-view.css',
804-
'type' => 'css',
805-
'requires' =>
806-
array(
807-
),
808-
'disk' => '/rsrc/css/aphront/attached-file-view.css',
809-
),
810801
'aphront-bars' =>
811802
array(
812803
'uri' => '/res/95a907d6/rsrc/css/aphront/aphront-bars.css',
@@ -1289,19 +1280,6 @@
12891280
),
12901281
'disk' => '/rsrc/js/core/behavior-crop.js',
12911282
),
1292-
'javelin-behavior-aphront-drag-and-drop' =>
1293-
array(
1294-
'uri' => '/res/fde3763f/rsrc/js/core/behavior-drag-and-drop.js',
1295-
'type' => 'js',
1296-
'requires' =>
1297-
array(
1298-
0 => 'javelin-behavior',
1299-
1 => 'javelin-dom',
1300-
2 => 'phabricator-file-upload',
1301-
3 => 'phabricator-drag-and-drop-file-upload',
1302-
),
1303-
'disk' => '/rsrc/js/core/behavior-drag-and-drop.js',
1304-
),
13051283
'javelin-behavior-aphront-drag-and-drop-textarea' =>
13061284
array(
13071285
'uri' => '/res/a261f6e6/rsrc/js/core/behavior-drag-and-drop-textarea.js',
@@ -2254,6 +2232,21 @@
22542232
),
22552233
'disk' => '/rsrc/js/application/phame/phame-post-preview.js',
22562234
),
2235+
'javelin-behavior-pholio-mock-edit' =>
2236+
array(
2237+
'uri' => '/res/34a066b1/rsrc/js/application/pholio/behavior-pholio-mock-edit.js',
2238+
'type' => 'js',
2239+
'requires' =>
2240+
array(
2241+
0 => 'javelin-behavior',
2242+
1 => 'javelin-stratcom',
2243+
2 => 'javelin-dom',
2244+
3 => 'javelin-workflow',
2245+
4 => 'phabricator-phtize',
2246+
5 => 'phabricator-drag-and-drop-file-upload',
2247+
),
2248+
'disk' => '/rsrc/js/application/pholio/behavior-pholio-mock-edit.js',
2249+
),
22572250
'javelin-behavior-pholio-mock-view' =>
22582251
array(
22592252
'uri' => '/res/415cd66a/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
@@ -3751,7 +3744,7 @@
37513744
),
37523745
'pholio-edit-css' =>
37533746
array(
3754-
'uri' => '/res/c4a1f392/rsrc/css/application/pholio/pholio-edit.css',
3747+
'uri' => '/res/56034479/rsrc/css/application/pholio/pholio-edit.css',
37553748
'type' => 'css',
37563749
'requires' =>
37573750
array(
@@ -4319,7 +4312,7 @@
43194312
'uri' => '/res/pkg/dd27a69b/differential.pkg.css',
43204313
'type' => 'css',
43214314
),
4322-
'bb59a901' =>
4315+
'48040be9' =>
43234316
array(
43244317
'name' => 'differential.pkg.js',
43254318
'symbols' =>
@@ -4335,17 +4328,16 @@
43354328
8 => 'javelin-behavior-differential-comment-jump',
43364329
9 => 'javelin-behavior-differential-add-reviewers-and-ccs',
43374330
10 => 'javelin-behavior-differential-keyboard-navigation',
4338-
11 => 'javelin-behavior-aphront-drag-and-drop',
4339-
12 => 'javelin-behavior-aphront-drag-and-drop-textarea',
4340-
13 => 'javelin-behavior-phabricator-object-selector',
4341-
14 => 'javelin-behavior-repository-crossreference',
4342-
15 => 'javelin-behavior-load-blame',
4343-
16 => 'differential-inline-comment-editor',
4344-
17 => 'javelin-behavior-differential-dropdown-menus',
4345-
18 => 'javelin-behavior-differential-toggle-files',
4346-
19 => 'javelin-behavior-differential-user-select',
4331+
11 => 'javelin-behavior-aphront-drag-and-drop-textarea',
4332+
12 => 'javelin-behavior-phabricator-object-selector',
4333+
13 => 'javelin-behavior-repository-crossreference',
4334+
14 => 'javelin-behavior-load-blame',
4335+
15 => 'differential-inline-comment-editor',
4336+
16 => 'javelin-behavior-differential-dropdown-menus',
4337+
17 => 'javelin-behavior-differential-toggle-files',
4338+
18 => 'javelin-behavior-differential-user-select',
43474339
),
4348-
'uri' => '/res/pkg/bb59a901/differential.pkg.js',
4340+
'uri' => '/res/pkg/48040be9/differential.pkg.js',
43494341
'type' => 'js',
43504342
),
43514343
'c8ce2d88' =>
@@ -4400,17 +4392,16 @@
44004392
'uri' => '/res/pkg/a9f14d76/javelin.pkg.js',
44014393
'type' => 'js',
44024394
),
4403-
'adc3c36d' =>
4395+
'06bacb9a' =>
44044396
array(
44054397
'name' => 'maniphest.pkg.css',
44064398
'symbols' =>
44074399
array(
44084400
0 => 'maniphest-task-summary-css',
44094401
1 => 'maniphest-transaction-detail-css',
4410-
2 => 'aphront-attached-file-view-css',
4411-
3 => 'phabricator-project-tag-css',
4402+
2 => 'phabricator-project-tag-css',
44124403
),
4413-
'uri' => '/res/pkg/adc3c36d/maniphest.pkg.css',
4404+
'uri' => '/res/pkg/06bacb9a/maniphest.pkg.css',
44144405
'type' => 'css',
44154406
),
44164407
'98f64f07' =>
@@ -4430,7 +4421,6 @@
44304421
),
44314422
'reverse' =>
44324423
array(
4433-
'aphront-attached-file-view-css' => 'adc3c36d',
44344424
'aphront-dialog-view-css' => 'f69c023f',
44354425
'aphront-error-view-css' => 'f69c023f',
44364426
'aphront-form-view-css' => 'f69c023f',
@@ -4443,7 +4433,7 @@
44434433
'aphront-typeahead-control-css' => 'f69c023f',
44444434
'differential-changeset-view-css' => 'dd27a69b',
44454435
'differential-core-view-css' => 'dd27a69b',
4446-
'differential-inline-comment-editor' => 'bb59a901',
4436+
'differential-inline-comment-editor' => '48040be9',
44474437
'differential-local-commits-view-css' => 'dd27a69b',
44484438
'differential-results-table-css' => 'dd27a69b',
44494439
'differential-revision-add-comment-css' => 'dd27a69b',
@@ -4461,32 +4451,31 @@
44614451
'javelin-behavior-aphlict-dropdown' => '75ccea43',
44624452
'javelin-behavior-aphlict-listen' => '75ccea43',
44634453
'javelin-behavior-aphront-basic-tokenizer' => '75ccea43',
4464-
'javelin-behavior-aphront-drag-and-drop' => 'bb59a901',
4465-
'javelin-behavior-aphront-drag-and-drop-textarea' => 'bb59a901',
4454+
'javelin-behavior-aphront-drag-and-drop-textarea' => '48040be9',
44664455
'javelin-behavior-aphront-form-disable-on-submit' => '75ccea43',
44674456
'javelin-behavior-audit-preview' => '96909266',
44684457
'javelin-behavior-dark-console' => '4ccfeb47',
44694458
'javelin-behavior-device' => '75ccea43',
4470-
'javelin-behavior-differential-accept-with-errors' => 'bb59a901',
4471-
'javelin-behavior-differential-add-reviewers-and-ccs' => 'bb59a901',
4472-
'javelin-behavior-differential-comment-jump' => 'bb59a901',
4473-
'javelin-behavior-differential-diff-radios' => 'bb59a901',
4474-
'javelin-behavior-differential-dropdown-menus' => 'bb59a901',
4475-
'javelin-behavior-differential-edit-inline-comments' => 'bb59a901',
4476-
'javelin-behavior-differential-feedback-preview' => 'bb59a901',
4477-
'javelin-behavior-differential-keyboard-navigation' => 'bb59a901',
4478-
'javelin-behavior-differential-populate' => 'bb59a901',
4479-
'javelin-behavior-differential-show-more' => 'bb59a901',
4480-
'javelin-behavior-differential-toggle-files' => 'bb59a901',
4481-
'javelin-behavior-differential-user-select' => 'bb59a901',
4459+
'javelin-behavior-differential-accept-with-errors' => '48040be9',
4460+
'javelin-behavior-differential-add-reviewers-and-ccs' => '48040be9',
4461+
'javelin-behavior-differential-comment-jump' => '48040be9',
4462+
'javelin-behavior-differential-diff-radios' => '48040be9',
4463+
'javelin-behavior-differential-dropdown-menus' => '48040be9',
4464+
'javelin-behavior-differential-edit-inline-comments' => '48040be9',
4465+
'javelin-behavior-differential-feedback-preview' => '48040be9',
4466+
'javelin-behavior-differential-keyboard-navigation' => '48040be9',
4467+
'javelin-behavior-differential-populate' => '48040be9',
4468+
'javelin-behavior-differential-show-more' => '48040be9',
4469+
'javelin-behavior-differential-toggle-files' => '48040be9',
4470+
'javelin-behavior-differential-user-select' => '48040be9',
44824471
'javelin-behavior-diffusion-commit-graph' => '96909266',
44834472
'javelin-behavior-diffusion-pull-lastmodified' => '96909266',
44844473
'javelin-behavior-error-log' => '4ccfeb47',
44854474
'javelin-behavior-global-drag-and-drop' => '75ccea43',
44864475
'javelin-behavior-history-install' => '75ccea43',
44874476
'javelin-behavior-konami' => '75ccea43',
44884477
'javelin-behavior-lightbox-attachments' => '75ccea43',
4489-
'javelin-behavior-load-blame' => 'bb59a901',
4478+
'javelin-behavior-load-blame' => '48040be9',
44904479
'javelin-behavior-maniphest-batch-selector' => '98f64f07',
44914480
'javelin-behavior-maniphest-subpriority-editor' => '98f64f07',
44924481
'javelin-behavior-maniphest-transaction-controls' => '98f64f07',
@@ -4498,15 +4487,15 @@
44984487
'javelin-behavior-phabricator-hovercards' => '75ccea43',
44994488
'javelin-behavior-phabricator-keyboard-shortcuts' => '75ccea43',
45004489
'javelin-behavior-phabricator-nav' => '75ccea43',
4501-
'javelin-behavior-phabricator-object-selector' => 'bb59a901',
4490+
'javelin-behavior-phabricator-object-selector' => '48040be9',
45024491
'javelin-behavior-phabricator-oncopy' => '75ccea43',
45034492
'javelin-behavior-phabricator-remarkup-assist' => '75ccea43',
45044493
'javelin-behavior-phabricator-reveal-content' => '75ccea43',
45054494
'javelin-behavior-phabricator-search-typeahead' => '75ccea43',
45064495
'javelin-behavior-phabricator-tooltips' => '75ccea43',
45074496
'javelin-behavior-phabricator-watch-anchor' => '75ccea43',
45084497
'javelin-behavior-refresh-csrf' => '75ccea43',
4509-
'javelin-behavior-repository-crossreference' => 'bb59a901',
4498+
'javelin-behavior-repository-crossreference' => '48040be9',
45104499
'javelin-behavior-toggle-class' => '75ccea43',
45114500
'javelin-behavior-workflow' => '75ccea43',
45124501
'javelin-dom' => 'a9f14d76',
@@ -4529,15 +4518,15 @@
45294518
'javelin-vector' => 'a9f14d76',
45304519
'javelin-workflow' => 'a9f14d76',
45314520
'lightbox-attachment-css' => 'f69c023f',
4532-
'maniphest-task-summary-css' => 'adc3c36d',
4533-
'maniphest-transaction-detail-css' => 'adc3c36d',
4521+
'maniphest-task-summary-css' => '06bacb9a',
4522+
'maniphest-transaction-detail-css' => '06bacb9a',
45344523
'phabricator-action-list-view-css' => 'f69c023f',
45354524
'phabricator-application-launch-view-css' => 'f69c023f',
45364525
'phabricator-busy' => '75ccea43',
45374526
'phabricator-content-source-view-css' => 'dd27a69b',
45384527
'phabricator-core-css' => 'f69c023f',
45394528
'phabricator-crumbs-view-css' => 'f69c023f',
4540-
'phabricator-drag-and-drop-file-upload' => 'bb59a901',
4529+
'phabricator-drag-and-drop-file-upload' => '48040be9',
45414530
'phabricator-dropdown-menu' => '75ccea43',
45424531
'phabricator-file-upload' => '75ccea43',
45434532
'phabricator-filetree-view-css' => 'f69c023f',
@@ -4558,10 +4547,10 @@
45584547
'phabricator-object-selector-css' => 'dd27a69b',
45594548
'phabricator-phtize' => '75ccea43',
45604549
'phabricator-prefab' => '75ccea43',
4561-
'phabricator-project-tag-css' => 'adc3c36d',
4550+
'phabricator-project-tag-css' => '06bacb9a',
45624551
'phabricator-property-list-view-css' => 'f69c023f',
45634552
'phabricator-remarkup-css' => 'f69c023f',
4564-
'phabricator-shaped-request' => 'bb59a901',
4553+
'phabricator-shaped-request' => '48040be9',
45654554
'phabricator-side-menu-view-css' => 'f69c023f',
45664555
'phabricator-standard-page-view' => 'f69c023f',
45674556
'phabricator-tag-view-css' => 'f69c023f',

src/__phutil_library_map__.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
'Aphront403Response' => 'aphront/response/Aphront403Response.php',
1616
'Aphront404Response' => 'aphront/response/Aphront404Response.php',
1717
'AphrontAbstractAttachedFileView' => 'view/control/AphrontAbstractAttachedFileView.php',
18-
'AphrontAbstractFormDragAndDropUploadControl' => 'view/form/control/AphrontAbstractFormDragAndDropUploadControl.php',
1918
'AphrontAjaxResponse' => 'aphront/response/AphrontAjaxResponse.php',
2019
'AphrontApplicationConfiguration' => 'aphront/configuration/AphrontApplicationConfiguration.php',
21-
'AphrontAttachedFileView' => 'view/control/AphrontAttachedFileView.php',
2220
'AphrontBarView' => 'view/widget/bars/AphrontBarView.php',
2321
'AphrontCSRFException' => 'aphront/exception/AphrontCSRFException.php',
2422
'AphrontCalendarEventView' => 'applications/calendar/view/AphrontCalendarEventView.php',
@@ -38,7 +36,6 @@
3836
'AphrontFormCropControl' => 'view/form/control/AphrontFormCropControl.php',
3937
'AphrontFormDateControl' => 'view/form/control/AphrontFormDateControl.php',
4038
'AphrontFormDividerControl' => 'view/form/control/AphrontFormDividerControl.php',
41-
'AphrontFormDragAndDropUploadControl' => 'view/form/control/AphrontFormDragAndDropUploadControl.php',
4239
'AphrontFormFileControl' => 'view/form/control/AphrontFormFileControl.php',
4340
'AphrontFormImageControl' => 'view/form/control/AphrontFormImageControl.php',
4441
'AphrontFormInsetView' => 'view/form/AphrontFormInsetView.php',
@@ -1715,9 +1712,8 @@
17151712
'PholioConstants' => 'applications/pholio/constants/PholioConstants.php',
17161713
'PholioController' => 'applications/pholio/controller/PholioController.php',
17171714
'PholioDAO' => 'applications/pholio/storage/PholioDAO.php',
1718-
'PholioDragAndDropUploadControl' => 'applications/pholio/view/PholioDragAndDropUploadControl.php',
1719-
'PholioDropUploadController' => 'applications/pholio/controller/PholioDropUploadController.php',
17201715
'PholioImage' => 'applications/pholio/storage/PholioImage.php',
1716+
'PholioImageUploadController' => 'applications/pholio/controller/PholioImageUploadController.php',
17211717
'PholioInlineCommentEditView' => 'applications/pholio/view/PholioInlineCommentEditView.php',
17221718
'PholioInlineCommentSaveView' => 'applications/pholio/view/PholioInlineCommentSaveView.php',
17231719
'PholioInlineCommentView' => 'applications/pholio/view/PholioInlineCommentView.php',
@@ -1972,9 +1968,7 @@
19721968
'Aphront403Response' => 'AphrontHTMLResponse',
19731969
'Aphront404Response' => 'AphrontHTMLResponse',
19741970
'AphrontAbstractAttachedFileView' => 'AphrontView',
1975-
'AphrontAbstractFormDragAndDropUploadControl' => 'AphrontFormControl',
19761971
'AphrontAjaxResponse' => 'AphrontResponse',
1977-
'AphrontAttachedFileView' => 'AphrontAbstractAttachedFileView',
19781972
'AphrontBarView' => 'AphrontView',
19791973
'AphrontCSRFException' => 'AphrontException',
19801974
'AphrontCalendarEventView' => 'AphrontView',
@@ -1994,7 +1988,6 @@
19941988
'AphrontFormCropControl' => 'AphrontFormControl',
19951989
'AphrontFormDateControl' => 'AphrontFormControl',
19961990
'AphrontFormDividerControl' => 'AphrontFormControl',
1997-
'AphrontFormDragAndDropUploadControl' => 'AphrontAbstractFormDragAndDropUploadControl',
19981991
'AphrontFormFileControl' => 'AphrontFormControl',
19991992
'AphrontFormImageControl' => 'AphrontFormControl',
20001993
'AphrontFormInsetView' => 'AphrontView',
@@ -3705,13 +3698,12 @@
37053698
'PhluxViewController' => 'PhluxController',
37063699
'PholioController' => 'PhabricatorController',
37073700
'PholioDAO' => 'PhabricatorLiskDAO',
3708-
'PholioDragAndDropUploadControl' => 'AphrontAbstractFormDragAndDropUploadControl',
3709-
'PholioDropUploadController' => 'PholioController',
37103701
'PholioImage' =>
37113702
array(
37123703
0 => 'PholioDAO',
37133704
1 => 'PhabricatorMarkupInterface',
37143705
),
3706+
'PholioImageUploadController' => 'PholioController',
37153707
'PholioInlineCommentEditView' => 'AphrontView',
37163708
'PholioInlineCommentSaveView' => 'AphrontView',
37173709
'PholioInlineCommentView' => 'AphrontView',
@@ -3747,7 +3739,7 @@
37473739
'PholioTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
37483740
'PholioTransactionType' => 'PholioConstants',
37493741
'PholioTransactionView' => 'PhabricatorApplicationTransactionView',
3750-
'PholioUploadedImageView' => 'AphrontAbstractAttachedFileView',
3742+
'PholioUploadedImageView' => 'AphrontView',
37513743
'PhortuneAccount' =>
37523744
array(
37533745
0 => 'PhortuneDAO',

src/applications/files/controller/PhabricatorFileDropUploadController.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,6 @@
33
final class PhabricatorFileDropUploadController
44
extends PhabricatorFileController {
55

6-
private $viewObject;
7-
8-
public function setViewObject(AphrontAbstractAttachedFileView $view) {
9-
$this->viewObject = $view;
10-
return $this;
11-
}
12-
13-
public function getViewObject() {
14-
if (!$this->viewObject) {
15-
$this->viewObject = new AphrontAttachedFileView();
16-
}
17-
return $this->viewObject;
18-
}
19-
206
/**
217
* @phutil-external-symbol class PhabricatorStartup
228
*/
@@ -38,14 +24,10 @@ public function processRequest() {
3824
'isExplicitUpload' => true,
3925
));
4026

41-
$view = $this->getViewObject();
42-
$view->setFile($file);
43-
4427
return id(new AphrontAjaxResponse())->setContent(
4528
array(
4629
'id' => $file->getID(),
4730
'phid' => $file->getPHID(),
48-
'html' => $view->render(),
4931
'uri' => $file->getBestURI(),
5032
));
5133
}

src/applications/pholio/application/PhabricatorApplicationPholio.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public function getRoutes() {
5757
'edit/(?P<id>\d+)/' => 'PholioInlineEditController',
5858
'thumb/(?P<imageid>\d+)/' => 'PholioInlineThumbController'
5959
),
60-
'image/upload/' => 'PholioDropUploadController',
60+
'image/' => array(
61+
'upload/' => 'PholioImageUploadController',
62+
),
6163
),
6264
);
6365
}

src/applications/pholio/controller/PholioDropUploadController.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)