-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add loading spinner to download icon #17175
Conversation
|
||
var icon = $(context.$file).find('.fileactions .action-download img'); | ||
var sourceImage = icon.attr('src'); | ||
icon.attr('src', sourceImage.replace('actions/download.svg', 'loading-small.gif')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideal would be to work with CSS classes and have them define the icon.
But I guess you were short on time ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the action icons, I remember... not flexible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to break backwards compatibility here.
Another idea, still a bit hacky, is to delete the img element and insert a new one with the image. Or, the elegant but out of scope approach: improve FileActions to be able to show a spinner for ANY action (could be used for when loading the sharing dialog, delete, etc) |
I tried events like |
Ah ... didn't though about this. But it sounds nice :) I also thought about adding a element that gets an icon class applied and not adding an |
To test this add |
Interesting problem... The main problem seems to be that we don't have a 100% control over the sending mechanism. Otherwise, it would be easy to use a cookie. |
i like it 👍 |
There is a somewhat hackish way to check if a download request already came back (and therefore the download is shown in the browser):
|
Argh... sounds almost like a project on its own. |
Yes. Definetely something for a separate PR. |
@@ -599,6 +605,13 @@ a.action>img { | |||
opacity: 1; | |||
display:inline; | |||
} | |||
#fileList tr a.action.disabled { | |||
background: none; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because usually disabled links have a grey background.
Now the button has doesn't highlight on hover and can't be clicked a second time. (@craigpg requested this as an UX enhancement) @owncloud/designers please have a look at this. |
We maybe want to decrease the time to two seconds (download then should be started) |
@MorrisJobke the »disabled« look makes it a bit hard to see. I would keep the same opacity that it has when hovered / just clicked to make the feedback properly visible. |
Otherwise awesome! :) |
@bboule I added the download spinner to the multiselect download button. Please retest. |
It's a little bit confusing that the spinner also spins when the download has already been completed. |
The proper fix for this is #17175 (comment) 🙈 |
@LukasReschke I reduced the timeout to 2 seconds. |
Done. |
@MorrisJobke now it looks great ! Sorry that I still found a few things to comment on, but you're close to perfection now 😉 |
@PVince81 I highly appreciate your comments 😃 |
44190ee
to
43afa4c
Compare
@PVince81 Should I move the functions to the proposed places? |
@MorrisJobke yes please. This one #17175 (comment) |
A new inspection was created. |
The function is now moved :) @rullzer @Xenopathic @jancborchardt Happy testing & reviewing :) |
File download doesn’t work for me (folders work fine). Get redirected to http://127.0.0.1/owncloud/index.php/apps/files/ajax/download.php?dir=%2F&files=856.pdf&downloadStartSecret=ik90c30y1sn
|
Mmmh. Works here. Which browser? |
Working as expected here in firefox and chromium. |
@jancborchardt ping @PVince81 Can you have a final look at the changes and maybe also test if this works for you? |
OCA.Files.FileActions.updateFileActionSpinner(downloadFileaction, false); | ||
}; | ||
|
||
OCA.Files.FileActions.updateFileActionSpinner(downloadFileaction, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, here you can use "self.updateFileActionSpinner(...)". But you need to add var self = this;
at the top of the original method. See an example here: https://github.com/owncloud/core/blob/master/apps/files/js/filelist.js#L619
Feel free to leave it now. Just a hint for next time 😄
The code looks great now, thanks @MorrisJobke. Something that hacky needs to be tested in IE8 too. |
It looks like the spinner only appears if the browser is configured with an automatic save location. If you configure it to always show the "save as" dialog, no spinner is shown. |
Okay, Chromium 43 shows the spinner before showing the save dialog, which is nice. |
IE9 shows the spinner. Fine by me to merge 👍 @MorrisJobke do you intend to add a spinner later to the "Download" button on the top right of the public link page ? |
Yes. Separate PR |
Add loading spinner to download icon
Same like #17160 but for the file list.
I still don't like that it vanishes after the hardcoded 7 seconds. I searched a lot and tried many JS events to somehow detect, that the download is started but nothing worked.
cc @owncloud/designers @LukasReschke @craigpg @bobboule