mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Show file comments on file lightboxes
Summary: Basic work in progress, but should show timeline comments for files when in lightbox mode. Looks reasonable. Test Plan: click on images, see comments from timeline. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T3612 Differential Revision: https://secure.phabricator.com/D16896
This commit is contained in:
parent
39509648f2
commit
8aeb7aa525
14 changed files with 371 additions and 86 deletions
|
@ -9,8 +9,8 @@ return array(
|
||||||
'names' => array(
|
'names' => array(
|
||||||
'conpherence.pkg.css' => '0b64e988',
|
'conpherence.pkg.css' => '0b64e988',
|
||||||
'conpherence.pkg.js' => '6249a1cf',
|
'conpherence.pkg.js' => '6249a1cf',
|
||||||
'core.pkg.css' => '2f1ecc57',
|
'core.pkg.css' => '347113ea',
|
||||||
'core.pkg.js' => 'f0648ee7',
|
'core.pkg.js' => '40e98735',
|
||||||
'darkconsole.pkg.js' => 'e7393ebb',
|
'darkconsole.pkg.js' => 'e7393ebb',
|
||||||
'differential.pkg.css' => 'a4ba74b5',
|
'differential.pkg.css' => 'a4ba74b5',
|
||||||
'differential.pkg.js' => '634399e9',
|
'differential.pkg.js' => '634399e9',
|
||||||
|
@ -21,8 +21,7 @@ return array(
|
||||||
'maniphest.pkg.js' => '949a7498',
|
'maniphest.pkg.js' => '949a7498',
|
||||||
'rsrc/css/aphront/aphront-bars.css' => '231ac33c',
|
'rsrc/css/aphront/aphront-bars.css' => '231ac33c',
|
||||||
'rsrc/css/aphront/dark-console.css' => 'f54bf286',
|
'rsrc/css/aphront/dark-console.css' => 'f54bf286',
|
||||||
'rsrc/css/aphront/dialog-view.css' => 'c076ef55',
|
'rsrc/css/aphront/dialog-view.css' => '49b2a8a3',
|
||||||
'rsrc/css/aphront/lightbox-attachment.css' => '90a84e83',
|
|
||||||
'rsrc/css/aphront/list-filter-view.css' => '5d6f0526',
|
'rsrc/css/aphront/list-filter-view.css' => '5d6f0526',
|
||||||
'rsrc/css/aphront/multi-column.css' => '84cc6640',
|
'rsrc/css/aphront/multi-column.css' => '84cc6640',
|
||||||
'rsrc/css/aphront/notification.css' => '3f6c89c9',
|
'rsrc/css/aphront/notification.css' => '3f6c89c9',
|
||||||
|
@ -133,6 +132,7 @@ return array(
|
||||||
'rsrc/css/phui/phui-chart.css' => '6bf6f78e',
|
'rsrc/css/phui/phui-chart.css' => '6bf6f78e',
|
||||||
'rsrc/css/phui/phui-cms.css' => 'be43c8a8',
|
'rsrc/css/phui/phui-cms.css' => 'be43c8a8',
|
||||||
'rsrc/css/phui/phui-comment-form.css' => '4ecc56ef',
|
'rsrc/css/phui/phui-comment-form.css' => '4ecc56ef',
|
||||||
|
'rsrc/css/phui/phui-comment-panel.css' => '85113e6a',
|
||||||
'rsrc/css/phui/phui-crumbs-view.css' => '195ac419',
|
'rsrc/css/phui/phui-crumbs-view.css' => '195ac419',
|
||||||
'rsrc/css/phui/phui-curtain-view.css' => '947bf1a4',
|
'rsrc/css/phui/phui-curtain-view.css' => '947bf1a4',
|
||||||
'rsrc/css/phui/phui-document-pro.css' => 'c354e312',
|
'rsrc/css/phui/phui-document-pro.css' => 'c354e312',
|
||||||
|
@ -151,6 +151,7 @@ return array(
|
||||||
'rsrc/css/phui/phui-info-panel.css' => '27ea50a1',
|
'rsrc/css/phui/phui-info-panel.css' => '27ea50a1',
|
||||||
'rsrc/css/phui/phui-info-view.css' => 'ec92802a',
|
'rsrc/css/phui/phui-info-view.css' => 'ec92802a',
|
||||||
'rsrc/css/phui/phui-invisible-character-view.css' => '6993d9f0',
|
'rsrc/css/phui/phui-invisible-character-view.css' => '6993d9f0',
|
||||||
|
'rsrc/css/phui/phui-lightbox.css' => 'e17ce2bd',
|
||||||
'rsrc/css/phui/phui-list.css' => '9da2aa00',
|
'rsrc/css/phui/phui-list.css' => '9da2aa00',
|
||||||
'rsrc/css/phui/phui-object-box.css' => '6b487c57',
|
'rsrc/css/phui/phui-object-box.css' => '6b487c57',
|
||||||
'rsrc/css/phui/phui-object-item-list-view.css' => '87278fa0',
|
'rsrc/css/phui/phui-object-item-list-view.css' => '87278fa0',
|
||||||
|
@ -504,7 +505,7 @@ return array(
|
||||||
'rsrc/js/core/behavior-hovercard.js' => 'bcaccd64',
|
'rsrc/js/core/behavior-hovercard.js' => 'bcaccd64',
|
||||||
'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0',
|
'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0',
|
||||||
'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0',
|
'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0',
|
||||||
'rsrc/js/core/behavior-lightbox-attachments.js' => 'e50dcfc0',
|
'rsrc/js/core/behavior-lightbox-attachments.js' => 'ec949017',
|
||||||
'rsrc/js/core/behavior-line-linker.js' => '1499a8cb',
|
'rsrc/js/core/behavior-line-linker.js' => '1499a8cb',
|
||||||
'rsrc/js/core/behavior-more.js' => 'a80d0378',
|
'rsrc/js/core/behavior-more.js' => 'a80d0378',
|
||||||
'rsrc/js/core/behavior-object-selector.js' => 'e0ec7f2f',
|
'rsrc/js/core/behavior-object-selector.js' => 'e0ec7f2f',
|
||||||
|
@ -544,7 +545,7 @@ return array(
|
||||||
'almanac-css' => 'dbb9b3af',
|
'almanac-css' => 'dbb9b3af',
|
||||||
'aphront-bars' => '231ac33c',
|
'aphront-bars' => '231ac33c',
|
||||||
'aphront-dark-console-css' => 'f54bf286',
|
'aphront-dark-console-css' => 'f54bf286',
|
||||||
'aphront-dialog-view-css' => 'c076ef55',
|
'aphront-dialog-view-css' => '49b2a8a3',
|
||||||
'aphront-list-filter-view-css' => '5d6f0526',
|
'aphront-list-filter-view-css' => '5d6f0526',
|
||||||
'aphront-multi-column-view-css' => '84cc6640',
|
'aphront-multi-column-view-css' => '84cc6640',
|
||||||
'aphront-panel-view-css' => '8427b78d',
|
'aphront-panel-view-css' => '8427b78d',
|
||||||
|
@ -650,7 +651,7 @@ return array(
|
||||||
'javelin-behavior-history-install' => '7ee2b591',
|
'javelin-behavior-history-install' => '7ee2b591',
|
||||||
'javelin-behavior-icon-composer' => '8499b6ab',
|
'javelin-behavior-icon-composer' => '8499b6ab',
|
||||||
'javelin-behavior-launch-icon-composer' => '48086888',
|
'javelin-behavior-launch-icon-composer' => '48086888',
|
||||||
'javelin-behavior-lightbox-attachments' => 'e50dcfc0',
|
'javelin-behavior-lightbox-attachments' => 'ec949017',
|
||||||
'javelin-behavior-line-chart' => 'e4232876',
|
'javelin-behavior-line-chart' => 'e4232876',
|
||||||
'javelin-behavior-load-blame' => '42126667',
|
'javelin-behavior-load-blame' => '42126667',
|
||||||
'javelin-behavior-maniphest-batch-editor' => '782ab6e7',
|
'javelin-behavior-maniphest-batch-editor' => '782ab6e7',
|
||||||
|
@ -766,7 +767,6 @@ return array(
|
||||||
'javelin-workboard-column' => '21df4ff5',
|
'javelin-workboard-column' => '21df4ff5',
|
||||||
'javelin-workboard-controller' => '55baf5ed',
|
'javelin-workboard-controller' => '55baf5ed',
|
||||||
'javelin-workflow' => '1e911d0f',
|
'javelin-workflow' => '1e911d0f',
|
||||||
'lightbox-attachment-css' => '90a84e83',
|
|
||||||
'maniphest-batch-editor' => 'b0f0b6d5',
|
'maniphest-batch-editor' => 'b0f0b6d5',
|
||||||
'maniphest-report-css' => '9b9580b7',
|
'maniphest-report-css' => '9b9580b7',
|
||||||
'maniphest-task-edit-css' => 'fda62a9b',
|
'maniphest-task-edit-css' => 'fda62a9b',
|
||||||
|
@ -847,6 +847,7 @@ return array(
|
||||||
'phui-chart-css' => '6bf6f78e',
|
'phui-chart-css' => '6bf6f78e',
|
||||||
'phui-cms-css' => 'be43c8a8',
|
'phui-cms-css' => 'be43c8a8',
|
||||||
'phui-comment-form-css' => '4ecc56ef',
|
'phui-comment-form-css' => '4ecc56ef',
|
||||||
|
'phui-comment-panel-css' => '85113e6a',
|
||||||
'phui-crumbs-view-css' => '195ac419',
|
'phui-crumbs-view-css' => '195ac419',
|
||||||
'phui-curtain-view-css' => '947bf1a4',
|
'phui-curtain-view-css' => '947bf1a4',
|
||||||
'phui-document-summary-view-css' => '9ca48bdf',
|
'phui-document-summary-view-css' => '9ca48bdf',
|
||||||
|
@ -868,6 +869,7 @@ return array(
|
||||||
'phui-info-view-css' => 'ec92802a',
|
'phui-info-view-css' => 'ec92802a',
|
||||||
'phui-inline-comment-view-css' => '5953c28e',
|
'phui-inline-comment-view-css' => '5953c28e',
|
||||||
'phui-invisible-character-view-css' => '6993d9f0',
|
'phui-invisible-character-view-css' => '6993d9f0',
|
||||||
|
'phui-lightbox-css' => 'e17ce2bd',
|
||||||
'phui-list-view-css' => '9da2aa00',
|
'phui-list-view-css' => '9da2aa00',
|
||||||
'phui-object-box-css' => '6b487c57',
|
'phui-object-box-css' => '6b487c57',
|
||||||
'phui-object-item-list-view-css' => '87278fa0',
|
'phui-object-item-list-view-css' => '87278fa0',
|
||||||
|
@ -1579,6 +1581,9 @@ return array(
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
'javelin-stratcom',
|
'javelin-stratcom',
|
||||||
),
|
),
|
||||||
|
'85113e6a' => array(
|
||||||
|
'phui-timeline-view-css',
|
||||||
|
),
|
||||||
'85ee8ce6' => array(
|
'85ee8ce6' => array(
|
||||||
'aphront-dialog-view-css',
|
'aphront-dialog-view-css',
|
||||||
),
|
),
|
||||||
|
@ -2102,15 +2107,6 @@ return array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
),
|
),
|
||||||
'e50dcfc0' => array(
|
|
||||||
'javelin-behavior',
|
|
||||||
'javelin-stratcom',
|
|
||||||
'javelin-dom',
|
|
||||||
'javelin-mask',
|
|
||||||
'javelin-util',
|
|
||||||
'phuix-icon-view',
|
|
||||||
'phabricator-busy',
|
|
||||||
),
|
|
||||||
'e5339c43' => array(
|
'e5339c43' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
|
@ -2131,6 +2127,15 @@ return array(
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
'phabricator-draggable-list',
|
'phabricator-draggable-list',
|
||||||
),
|
),
|
||||||
|
'ec949017' => array(
|
||||||
|
'javelin-behavior',
|
||||||
|
'javelin-stratcom',
|
||||||
|
'javelin-dom',
|
||||||
|
'javelin-mask',
|
||||||
|
'javelin-util',
|
||||||
|
'phuix-icon-view',
|
||||||
|
'phabricator-busy',
|
||||||
|
),
|
||||||
'edd1ba66' => array(
|
'edd1ba66' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-stratcom',
|
'javelin-stratcom',
|
||||||
|
@ -2283,7 +2288,8 @@ return array(
|
||||||
'phabricator-main-menu-view',
|
'phabricator-main-menu-view',
|
||||||
'phabricator-notification-css',
|
'phabricator-notification-css',
|
||||||
'phabricator-notification-menu-css',
|
'phabricator-notification-menu-css',
|
||||||
'lightbox-attachment-css',
|
'phui-lightbox-css',
|
||||||
|
'phui-comment-panel-css',
|
||||||
'phui-header-view-css',
|
'phui-header-view-css',
|
||||||
'phabricator-nav-view-css',
|
'phabricator-nav-view-css',
|
||||||
'phui-basic-nav-view-css',
|
'phui-basic-nav-view-css',
|
||||||
|
|
|
@ -111,7 +111,8 @@ return array(
|
||||||
'phabricator-main-menu-view',
|
'phabricator-main-menu-view',
|
||||||
'phabricator-notification-css',
|
'phabricator-notification-css',
|
||||||
'phabricator-notification-menu-css',
|
'phabricator-notification-menu-css',
|
||||||
'lightbox-attachment-css',
|
'phui-lightbox-css',
|
||||||
|
'phui-comment-panel-css',
|
||||||
'phui-header-view-css',
|
'phui-header-view-css',
|
||||||
'phabricator-nav-view-css',
|
'phabricator-nav-view-css',
|
||||||
'phui-basic-nav-view-css',
|
'phui-basic-nav-view-css',
|
||||||
|
|
|
@ -2653,6 +2653,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorFileImageProxyController' => 'applications/files/controller/PhabricatorFileImageProxyController.php',
|
'PhabricatorFileImageProxyController' => 'applications/files/controller/PhabricatorFileImageProxyController.php',
|
||||||
'PhabricatorFileImageTransform' => 'applications/files/transform/PhabricatorFileImageTransform.php',
|
'PhabricatorFileImageTransform' => 'applications/files/transform/PhabricatorFileImageTransform.php',
|
||||||
'PhabricatorFileInfoController' => 'applications/files/controller/PhabricatorFileInfoController.php',
|
'PhabricatorFileInfoController' => 'applications/files/controller/PhabricatorFileInfoController.php',
|
||||||
|
'PhabricatorFileLightboxController' => 'applications/files/controller/PhabricatorFileLightboxController.php',
|
||||||
'PhabricatorFileLinkView' => 'view/layout/PhabricatorFileLinkView.php',
|
'PhabricatorFileLinkView' => 'view/layout/PhabricatorFileLinkView.php',
|
||||||
'PhabricatorFileListController' => 'applications/files/controller/PhabricatorFileListController.php',
|
'PhabricatorFileListController' => 'applications/files/controller/PhabricatorFileListController.php',
|
||||||
'PhabricatorFileQuery' => 'applications/files/query/PhabricatorFileQuery.php',
|
'PhabricatorFileQuery' => 'applications/files/query/PhabricatorFileQuery.php',
|
||||||
|
@ -7623,6 +7624,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorFileImageProxyController' => 'PhabricatorFileController',
|
'PhabricatorFileImageProxyController' => 'PhabricatorFileController',
|
||||||
'PhabricatorFileImageTransform' => 'PhabricatorFileTransform',
|
'PhabricatorFileImageTransform' => 'PhabricatorFileTransform',
|
||||||
'PhabricatorFileInfoController' => 'PhabricatorFileController',
|
'PhabricatorFileInfoController' => 'PhabricatorFileController',
|
||||||
|
'PhabricatorFileLightboxController' => 'PhabricatorFileController',
|
||||||
'PhabricatorFileLinkView' => 'AphrontView',
|
'PhabricatorFileLinkView' => 'AphrontView',
|
||||||
'PhabricatorFileListController' => 'PhabricatorFileController',
|
'PhabricatorFileListController' => 'PhabricatorFileController',
|
||||||
'PhabricatorFileQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorFileQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
|
|
|
@ -76,6 +76,7 @@ final class PhabricatorFilesApplication extends PhabricatorApplication {
|
||||||
'dropupload/' => 'PhabricatorFileDropUploadController',
|
'dropupload/' => 'PhabricatorFileDropUploadController',
|
||||||
'compose/' => 'PhabricatorFileComposeController',
|
'compose/' => 'PhabricatorFileComposeController',
|
||||||
'comment/(?P<id>[1-9]\d*)/' => 'PhabricatorFileCommentController',
|
'comment/(?P<id>[1-9]\d*)/' => 'PhabricatorFileCommentController',
|
||||||
|
'thread/(?P<phid>[^/]+)/' => 'PhabricatorFileLightboxController',
|
||||||
'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorFileDeleteController',
|
'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorFileDeleteController',
|
||||||
'edit/(?P<id>[1-9]\d*)/' => 'PhabricatorFileEditController',
|
'edit/(?P<id>[1-9]\d*)/' => 'PhabricatorFileEditController',
|
||||||
'info/(?P<phid>[^/]+)/' => 'PhabricatorFileInfoController',
|
'info/(?P<phid>[^/]+)/' => 'PhabricatorFileInfoController',
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorFileLightboxController
|
||||||
|
extends PhabricatorFileController {
|
||||||
|
|
||||||
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
|
$phid = $request->getURIData('phid');
|
||||||
|
|
||||||
|
$file = id(new PhabricatorFileQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withPHIDs(array($phid))
|
||||||
|
->executeOne();
|
||||||
|
if (!$file) {
|
||||||
|
return new Aphront404Response();
|
||||||
|
}
|
||||||
|
|
||||||
|
$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.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
require_celerity_resource('phui-comment-panel-css');
|
||||||
|
$content = phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'phui-comment-panel',
|
||||||
|
),
|
||||||
|
$timeline);
|
||||||
|
|
||||||
|
return id(new AphrontAjaxResponse())
|
||||||
|
->setContent($content);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -98,7 +98,7 @@ final class PhabricatorEmbedFileRemarkupRule
|
||||||
PhabricatorObjectHandle $handle,
|
PhabricatorObjectHandle $handle,
|
||||||
array $options) {
|
array $options) {
|
||||||
|
|
||||||
require_celerity_resource('lightbox-attachment-css');
|
require_celerity_resource('phui-lightbox-css');
|
||||||
|
|
||||||
$attrs = array();
|
$attrs = array();
|
||||||
$image_class = 'phabricator-remarkup-embed-image';
|
$image_class = 'phabricator-remarkup-embed-image';
|
||||||
|
@ -176,6 +176,7 @@ final class PhabricatorEmbedFileRemarkupRule
|
||||||
'uri' => $file->getBestURI(),
|
'uri' => $file->getBestURI(),
|
||||||
'dUri' => $file->getDownloadURI(),
|
'dUri' => $file->getDownloadURI(),
|
||||||
'viewable' => true,
|
'viewable' => true,
|
||||||
|
'monogram' => $file->getMonogram(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
$img);
|
$img);
|
||||||
|
@ -279,7 +280,8 @@ final class PhabricatorEmbedFileRemarkupRule
|
||||||
->setFileName($this->assertFlatText($options['name']))
|
->setFileName($this->assertFlatText($options['name']))
|
||||||
->setFileDownloadURI($file->getDownloadURI())
|
->setFileDownloadURI($file->getDownloadURI())
|
||||||
->setFileViewURI($file->getBestURI())
|
->setFileViewURI($file->getBestURI())
|
||||||
->setFileViewable((bool)$options['viewable']);
|
->setFileViewable((bool)$options['viewable'])
|
||||||
|
->setFileMonogram($file->getMonogram());
|
||||||
}
|
}
|
||||||
|
|
||||||
private function parseDimension($string) {
|
private function parseDimension($string) {
|
||||||
|
|
|
@ -233,6 +233,10 @@ class PhabricatorApplicationTransactionView extends AphrontView {
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isTimelineEmpty() {
|
||||||
|
return !count($this->buildEvents(true));
|
||||||
|
}
|
||||||
|
|
||||||
protected function getOrBuildEngine() {
|
protected function getOrBuildEngine() {
|
||||||
if (!$this->engine) {
|
if (!$this->engine) {
|
||||||
$field = PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT;
|
$field = PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT;
|
||||||
|
|
|
@ -29,7 +29,7 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
|
||||||
|
|
||||||
// We need to have this if previews render images, since Ajax can not
|
// We need to have this if previews render images, since Ajax can not
|
||||||
// currently ship JS or CSS.
|
// currently ship JS or CSS.
|
||||||
require_celerity_resource('lightbox-attachment-css');
|
require_celerity_resource('phui-lightbox-css');
|
||||||
|
|
||||||
if (!$this->getDisabled()) {
|
if (!$this->getDisabled()) {
|
||||||
Javelin::initBehavior(
|
Javelin::initBehavior(
|
||||||
|
|
|
@ -7,12 +7,14 @@ final class PhabricatorFileLinkView extends AphrontView {
|
||||||
private $fileViewURI;
|
private $fileViewURI;
|
||||||
private $fileViewable;
|
private $fileViewable;
|
||||||
private $filePHID;
|
private $filePHID;
|
||||||
|
private $fileMonogram;
|
||||||
private $customClass;
|
private $customClass;
|
||||||
|
|
||||||
public function setCustomClass($custom_class) {
|
public function setCustomClass($custom_class) {
|
||||||
$this->customClass = $custom_class;
|
$this->customClass = $custom_class;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCustomClass() {
|
public function getCustomClass() {
|
||||||
return $this->customClass;
|
return $this->customClass;
|
||||||
}
|
}
|
||||||
|
@ -21,14 +23,25 @@ final class PhabricatorFileLinkView extends AphrontView {
|
||||||
$this->filePHID = $file_phid;
|
$this->filePHID = $file_phid;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getFilePHID() {
|
private function getFilePHID() {
|
||||||
return $this->filePHID;
|
return $this->filePHID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setFileMonogram($monogram) {
|
||||||
|
$this->fileMonogram = $monogram;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getFileMonogram() {
|
||||||
|
return $this->fileMonogram;
|
||||||
|
}
|
||||||
|
|
||||||
public function setFileViewable($file_viewable) {
|
public function setFileViewable($file_viewable) {
|
||||||
$this->fileViewable = $file_viewable;
|
$this->fileViewable = $file_viewable;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getFileViewable() {
|
private function getFileViewable() {
|
||||||
return $this->fileViewable;
|
return $this->fileViewable;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +50,7 @@ final class PhabricatorFileLinkView extends AphrontView {
|
||||||
$this->fileViewURI = $file_view_uri;
|
$this->fileViewURI = $file_view_uri;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getFileViewURI() {
|
private function getFileViewURI() {
|
||||||
return $this->fileViewURI;
|
return $this->fileViewURI;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +59,7 @@ final class PhabricatorFileLinkView extends AphrontView {
|
||||||
$this->fileDownloadURI = $file_download_uri;
|
$this->fileDownloadURI = $file_download_uri;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getFileDownloadURI() {
|
private function getFileDownloadURI() {
|
||||||
return $this->fileDownloadURI;
|
return $this->fileDownloadURI;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +68,7 @@ final class PhabricatorFileLinkView extends AphrontView {
|
||||||
$this->fileName = $file_name;
|
$this->fileName = $file_name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getFileName() {
|
private function getFileName() {
|
||||||
return $this->fileName;
|
return $this->fileName;
|
||||||
}
|
}
|
||||||
|
@ -64,12 +80,13 @@ final class PhabricatorFileLinkView extends AphrontView {
|
||||||
'uri' => $this->getFileViewURI(),
|
'uri' => $this->getFileViewURI(),
|
||||||
'dUri' => $this->getFileDownloadURI(),
|
'dUri' => $this->getFileDownloadURI(),
|
||||||
'name' => $this->getFileName(),
|
'name' => $this->getFileName(),
|
||||||
|
'monogram' => $this->getFileMonogram(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
require_celerity_resource('phabricator-remarkup-css');
|
require_celerity_resource('phabricator-remarkup-css');
|
||||||
require_celerity_resource('lightbox-attachment-css');
|
require_celerity_resource('phui-lightbox-css');
|
||||||
|
|
||||||
$sigil = null;
|
$sigil = null;
|
||||||
$meta = null;
|
$meta = null;
|
||||||
|
|
|
@ -271,6 +271,9 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView
|
||||||
$default_img_uri =
|
$default_img_uri =
|
||||||
celerity_get_resource_uri(
|
celerity_get_resource_uri(
|
||||||
'rsrc/image/icon/fatcow/document_black.png');
|
'rsrc/image/icon/fatcow/document_black.png');
|
||||||
|
$icon = id(new PHUIIconView())
|
||||||
|
->setIcon('fa-download');
|
||||||
|
$lightbox_id = celerity_generate_unique_node_id();
|
||||||
$download_form = phabricator_form(
|
$download_form = phabricator_form(
|
||||||
$user,
|
$user,
|
||||||
array(
|
array(
|
||||||
|
@ -281,12 +284,18 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView
|
||||||
),
|
),
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'button',
|
'button',
|
||||||
array('class' => 'button grey'),
|
array(
|
||||||
pht('Download')));
|
'class' => 'button grey has-icon',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
$icon,
|
||||||
|
pht('Download'),
|
||||||
|
)));
|
||||||
|
|
||||||
Javelin::initBehavior(
|
Javelin::initBehavior(
|
||||||
'lightbox-attachments',
|
'lightbox-attachments',
|
||||||
array(
|
array(
|
||||||
|
'lightbox_id' => $lightbox_id,
|
||||||
'defaultImageUri' => $default_img_uri,
|
'defaultImageUri' => $default_img_uri,
|
||||||
'downloadForm' => $download_form,
|
'downloadForm' => $download_form,
|
||||||
));
|
));
|
||||||
|
|
|
@ -108,6 +108,11 @@
|
||||||
opacity: 0.95;
|
opacity: 0.95;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.jx-white-mask {
|
||||||
|
background: #fff;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.jx-date-mask {
|
.jx-date-mask {
|
||||||
background: #292f33;
|
background: #292f33;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
|
60
webroot/rsrc/css/phui/phui-comment-panel.css
Normal file
60
webroot/rsrc/css/phui/phui-comment-panel.css
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/**
|
||||||
|
* @provides phui-comment-panel-css
|
||||||
|
* @requires phui-timeline-view-css
|
||||||
|
*/
|
||||||
|
|
||||||
|
.phui-comment-panel .phui-timeline-view {
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-comment-panel .phui-comment-panel-empty {
|
||||||
|
margin: 16px;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid {$thinblueborder};
|
||||||
|
background: {$lightbluebackground};
|
||||||
|
text-align: center;
|
||||||
|
color: {$lightbluetext};
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-comment-panel .phui-timeline-view .phui-timeline-event-view {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-comment-panel .phui-timeline-view .phui-timeline-image {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-comment-panel .phui-timeline-view .phui-timeline-wedge {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-comment-panel .phui-timeline-major-event .phui-timeline-group {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-comment-panel .phui-timeline-major-event .phui-timeline-title {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-comment-panel .phui-timeline-major-event .phui-timeline-title a {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-comment-panel .phui-timeline-icon-fill,
|
||||||
|
.phui-comment-panel .phui-timeline-menu {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-comment-panel .phui-timeline-major-event .phui-timeline-content {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-comment-panel .phui-timeline-major-event .phui-timeline-content
|
||||||
|
.phui-timeline-core-content {
|
||||||
|
border: none;
|
||||||
|
padding: 4px 0;
|
||||||
|
background: transparent;
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* @provides lightbox-attachment-css
|
* @provides phui-lightbox-css
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,26 +16,52 @@
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lightbox-attachment img {
|
.lightbox-attachment .lightbox-image-frame {
|
||||||
max-width: calc(100% - 44px);
|
|
||||||
max-height: calc(100% - 44px);
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 44px;
|
top: 44px;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lightbox-attachment.comment-panel-open .lightbox-image-frame {
|
||||||
|
right: 320px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lightbox-attachment .lightbox-image-frame img {
|
||||||
|
max-width: calc(100% - 40px);
|
||||||
|
max-height: calc(100% - 24px);
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lightbox-comment-frame {
|
||||||
|
position: absolute;
|
||||||
|
top: -19999px;
|
||||||
|
bottom: -19999px;
|
||||||
|
opacity: 0;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-panel-open .lightbox-comment-frame {
|
||||||
|
position: fixed;
|
||||||
|
top: 44px;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 320px;
|
||||||
|
overflow-y: auto;
|
||||||
|
background: #fff;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.jx-mask + .lightbox-attachment {
|
.jx-mask + .lightbox-attachment {
|
||||||
background: {$lightgreybackground};
|
background: {$lightgreybackground};
|
||||||
}
|
}
|
||||||
|
|
||||||
.lightbox-attachment .loading {
|
|
||||||
position: absolute;
|
|
||||||
top: -9999px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lightbox-attachment .attachment-name {
|
.lightbox-attachment .attachment-name {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
|
@ -52,20 +78,42 @@
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
line-height: 44px;
|
line-height: 44px;
|
||||||
border-bottom: 1px solid {$thinblueborder};
|
border-bottom: 1px solid {$thinblueborder};
|
||||||
|
color: {$greytext};
|
||||||
}
|
}
|
||||||
|
|
||||||
.lightbox-attachment .lightbox-status .lightbox-download {
|
.lightbox-attachment .lightbox-status .lightbox-download {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lightbox-attachment .lightbox-status a {
|
||||||
|
color: #000;
|
||||||
|
margin-right: 4px;
|
||||||
|
font-size: {$biggerfontsize};
|
||||||
|
}
|
||||||
|
|
||||||
|
.lightbox-download button.has-icon {
|
||||||
|
padding-left: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
.lightbox-attachment .lightbox-status .lightbox-download
|
.lightbox-attachment .lightbox-status .lightbox-download
|
||||||
.lightbox-download-form {
|
.lightbox-download-form {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lightbox-attachment .lightbox-comment {
|
||||||
|
float: right;
|
||||||
|
margin: 9px 0 0 8px;
|
||||||
|
padding-left: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lightbox-attachment.comment-panel-open .lightbox-comment,
|
||||||
|
.lightbox-attachment.comment-panel-open .lightbox-comment .phui-icon-view {
|
||||||
|
color: {$sky};
|
||||||
|
}
|
||||||
|
|
||||||
.lightbox-attachment .lightbox-close {
|
.lightbox-attachment .lightbox-close {
|
||||||
float: right;
|
float: right;
|
||||||
margin: 9px 0 0px 8px;
|
margin: 9px 0 0 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lightbox-attachment .lightbox-left {
|
.lightbox-attachment .lightbox-left {
|
||||||
|
@ -94,6 +142,10 @@
|
||||||
width: 21px;
|
width: 21px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lightbox-attachment.comment-panel-open .lightbox-right .phui-icon-view {
|
||||||
|
right: 322px;
|
||||||
|
}
|
||||||
|
|
||||||
.lightbox-attachment .lightbox-right .phui-icon-view {
|
.lightbox-attachment .lightbox-right .phui-icon-view {
|
||||||
font-size: 40px;
|
font-size: 40px;
|
||||||
}
|
}
|
|
@ -14,7 +14,34 @@ JX.behavior('lightbox-attachments', function (config) {
|
||||||
var lightbox = null;
|
var lightbox = null;
|
||||||
var prev = null;
|
var prev = null;
|
||||||
var next = null;
|
var next = null;
|
||||||
|
var shown = false;
|
||||||
var downloadForm = JX.$H(config.downloadForm).getFragment().firstChild;
|
var downloadForm = JX.$H(config.downloadForm).getFragment().firstChild;
|
||||||
|
var lightbox_id = config.lightbox_id;
|
||||||
|
|
||||||
|
function _toggleComment(e) {
|
||||||
|
e.kill();
|
||||||
|
shown = !shown;
|
||||||
|
JX.DOM.alterClass(JX.$(lightbox_id), 'comment-panel-open', shown);
|
||||||
|
}
|
||||||
|
|
||||||
|
function markCommentsLoading(loading) {
|
||||||
|
var frame = JX.$('lightbox-comment-frame');
|
||||||
|
JX.DOM.alterClass(frame, 'loading', loading);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onLoadCommentsResponse(r) {
|
||||||
|
var frame = JX.$('lightbox-comment-frame');
|
||||||
|
JX.DOM.setContent(frame, JX.$H(r));
|
||||||
|
markCommentsLoading(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadComments(phid) {
|
||||||
|
markCommentsLoading(true);
|
||||||
|
var uri = '/file/thread/' + phid + '/';
|
||||||
|
new JX.Workflow(uri)
|
||||||
|
.setHandler(onLoadCommentsResponse)
|
||||||
|
.start();
|
||||||
|
}
|
||||||
|
|
||||||
function loadLightBox(e) {
|
function loadLightBox(e) {
|
||||||
if (!e.isNormalClick()) {
|
if (!e.isNormalClick()) {
|
||||||
|
@ -61,10 +88,13 @@ JX.behavior('lightbox-attachments', function (config) {
|
||||||
} else {
|
} else {
|
||||||
img_uri = config.defaultImageUri;
|
img_uri = config.defaultImageUri;
|
||||||
extra_status = ' Image may not be representative of actual attachment.';
|
extra_status = ' Image may not be representative of actual attachment.';
|
||||||
name_element = JX.$N('div',
|
name_element =
|
||||||
{ className : 'attachment-name' },
|
JX.$N('div',
|
||||||
target_data.name
|
{
|
||||||
);
|
className : 'attachment-name'
|
||||||
|
},
|
||||||
|
target_data.name
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var alt_name = '';
|
var alt_name = '';
|
||||||
|
@ -72,44 +102,87 @@ JX.behavior('lightbox-attachments', function (config) {
|
||||||
alt_name = target_data.name;
|
alt_name = target_data.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
var img = JX.$N('img',
|
var img =
|
||||||
{
|
JX.$N('img',
|
||||||
className : 'loading',
|
{
|
||||||
alt : alt_name
|
className : 'loading',
|
||||||
}
|
alt : alt_name
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
|
||||||
lightbox = JX.$N('div',
|
var imgFrame =
|
||||||
{
|
JX.$N('div',
|
||||||
className : 'lightbox-attachment',
|
{
|
||||||
sigil: 'lightbox-attachment'
|
className : 'lightbox-image-frame',
|
||||||
},
|
},
|
||||||
img
|
img
|
||||||
);
|
);
|
||||||
|
|
||||||
var statusSpan = JX.$N('span',
|
var commentFrame =
|
||||||
{
|
JX.$N('div',
|
||||||
className: 'lightbox-status-txt'
|
{
|
||||||
},
|
className : 'lightbox-comment-frame',
|
||||||
'Image '+current+' of '+total+'.'+extra_status
|
id : 'lightbox-comment-frame'
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
|
||||||
var downloadSpan = JX.$N('span',
|
var commentClass = (shown) ? 'comment-panel-open' : '';
|
||||||
{
|
lightbox =
|
||||||
className : 'lightbox-download'
|
JX.$N('div',
|
||||||
});
|
{
|
||||||
var closeButton = JX.$N('a',
|
className : 'lightbox-attachment ' + commentClass,
|
||||||
{
|
sigil : 'lightbox-attachment',
|
||||||
className : 'lightbox-close button grey',
|
id : lightbox_id
|
||||||
href : '#'
|
},
|
||||||
},
|
[imgFrame, commentFrame]
|
||||||
'Close');
|
);
|
||||||
var statusHTML = JX.$N('div',
|
|
||||||
{
|
var monogram = JX.$N('strong', {}, target_data.monogram);
|
||||||
className : 'lightbox-status'
|
var m_url = JX.$N('a', { href : '/' + target_data.monogram }, monogram);
|
||||||
},
|
var statusSpan =
|
||||||
[statusSpan, closeButton, downloadSpan]
|
JX.$N('span',
|
||||||
);
|
{
|
||||||
|
className: 'lightbox-status-txt'
|
||||||
|
},
|
||||||
|
[
|
||||||
|
m_url,
|
||||||
|
' Image ' + current + ' of ' + total + '.' + extra_status
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
var downloadSpan =
|
||||||
|
JX.$N('span',
|
||||||
|
{
|
||||||
|
className : 'lightbox-download'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
var commentIcon = new JX.PHUIXIconView()
|
||||||
|
.setIcon('fa-comment-o')
|
||||||
|
.getNode();
|
||||||
|
var commentButton =
|
||||||
|
JX.$N('a',
|
||||||
|
{
|
||||||
|
className : 'lightbox-comment button grey has-icon',
|
||||||
|
href : '#',
|
||||||
|
sigil : 'lightbox-comment'
|
||||||
|
},
|
||||||
|
[commentIcon, 'Comment']
|
||||||
|
);
|
||||||
|
var closeButton =
|
||||||
|
JX.$N('a',
|
||||||
|
{
|
||||||
|
className : 'lightbox-close button grey',
|
||||||
|
href : '#'
|
||||||
|
},
|
||||||
|
'Close');
|
||||||
|
var statusHTML =
|
||||||
|
JX.$N('div',
|
||||||
|
{
|
||||||
|
className : 'lightbox-status'
|
||||||
|
},
|
||||||
|
[statusSpan, closeButton, commentButton, downloadSpan]
|
||||||
|
);
|
||||||
JX.DOM.appendContent(lightbox, statusHTML);
|
JX.DOM.appendContent(lightbox, statusHTML);
|
||||||
JX.DOM.appendContent(lightbox, name_element);
|
JX.DOM.appendContent(lightbox, name_element);
|
||||||
JX.DOM.listen(closeButton, 'click', null, closeLightBox);
|
JX.DOM.listen(closeButton, 'click', null, closeLightBox);
|
||||||
|
@ -120,12 +193,14 @@ JX.behavior('lightbox-attachments', function (config) {
|
||||||
.setIcon('fa-angle-right')
|
.setIcon('fa-angle-right')
|
||||||
.setColor('lightgreytext')
|
.setColor('lightgreytext')
|
||||||
.getNode();
|
.getNode();
|
||||||
leftIcon = JX.$N('a',
|
leftIcon =
|
||||||
{
|
JX.$N('a',
|
||||||
className : 'lightbox-right',
|
{
|
||||||
href : '#'
|
className : 'lightbox-right',
|
||||||
},
|
href : '#'
|
||||||
r_icon);
|
},
|
||||||
|
r_icon
|
||||||
|
);
|
||||||
JX.DOM.listen(leftIcon,
|
JX.DOM.listen(leftIcon,
|
||||||
'click',
|
'click',
|
||||||
null,
|
null,
|
||||||
|
@ -139,12 +214,14 @@ JX.behavior('lightbox-attachments', function (config) {
|
||||||
.setIcon('fa-angle-left')
|
.setIcon('fa-angle-left')
|
||||||
.setColor('lightgreytext')
|
.setColor('lightgreytext')
|
||||||
.getNode();
|
.getNode();
|
||||||
rightIcon = JX.$N('a',
|
rightIcon =
|
||||||
{
|
JX.$N('a',
|
||||||
className : 'lightbox-left',
|
{
|
||||||
href : '#'
|
className : 'lightbox-left',
|
||||||
},
|
href : '#'
|
||||||
l_icon);
|
},
|
||||||
|
l_icon
|
||||||
|
);
|
||||||
JX.DOM.listen(rightIcon,
|
JX.DOM.listen(rightIcon,
|
||||||
'click',
|
'click',
|
||||||
null,
|
null,
|
||||||
|
@ -168,6 +245,7 @@ JX.behavior('lightbox-attachments', function (config) {
|
||||||
};
|
};
|
||||||
|
|
||||||
img.src = img_uri;
|
img.src = img_uri;
|
||||||
|
loadComments(target_data.phid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO - make this work with KeyboardShortcut, which means
|
// TODO - make this work with KeyboardShortcut, which means
|
||||||
|
@ -252,4 +330,9 @@ JX.behavior('lightbox-attachments', function (config) {
|
||||||
e.kill();
|
e.kill();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
JX.Stratcom.listen(
|
||||||
|
'click',
|
||||||
|
'lightbox-comment',
|
||||||
|
_toggleComment);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue