[Pkg-owncloud-commits] [owncloud] 23/258: Highlight every uploaded files and scroll down to the last one
David Prévot
taffit at moszumanska.debian.org
Sat Oct 11 17:22:16 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 919d19c906d423bdb68a70ad7996a9bf692ebf99
Author: pdessauw <pdessauw at gmail.com>
Date: Thu Jun 19 14:11:57 2014 -0400
Highlight every uploaded files and scroll down to the last one
Backport of 0d078e48ce71d35bf240ec2b3d48a37f1b96115a from master
---
apps/files/css/upload.css | 24 +++++++++++++++++++++
apps/files/js/file-upload.js | 8 +++++++
apps/files/js/filelist.js | 50 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 82 insertions(+)
diff --git a/apps/files/css/upload.css b/apps/files/css/upload.css
index bdc258b..98754b9 100644
--- a/apps/files/css/upload.css
+++ b/apps/files/css/upload.css
@@ -137,3 +137,27 @@
.oc-dialog .oc-dialog-buttonrow .cancel {
float:left;
}
+
+.highlightUploaded {
+ -webkit-animation: highlightAnimation 2s 1;
+ -moz-animation: highlightAnimation 2s 1;
+ -o-animation: highlightAnimation 2s 1;
+ animation: highlightAnimation 2s 1;
+}
+
+ at -webkit-keyframes highlightAnimation {
+ 0% { background-color: rgba(255, 255, 140, 1); }
+ 100% { background-color: rgba(0, 0, 0, 0); }
+}
+ at -moz-keyframes highlightAnimation {
+ 0% { background-color: rgba(255, 255, 140, 1); }
+ 100% { background-color: rgba(0, 0, 0, 0); }
+}
+ at -o-keyframes highlightAnimation {
+ 0% { background-color: rgba(255, 255, 140, 1); }
+ 100% { background-color: rgba(0, 0, 0, 0); }
+}
+ at keyframes highlightAnimation {
+ 0% { background-color: rgba(255, 255, 140, 1); }
+ 100% { background-color: rgba(0, 0, 0, 0); }
+}
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index ff999ba..310799b 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -427,6 +427,14 @@ OC.Upload = {
data.textStatus = 'servererror';
data.errorThrown = result[0].data.message; // error message has been translated on server
fu._trigger('fail', e, data);
+ } else { // Successful upload
+ // Checking that the uploaded file is the last one and contained in the current directory
+ if (data.files[0] === data.originalFiles[data.originalFiles.length - 1] &&
+ result[0].directory === FileList.getCurrentDirectory()) {
+ // Scroll to the last uploaded file and highlight all of them
+ var fileList = _.pluck(data.originalFiles, 'name');
+ FileList.highlightFiles(fileList);
+ }
}
},
/**
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 33da6ed..165ee90 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1840,6 +1840,56 @@
self.updateStorageStatistics();
});
+ },
+
+ /**
+ * Scroll to the last file of the given list
+ * Highlight the list of files
+ * @param files array of filenames
+ */
+ highlightFiles: function(files) {
+ // Detection of the uploaded element
+ var filename = files[files.length - 1];
+ var $fileRow = this.findFileEl(filename);
+
+ while(!$fileRow.exists() && this._nextPage(false) !== false) { // Checking element existence
+ $fileRow = this.findFileEl(filename);
+ }
+
+ if (!$fileRow.exists()) { // Element not present in the file list
+ return;
+ }
+
+ var currentOffset = this.$container.scrollTop();
+ var additionalOffset = this.$el.find("#controls").height()+this.$el.find("#controls").offset().top;
+
+ // Animation
+ var _this = this;
+ this.$container.animate({
+ // Scrolling to the top of the new element
+ scrollTop: currentOffset + $fileRow.offset().top - $fileRow.height() * 2 - additionalOffset
+ }, {
+ duration: 500,
+ complete: function() {
+ // Highlighting function
+ var highlightRow = function($fileRow) {
+ $fileRow.addClass("highlightUploaded");
+ setTimeout(function() {
+ $fileRow.removeClass("highlightUploaded");
+ }, 2500);
+ };
+
+ // Loop over uploaded files
+ for(var i=0; i<files.length; i++) {
+ var $fileRow = _this.findFileEl(files[i]);
+
+ if($fileRow.length !== 0) { // Checking element existence
+ highlightRow($fileRow);
+ }
+ }
+
+ }
+ });
}
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list