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
This commit is contained in:
Robin Appelman 2011-07-27 23:31:38 +02:00
parent 7d5bc7974d
commit 90ecd2c293
2 changed files with 17 additions and 2 deletions

View File

@ -88,7 +88,7 @@ table td.filesize, table td.date
table td.date table td.date
{ {
width: 11em; width: 12em;
} }
table td.selection, table th.selection, table td.fileaction table td.selection, table th.selection, table td.fileaction

View File

@ -54,7 +54,7 @@ FileActions={
var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
for(name in actions){ for(name in actions){
if(actions[name]!=defaultAction){ if(actions[name]!=defaultAction && name!='Delete'){
var html='<a href="#" alt="'+name+'">'+name+'</a>'; var html='<a href="#" alt="'+name+'">'+name+'</a>';
var element=$(html); var element=$(html);
element.data('action',name); element.data('action',name);
@ -69,12 +69,27 @@ FileActions={
$('#file_menu').append(element); $('#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(); $('#file_menu').show();
return false; return false;
}, },
hide:function(){ hide:function(){
$('#file_menu').hide(); $('#file_menu').hide();
$('#file_menu').empty(); $('#file_menu').empty();
$('#action_delete').remove();
$('body').append($('#file_menu')); $('body').append($('#file_menu'));
}, },
getCurrentFile:function(){ getCurrentFile:function(){