Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F17950017
D16907.id40697.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D16907.id40697.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -9,8 +9,8 @@
'names' => array(
'conpherence.pkg.css' => '0b64e988',
'conpherence.pkg.js' => '6249a1cf',
- 'core.pkg.css' => '347113ea',
- 'core.pkg.js' => '40e98735',
+ 'core.pkg.css' => '76bba02f',
+ 'core.pkg.js' => 'f26c8053',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => 'a4ba74b5',
'differential.pkg.js' => '634399e9',
@@ -151,7 +151,7 @@
'rsrc/css/phui/phui-info-panel.css' => '27ea50a1',
'rsrc/css/phui/phui-info-view.css' => 'ec92802a',
'rsrc/css/phui/phui-invisible-character-view.css' => '6993d9f0',
- 'rsrc/css/phui/phui-lightbox.css' => 'e17ce2bd',
+ 'rsrc/css/phui/phui-lightbox.css' => '33dfd46a',
'rsrc/css/phui/phui-list.css' => '9da2aa00',
'rsrc/css/phui/phui-object-box.css' => '6b487c57',
'rsrc/css/phui/phui-object-item-list-view.css' => '87278fa0',
@@ -505,7 +505,7 @@
'rsrc/js/core/behavior-hovercard.js' => 'bcaccd64',
'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0',
'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0',
- 'rsrc/js/core/behavior-lightbox-attachments.js' => 'ec949017',
+ 'rsrc/js/core/behavior-lightbox-attachments.js' => '16314fe8',
'rsrc/js/core/behavior-line-linker.js' => '1499a8cb',
'rsrc/js/core/behavior-more.js' => 'a80d0378',
'rsrc/js/core/behavior-object-selector.js' => 'e0ec7f2f',
@@ -651,7 +651,7 @@
'javelin-behavior-history-install' => '7ee2b591',
'javelin-behavior-icon-composer' => '8499b6ab',
'javelin-behavior-launch-icon-composer' => '48086888',
- 'javelin-behavior-lightbox-attachments' => 'ec949017',
+ 'javelin-behavior-lightbox-attachments' => '16314fe8',
'javelin-behavior-line-chart' => 'e4232876',
'javelin-behavior-load-blame' => '42126667',
'javelin-behavior-maniphest-batch-editor' => '782ab6e7',
@@ -869,7 +869,7 @@
'phui-info-view-css' => 'ec92802a',
'phui-inline-comment-view-css' => '5953c28e',
'phui-invisible-character-view-css' => '6993d9f0',
- 'phui-lightbox-css' => 'e17ce2bd',
+ 'phui-lightbox-css' => '33dfd46a',
'phui-list-view-css' => '9da2aa00',
'phui-object-box-css' => '6b487c57',
'phui-object-item-list-view-css' => '87278fa0',
@@ -1039,6 +1039,15 @@
'javelin-workflow',
'javelin-workboard-controller',
),
+ '16314fe8' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'javelin-mask',
+ 'javelin-util',
+ 'phuix-icon-view',
+ 'phabricator-busy',
+ ),
'185bbd53' => array(
'javelin-install',
),
@@ -2127,15 +2136,6 @@
'javelin-dom',
'phabricator-draggable-list',
),
- 'ec949017' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'javelin-mask',
- 'javelin-util',
- 'phuix-icon-view',
- 'phabricator-busy',
- ),
'edd1ba66' => array(
'javelin-behavior',
'javelin-stratcom',
diff --git a/src/applications/files/controller/PhabricatorFileLightboxController.php b/src/applications/files/controller/PhabricatorFileLightboxController.php
--- a/src/applications/files/controller/PhabricatorFileLightboxController.php
+++ b/src/applications/files/controller/PhabricatorFileLightboxController.php
@@ -6,6 +6,7 @@
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$phid = $request->getURIData('phid');
+ $comment = $request->getStr('comment');
$file = id(new PhabricatorFileQuery())
->setViewer($viewer)
@@ -15,18 +16,30 @@
return new Aphront404Response();
}
+ if (strlen($comment)) {
+ $xactions = array();
+ $xactions[] = id(new PhabricatorFileTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
+ ->attachComment(
+ id(new PhabricatorFileTransactionComment())
+ ->setContent($comment));
+
+ $editor = id(new PhabricatorFileEditor())
+ ->setActor($viewer)
+ ->setContinueOnNoEffect(true)
+ ->setContentSourceFromRequest($request);
+
+ $editor->applyTransactions($file, $xactions);
+ }
+
$transactions = id(new PhabricatorFileTransactionQuery())
->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT));
$timeline = $this->buildTransactionTimeline($file, $transactions);
if ($timeline->isTimelineEmpty()) {
- $timeline = phutil_tag(
- 'div',
- array(
- 'class' => 'phui-comment-panel-empty',
- ),
- pht('No comments.'));
+ //
}
+ $comment_form = $this->renderCommentForm($file);
require_celerity_resource('phui-comment-panel-css');
$content = phutil_tag(
@@ -34,10 +47,51 @@
array(
'class' => 'phui-comment-panel',
),
- $timeline);
+ array(
+ $timeline,
+ $comment_form,
+ ));
return id(new AphrontAjaxResponse())
->setContent($content);
}
+ private function renderCommentForm(PhabricatorFile $file) {
+ $viewer = $this->getViewer();
+
+ if (!$viewer->isLoggedIn()) {
+ $login_href = id(new PhutilURI('/auth/start/'))
+ ->setQueryParam('next', '/'.$file->getMonogram());
+ return id(new PHUIFormLayoutView())
+ ->addClass('phui-comment-panel-empty')
+ ->appendChild(
+ id(new PHUIButtonView())
+ ->setTag('a')
+ ->setText(pht('Login to Comment'))
+ ->setHref((string)$login_href));
+ }
+
+ $draft = PhabricatorDraft::newFromUserAndKey(
+ $viewer,
+ $file->getPHID());
+ $post_uri = $this->getApplicationURI('thread/'.$file->getPHID().'/');
+
+ $form = id(new AphrontFormView())
+ ->setUser($viewer)
+ ->setAction($post_uri)
+ ->addSigil('lightbox-comment-form')
+ ->addClass('lightbox-comment-form')
+ ->setWorkflow(true)
+ ->appendChild(
+ id(new PhabricatorRemarkupControl())
+ ->setUser($viewer)
+ ->setName('comment')
+ ->setValue($draft->getDraft()));
+
+ $view = phutil_tag_div('phui-comment-panel', $form);
+
+ return $view;
+
+ }
+
}
diff --git a/webroot/rsrc/css/phui/phui-lightbox.css b/webroot/rsrc/css/phui/phui-lightbox.css
--- a/webroot/rsrc/css/phui/phui-lightbox.css
+++ b/webroot/rsrc/css/phui/phui-lightbox.css
@@ -153,3 +153,22 @@
.lightbox-attachment .lightbox-right:hover .phui-icon-view {
color: {$sky};
}
+
+.lightbox-comment-form .aphront-form-control {
+ padding: 0;
+}
+
+.lightbox-comment-form .aphront-form-input {
+ margin: 0;
+ width: auto;
+}
+
+.lightbox-comment-form .remarkup-assist-bar {
+ display: none;
+}
+
+.lightbox-comment-form .aphront-form-input .remarkup-assist-textarea {
+ border-radius: 3px;
+ border: 1px solid {$blueborder};
+ height: 6em;
+}
diff --git a/webroot/rsrc/js/core/behavior-lightbox-attachments.js b/webroot/rsrc/js/core/behavior-lightbox-attachments.js
--- a/webroot/rsrc/js/core/behavior-lightbox-attachments.js
+++ b/webroot/rsrc/js/core/behavior-lightbox-attachments.js
@@ -335,4 +335,35 @@
'lightbox-comment',
_toggleComment);
+ var _sendMessage = function(e) {
+ e.kill();
+ var form = e.getNode('tag:form');
+ JX.Workflow.newFromForm(form)
+ .setHandler(onLoadCommentsResponse)
+ .start();
+ };
+
+ JX.Stratcom.listen(
+ ['submit', 'didSyntheticSubmit'],
+ 'lightbox-comment-form',
+ _sendMessage);
+
+ JX.Stratcom.listen(
+ 'keydown',
+ 'lightbox-comment-form',
+ function(e) {
+ if (e.getSpecialKey() != 'return') {
+ return;
+ }
+
+ var raw = e.getRawEvent();
+ if (raw.shiftKey) {
+ return;
+ }
+
+ e.kill();
+ _sendMessage(e);
+ });
+
+
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 2, 12:05 AM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8489723
Default Alt Text
D16907.id40697.diff (7 KB)
Attached To
Mode
D16907: Ajax commenting on lightbox images
Attached
Detach File
Event Timeline
Log In to Comment