summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorKjetil Orbekk <kjetil.orbekk@gmail.com>2015-09-12 17:02:11 -0400
committerKjetil Orbekk <kjetil.orbekk@gmail.com>2015-09-12 17:02:11 -0400
commitd4148bd39303394cd9a0d416d42a1fc20a18cabf (patch)
tree71a5700282b263deba8e33fd460481cacb93053a /web
parent615779999bf652632870d4105fa7f0ba23af63cb (diff)
Implement /rename.
Backend is done but js is still in progress.
Diffstat (limited to 'web')
-rw-r--r--web/index.html22
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>