diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2015-09-12 17:02:11 -0400 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2015-09-12 17:02:11 -0400 |
commit | d4148bd39303394cd9a0d416d42a1fc20a18cabf (patch) | |
tree | 71a5700282b263deba8e33fd460481cacb93053a /web/index.html | |
parent | 615779999bf652632870d4105fa7f0ba23af63cb (diff) |
Implement /rename.
Backend is done but js is still in progress.
Diffstat (limited to 'web/index.html')
-rw-r--r-- | web/index.html | 22 |
1 files changed, 21 insertions, 1 deletions
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($('<input type="text" autofocus="true">')); + var input = + $('<input type="text" value="'+albumName+'" autofocus="true">'); + 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); } + }); }); </script> </head> |