From d4148bd39303394cd9a0d416d42a1fc20a18cabf Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Sat, 12 Sep 2015 17:02:11 -0400 Subject: Implement /rename. Backend is done but js is still in progress. --- web/index.html | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'web') diff --git a/web/index.html b/web/index.html index ccbfe53..b4dcd7b 100644 --- a/web/index.html +++ b/web/index.html @@ -15,7 +15,13 @@ } var element = makeElement(albumName); $(element).find('a').click(function() { - $(this).replaceWith($('')); + var input = + $(''); + setTimeout(function() { + var position = input[0].value.length; + input[0].setSelectionRange(position, position); + }, 0); + $(this).replaceWith(input); }); $('#pending-container').append(element); } @@ -53,6 +59,20 @@ } $(document).ready(function() { fetchAlbums(); + + var request = { + from: { name: 'x', pending: true }, + to: { name: 'y', pending: false } + }; + console.log('rename request: ', request); + $.ajax({ + url: '/api/rename', + type: 'POST', + contentType: 'application/json', + data: JSON.stringify(request), + success: function(data) { console.log('Rename succes: ', data); }, + error: function(unused, unusedStatus, error) { console.log('Rename failure: ' + error); } + }); }); -- cgit v1.2.3