From 90ecd2c293f96a2e5041767afaf4266af30c4601 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 27 Jul 2011 23:31:38 +0200 Subject: [PATCH] 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 --- files/css/files.css | 2 +- files/js/fileactions.js | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/files/css/files.css b/files/css/files.css index 590c7bac36..37cb64bff0 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -88,7 +88,7 @@ table td.filesize, table td.date table td.date { - width: 11em; + width: 12em; } table td.selection, table th.selection, table td.fileaction diff --git a/files/js/fileactions.js b/files/js/fileactions.js index a6891a5f82..4920e803b7 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=''+name+''; var element=$(html); element.data('action',name); @@ -69,12 +69,27 @@ FileActions={ $('#file_menu').append(element); } } + if(actions['Delete']){ + var html='Delete'; + 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(){