diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-07-27 23:31:38 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-07-27 23:32:37 +0200 |
commit | 90ecd2c293f96a2e5041767afaf4266af30c4601 (patch) | |
tree | 14604922742855b68906df71440a627ce93298be /files/js/fileactions.js | |
parent | 7d5bc7974d9f7e7e3e1380b56fc77fd0eb3b87e1 (diff) | |
download | nextcloud-server-90ecd2c293f96a2e5041767afaf4266af30c4601.tar.gz nextcloud-server-90ecd2c293f96a2e5041767afaf4266af30c4601.zip |
deleting stuff is scary, lets move the button as far to the right as possible
it doesn't fit good currently in the column but will be fixed with using icons
Diffstat (limited to 'files/js/fileactions.js')
-rw-r--r-- | files/js/fileactions.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/files/js/fileactions.js b/files/js/fileactions.js index a6891a5f82d..4920e803b71 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -54,7 +54,7 @@ FileActions={ var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); for(name in actions){ - if(actions[name]!=defaultAction){ + if(actions[name]!=defaultAction && name!='Delete'){ var html='<a href="#" alt="'+name+'">'+name+'</a>'; var element=$(html); element.data('action',name); @@ -69,12 +69,27 @@ FileActions={ $('#file_menu').append(element); } } + if(actions['Delete']){ + var html='<a href="#" alt="Delete" id="action_delete">Delete</a>'; + var element=$(html); + element.data('action','Delete'); + element.click(function(event){ + event.stopPropagation(); + event.preventDefault(); + var action=actions[$(this).data('action')]; + var currentFile=FileActions.getCurrentFile(); + FileActions.hide(); + action(currentFile); + }); + parent.parent().children().last().append(element); + } $('#file_menu').show(); return false; }, hide:function(){ $('#file_menu').hide(); $('#file_menu').empty(); + $('#action_delete').remove(); $('body').append($('#file_menu')); }, getCurrentFile:function(){ |