diff options
author | Jan-Christoph Borchardt <JanCBorchardt@fsfe.org> | 2011-07-28 03:22:55 +0200 |
---|---|---|
committer | Jan-Christoph Borchardt <JanCBorchardt@fsfe.org> | 2011-07-28 03:22:55 +0200 |
commit | 09eff063debd42b1c8e9873a3593fb2b0cfcda39 (patch) | |
tree | 9d68d0fda4a32a6a44c57a3c7946d36bb5dddcc3 /files/js | |
parent | c5bc345604caee2a908c61ac42dad7f025da27de (diff) | |
parent | 90ecd2c293f96a2e5041767afaf4266af30c4601 (diff) | |
download | nextcloud-server-09eff063debd42b1c8e9873a3593fb2b0cfcda39.tar.gz nextcloud-server-09eff063debd42b1c8e9873a3593fb2b0cfcda39.zip |
fix merge conflict
Diffstat (limited to 'files/js')
-rw-r--r-- | files/js/fileactions.js | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/files/js/fileactions.js b/files/js/fileactions.js index 3ad417c91c4..8c8296894a9 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -52,10 +52,27 @@ FileActions={ $('#file_menu').empty(); parent.append($('#file_menu')); var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); + var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); for(name in actions){ - var html='<a href="#" alt="'+name+'">'+name+'</a>'; + if(actions[name]!=defaultAction && name!='Delete'){ + var html='<a href="#" alt="'+name+'">'+name+'</a>'; + var element=$(html); + element.data('action',name); + element.click(function(event){ + event.stopPropagation(); + event.preventDefault(); + var action=actions[$(this).data('action')]; + var currentFile=FileActions.getCurrentFile(); + FileActions.hide(); + action(currentFile); + }); + $('#file_menu').append(element); + } + } + if(actions['Delete']){ + var html='<a href="#" alt="Delete" id="action_delete">Delete</a>'; var element=$(html); - element.data('action',name); + element.data('action','Delete'); element.click(function(event){ event.stopPropagation(); event.preventDefault(); @@ -64,7 +81,7 @@ FileActions={ FileActions.hide(); action(currentFile); }); - $('#file_menu').append(element); + parent.parent().children().last().append(element); } $('#file_menu').show(); return false; @@ -72,6 +89,7 @@ FileActions={ hide:function(){ $('#file_menu').hide(); $('#file_menu').empty(); + $('#action_delete').remove(); $('body').append($('#file_menu')); }, getCurrentFile:function(){ @@ -107,4 +125,4 @@ FileActions.register('dir','Open',function(filename){ window.location='index.php?dir='+$('#dir').val()+'/'+filename; }); -FileActions.setDefault('dir','Open');
\ No newline at end of file +FileActions.setDefault('dir','Open'); |