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