Make the Pholio download button actually download

Summary:
  - When the button is clicked, actually download the file or image.
  - Add aural hints for the icon-only buttons.
  - Use a "photo" icon for "view raw image", so the "arrows pointing outward" icon can be used for "fullscreen" some day.

Test Plan: Clicked link, got a download.

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9574
This commit is contained in:
epriestley
2014-06-16 09:15:25 -07:00
parent b12e2a4cc7
commit 0efa1ca643
3 changed files with 48 additions and 17 deletions

View File

@@ -591,11 +591,19 @@ JX.behavior('pholio-mock-view', function(config) {
var buttons = [];
var classes = ['pholio-image-button'];
if (image.isViewable) {
classes.push('pholio-image-button-active');
} else {
classes.push('pholio-image-button-disabled');
}
buttons.push(
JX.$N(
'div',
{
className: 'pholio-image-button'
className: classes.join(' ')
},
JX.$N(
image.isViewable ? 'a' : 'span',
@@ -606,16 +614,19 @@ JX.behavior('pholio-mock-view', function(config) {
},
JX.$H(config.fullIcon))));
// TODO: This should be a form which performs the download; for now, it
// just takes the user to the info page.
classes = ['pholio-image-button', 'pholio-image-button-active'];
buttons.push(
JX.$N(
'div',
'form',
{
className: 'pholio-image-button'
className: classes.join(' '),
action: image.downloadURI,
method: 'POST',
sigil: 'download'
},
JX.$N(
'a',
'button',
{
href: image.downloadURI,
className: 'pholio-image-button-link'