Skip to content
Snippets Groups Projects
Commit a7748c14 authored by Robin Appelman's avatar Robin Appelman
Browse files

dont need the ok button for renaming

parent 224dbed7
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ table th#headerSize, table td.filesize { width:5em; padding:0 1em; text-align:ri
table th#headerDate, table td.date { width:10em; padding:0 .1em 0 1em; text-align:left; }
table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; }
table td.filename a.name { display:block; background-image:url('../img/file.png'); height:1.5em; vertical-align:middle; }
table td.filename a.name input, table td.filename a.name form { width:100% }
table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.2em .5em .5em 3em; background-position:1em .5em; background-repeat:no-repeat; }
table td.filename .nametext, .modified { float:left; padding:.3em 0; }
table td.filename .nametext { width:80%; }
......
......@@ -54,6 +54,10 @@ FileActions={
display:function(parent){
FileActions.currentFile=parent;
var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
var file=FileActions.getCurrentFile();
if($('tr[data-file="'+file+'"]').data('renaming')){
return;
}
var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
for(name in actions){
if((name=='Download' || actions[name]!=defaultAction) && name!='Delete'){
......
......@@ -105,18 +105,17 @@ FileList={
},
rename:function(name){
var tr=$('tr[data-file="'+name+'"]');
tr.data('renaming',true);
var td=tr.children('td.filename');
var input=$('<input value='+name+' class="filename"></input>');
var button=$('<input type="submit" value="Ok"></input>');
var form=$('<form action="#"></form>')
form.append(input);
form.append(button);
td.children('a.name').text('');
td.children('a.name').append(form)
input.focus();
td.children('a.name').append(button);
form.submit(function(event){
var newname=input.val();
tr.data('renaming',false);
event.stopPropagation();
event.preventDefault();
tr.attr('data-file',newname);
......@@ -140,6 +139,7 @@ FileList={
event.preventDefault();
});
input.blur(function(){
tr.data('renaming',false);
td.children('a.name').empty();
if(name.indexOf('.')>0){
basename=name.substr(0,name.indexOf('.'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment