Page MenuHomePhabricator

D19157.id.diff
No OneTemporary

D19157.id.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -10,7 +10,7 @@
'conpherence.pkg.css' => 'e68cf1fa',
'conpherence.pkg.js' => '15191c65',
'core.pkg.css' => '2fa91e14',
- 'core.pkg.js' => 'e7ce7bba',
+ 'core.pkg.js' => 'a3ceffdb',
'darkconsole.pkg.js' => '1f9a31bc',
'differential.pkg.css' => '113e692c',
'differential.pkg.js' => 'f6d809c0',
@@ -494,7 +494,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' => '560f41da',
+ 'rsrc/js/core/behavior-lightbox-attachments.js' => 'e31fad01',
'rsrc/js/core/behavior-line-linker.js' => '1499a8cb',
'rsrc/js/core/behavior-more.js' => 'a80d0378',
'rsrc/js/core/behavior-object-selector.js' => '77c1f0b0',
@@ -642,7 +642,7 @@
'javelin-behavior-history-install' => '7ee2b591',
'javelin-behavior-icon-composer' => '8499b6ab',
'javelin-behavior-launch-icon-composer' => '48086888',
- 'javelin-behavior-lightbox-attachments' => '560f41da',
+ 'javelin-behavior-lightbox-attachments' => 'e31fad01',
'javelin-behavior-line-chart' => 'e4232876',
'javelin-behavior-load-blame' => '42126667',
'javelin-behavior-maniphest-batch-selector' => 'ad54037e',
@@ -1359,15 +1359,6 @@
'javelin-vector',
'javelin-dom',
),
- '560f41da' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'javelin-mask',
- 'javelin-util',
- 'phuix-icon-view',
- 'phabricator-busy',
- ),
'58dea2fa' => array(
'javelin-install',
'javelin-util',
@@ -2070,6 +2061,15 @@
'javelin-dom',
'phabricator-draggable-list',
),
+ 'e31fad01' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'javelin-mask',
+ 'javelin-util',
+ 'phuix-icon-view',
+ 'phabricator-busy',
+ ),
'e379b58e' => array(
'javelin-behavior',
'javelin-stratcom',
diff --git a/src/view/layout/PhabricatorFileLinkView.php b/src/view/layout/PhabricatorFileLinkView.php
--- a/src/view/layout/PhabricatorFileLinkView.php
+++ b/src/view/layout/PhabricatorFileLinkView.php
@@ -134,21 +134,13 @@
$dl_icon = id(new PHUIIconView())
->setIcon('fa-download');
- $download_form = phabricator_form(
- $this->getViewer(),
+ $download_link = phutil_tag(
+ 'a',
array(
- 'action' => $this->getFileDownloadURI(),
- 'method' => 'POST',
- 'class' => 'embed-download-form',
- 'sigil' => 'embed-download-form download',
+ 'class' => 'phabricator-remarkup-embed-layout-download',
+ 'href' => $this->getFileDownloadURI(),
),
- phutil_tag(
- 'button',
- array(
- 'class' => 'phabricator-remarkup-embed-layout-download',
- 'type' => 'submit',
- ),
- pht('Download')));
+ pht('Download'));
$info = phutil_tag(
'span',
@@ -177,7 +169,7 @@
return array(
$icon,
$inner,
- $download_form,
+ $download_link,
);
}
}
diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php
--- a/src/view/page/PhabricatorStandardPageView.php
+++ b/src/view/page/PhabricatorStandardPageView.php
@@ -279,35 +279,7 @@
}
}
- $icon = id(new PHUIIconView())
- ->setIcon('fa-download')
- ->addClass('phui-icon-circle-icon');
- $lightbox_id = celerity_generate_unique_node_id();
- $download_form = phabricator_form(
- $user,
- array(
- 'action' => '#',
- 'method' => 'POST',
- 'class' => 'lightbox-download-form',
- 'sigil' => 'download lightbox-download-submit',
- 'id' => 'lightbox-download-form',
- ),
- phutil_tag(
- 'a',
- array(
- 'class' => 'lightbox-download phui-icon-circle hover-green',
- 'href' => '#',
- ),
- array(
- $icon,
- )));
-
- Javelin::initBehavior(
- 'lightbox-attachments',
- array(
- 'lightbox_id' => $lightbox_id,
- 'downloadForm' => $download_form,
- ));
+ Javelin::initBehavior('lightbox-attachments');
}
Javelin::initBehavior('aphront-form-disable-on-submit');
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
@@ -9,19 +9,18 @@
* phabricator-busy
*/
-JX.behavior('lightbox-attachments', function (config) {
+JX.behavior('lightbox-attachments', function() {
+
+ var lightbox = null;
- var lightbox = null;
var prev = null;
var next = null;
var shown = false;
- 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);
+ JX.DOM.alterClass(lightbox, 'comment-panel-open', shown);
}
function markCommentsLoading(loading) {
@@ -48,6 +47,12 @@
return;
}
+ // If you click the "Download" link inside an embedded file element,
+ // don't lightbox the file.
+ if (e.getNode('tag:a')) {
+ return;
+ }
+
e.kill();
var mainFrame = JX.$('main-page-frame');
@@ -82,8 +87,7 @@
var img_uri = '';
var img = '';
var extra_status = '';
- // for now, this conditional is always true
- // revisit if / when we decide to add non-images to lightbox view
+
if (target_data.viewable) {
img_uri = target_data.uri;
var alt_name = '';
@@ -114,7 +118,7 @@
{
className : 'lightbox-icon-frame',
sigil : 'lightbox-download-submit',
- href : '#',
+ href : target_data.dUri,
},
[ imgIcon, nameElement ]
);
@@ -138,12 +142,12 @@
);
var commentClass = (shown) ? 'comment-panel-open' : '';
+
lightbox =
JX.$N('div',
{
className : 'lightbox-attachment ' + commentClass,
- sigil : 'lightbox-attachment',
- id : lightbox_id
+ sigil : 'lightbox-attachment'
},
[imgFrame, commentFrame]
);
@@ -161,12 +165,17 @@
]
);
- var downloadSpan =
- JX.$N('span',
- {
- className : 'lightbox-download'
- }
- );
+ var download_icon = new JX.PHUIXIconView()
+ .setIcon('fa-download phui-icon-circle-icon')
+ .getNode();
+
+ var download_button = JX.$N(
+ 'a',
+ {
+ className: 'lightbox-download phui-icon-circle hover-sky',
+ href: target_data.dUri
+ },
+ download_icon);
var commentIcon = new JX.PHUIXIconView()
.setIcon('fa-comments phui-icon-circle-icon')
@@ -180,6 +189,7 @@
},
commentIcon
);
+
var closeIcon = new JX.PHUIXIconView()
.setIcon('fa-times phui-icon-circle-icon')
.getNode();
@@ -190,12 +200,13 @@
href : '#'
},
closeIcon);
+
var statusHTML =
JX.$N('div',
{
className : 'lightbox-status'
},
- [statusSpan, closeButton, commentButton, downloadSpan]
+ [statusSpan, closeButton, commentButton, download_button]
);
JX.DOM.appendContent(lightbox, statusHTML);
JX.DOM.listen(closeButton, 'click', null, closeLightBox);
@@ -246,9 +257,6 @@
JX.DOM.alterClass(document.body, 'lightbox-attached', true);
JX.Mask.show('jx-dark-mask');
- downloadForm.action = target_data.dUri;
- downloadSpan.appendChild(downloadForm);
-
document.body.appendChild(lightbox);
if (img_uri) {
@@ -365,23 +373,12 @@
'lightbox-comment-form',
_sendMessage);
- var _startDownload = function(e) {
- e.kill();
- var form = JX.$('lightbox-download-form');
- form.submit();
- };
-
var _startPageDownload = function(e) {
e.kill();
var form = e.getNode('tag:form');
form.submit();
};
- JX.Stratcom.listen(
- 'click',
- 'lightbox-download-submit',
- _startDownload);
-
JX.Stratcom.listen(
'click',
'embed-download-form',

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 28, 4:44 PM (6 h, 58 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6940332
Default Alt Text
D19157.id.diff (8 KB)

Event Timeline