summaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-09-19 17:00:54 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-09-19 17:00:54 +0200
commit7e0631b3b81a5669620122964d0326ead187de30 (patch)
tree9370b9d5ac99f148d2bc724f76c805b772af7d2d /apps/files/js
parent98ff8478301676c99ffefd5756ad22466dfb6acf (diff)
parentbd5cb1d801a16933b7b75af5c514caec2afa5fef (diff)
downloadnextcloud-server-7e0631b3b81a5669620122964d0326ead187de30.tar.gz
nextcloud-server-7e0631b3b81a5669620122964d0326ead187de30.zip
Merge branch 'master' into fix_3728_with_file_exists_dialog
Conflicts: apps/files/js/filelist.js
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/fileactions.js5
-rw-r--r--apps/files/js/filelist.js49
-rw-r--r--apps/files/js/files.js5
3 files changed, 53 insertions, 6 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index af7c757276e..67d3d5ead8d 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -68,6 +68,9 @@ var FileActions = {
if ($('tr[data-file="'+file+'"]').data('renaming')) {
return;
}
+
+ // recreate fileactions
+ parent.children('a.name').find('.fileactions').remove();
parent.children('a.name').append('<span class="fileactions" />');
var defaultAction = FileActions.getDefault(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
@@ -117,6 +120,8 @@ var FileActions = {
addAction('Share', actions.Share);
}
+ // remove the existing delete action
+ parent.parent().children().last().find('.action.delete').remove();
if (actions['Delete']) {
var img = FileActions.icons['Delete'];
if (img.call) {
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 39df91c94b4..4fc1b95a0ab 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -130,7 +130,6 @@ var FileList={
if (hidden) {
tr.hide();
}
- FileActions.display(tr.find('td.filename'));
return tr;
},
addDir:function(name,size,lastModified,hidden){
@@ -643,6 +642,37 @@ var FileList={
if (FileList._maskTimeout){
window.clearTimeout(FileList._maskTimeout);
}
+ },
+ scrollTo:function(file) {
+ //scroll to and highlight preselected file
+ var scrolltorow = $('tr[data-file="'+file+'"]');
+ if (scrolltorow.length > 0) {
+ scrolltorow.addClass('searchresult');
+ $(window).scrollTop(scrolltorow.position().top);
+ //remove highlight when hovered over
+ scrolltorow.one('hover', function(){
+ scrolltorow.removeClass('searchresult');
+ });
+ }
+ },
+ filter:function(query){
+ $('#fileList tr:not(.summary)').each(function(i,e){
+ if ($(e).data('file').toLowerCase().indexOf(query.toLowerCase()) !== -1) {
+ $(e).addClass("searchresult");
+ } else {
+ $(e).removeClass("searchresult");
+ }
+ });
+ //do not use scrollto to prevent removing searchresult css class
+ var first = $('#fileList tr.searchresult').first();
+ if (first.length !== 0) {
+ $(window).scrollTop(first.position().top);
+ }
+ },
+ unfilter:function(){
+ $('#fileList tr.searchresult').each(function(i,e){
+ $(e).removeClass("searchresult");
+ });
}
};
@@ -773,6 +803,13 @@ $(document).ready(function(){
// update file data
data.context.attr('data-mime',file.mime).attr('data-id',file.id);
+ var permissions = data.context.data('permissions');
+ if(permissions != file.permissions) {
+ data.context.attr('data-permissions', file.permissions);
+ data.context.data('permissions', file.permissions);
+ }
+ FileActions.display(data.context.find('td.filename'));
+
var path = getPathForPreview(file.name);
lazyLoadPreview(path, file.mime, function(previewpath){
data.context.find('td.filename').attr('style','background-image:url('+previewpath+')');
@@ -831,16 +868,16 @@ $(document).ready(function(){
FileList.replaceIsNewFile = null;
}
FileList.lastAction = null;
- OC.Notification.hide();
+ OC.Notification.hide();
});
$('#notification:first-child').on('click', '.replace', function() {
- OC.Notification.hide(function() {
- FileList.replace($('#notification > span').attr('data-oldName'), $('#notification > span').attr('data-newName'), $('#notification > span').attr('data-isNewFile'));
- });
+ OC.Notification.hide(function() {
+ FileList.replace($('#notification > span').attr('data-oldName'), $('#notification > span').attr('data-newName'), $('#notification > span').attr('data-isNewFile'));
+ });
});
$('#notification:first-child').on('click', '.suggest', function() {
$('tr').filterAttr('data-file', $('#notification > span').attr('data-oldName')).show();
- OC.Notification.hide();
+ OC.Notification.hide();
});
$('#notification:first-child').on('click', '.cancel', function() {
if ($('#notification > span').attr('data-isNewFile')) {
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 5ec65d87457..8ccb448abfb 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -358,6 +358,11 @@ $(document).ready(function() {
}
});
}
+
+ //scroll to and highlight preselected file
+ if (getURLParameter('scrollto')) {
+ FileList.scrollTo(getURLParameter('scrollto'));
+ }
});
function scanFiles(force, dir, users){