diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-07-29 17:51:17 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-07-29 17:51:38 +0200 |
commit | 98e78c0599a641ed33ed2abd70e540ce43a7ef15 (patch) | |
tree | 2d2629160af52fd2c1524156734bbdc2c8f3923f | |
parent | 2781fdeed8f1d45ebba23fb2b2e22aa3bbd5f2ff (diff) | |
download | nextcloud-server-98e78c0599a641ed33ed2abd70e540ce43a7ef15.tar.gz nextcloud-server-98e78c0599a641ed33ed2abd70e540ce43a7ef15.zip |
some tweaks for renaming
-rw-r--r-- | files/js/filelist.js | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/files/js/filelist.js b/files/js/filelist.js index 260ca00b977..c3a2522fb6a 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -114,10 +114,10 @@ FileList={ td.children('a.name').append(form) input.focus(); form.submit(function(event){ - var newname=input.val(); - tr.data('renaming',false); event.stopPropagation(); event.preventDefault(); + var newname=input.val(); + tr.data('renaming',false); tr.attr('data-file',newname); td.children('a.name').empty(); if(newname.indexOf('.')>0){ @@ -125,9 +125,11 @@ FileList={ }else{ basename=newname; } - td.children('a.name').text(basename); + var span=$('<span class="nametext"></span>'); + span.text(basename); + td.children('a.name').append(span); if(newname.indexOf('.')>0){ - td.children('a.name').append($('<span class="extention">'+newname.substr(newname.indexOf('.'))+'</span>')); + span.append($('<span class="extention">'+newname.substr(newname.indexOf('.'))+'</span>')); } $.ajax({ url: 'ajax/rename.php', @@ -139,17 +141,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('.')); - }else{ - basename=name; - } - td.children('a.name').text(basename); - if(name.indexOf('.')>0){ - td.children('a.name').append($('<span class="extention">'+name.substr(name.indexOf('.'))+'</span>')); - } + form.trigger('submit'); }); } } |