remove textbox after pressing "enter" even if the name is the same

This commit is contained in:
Björn Schießle 2012-10-02 18:38:17 +02:00
parent 39735721ec
commit 92b37119e3
1 changed files with 15 additions and 16 deletions

View File

@ -157,22 +157,21 @@ var FileList={
}); });
} }
}
tr.attr('data-file', newname); tr.attr('data-file', newname);
var path = td.children('a.name').attr('href'); var path = td.children('a.name').attr('href');
td.children('a.name').attr('href', path.replace(encodeURIComponent(name), encodeURIComponent(newname))); td.children('a.name').attr('href', path.replace(encodeURIComponent(name), encodeURIComponent(newname)));
if (newname.indexOf('.') > 0 && tr.data('type') != 'dir') { if (newname.indexOf('.') > 0 && tr.data('type') != 'dir') {
var basename=newname.substr(0,newname.lastIndexOf('.')); var basename=newname.substr(0,newname.lastIndexOf('.'));
} else { } else {
var basename=newname; var basename=newname;
} }
td.children('a.name').empty(); td.children('a.name').empty();
var span=$('<span class="nametext"></span>'); var span=$('<span class="nametext"></span>');
span.text(basename); span.text(basename);
td.children('a.name').append(span); td.children('a.name').append(span);
if (newname.indexOf('.') > 0 && tr.data('type') != 'dir') { if (newname.indexOf('.') > 0 && tr.data('type') != 'dir') {
span.append($('<span class="extension">'+newname.substr(newname.lastIndexOf('.'))+'</span>')); span.append($('<span class="extension">'+newname.substr(newname.lastIndexOf('.'))+'</span>'));
}
} }
return false; return false;
}); });