Commit f84f4f68 by Bence Dányi

webui: fix instance renaming

parent b11d0555
...@@ -59,7 +59,17 @@ $(function() { ...@@ -59,7 +59,17 @@ $(function() {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var id = $(this).data('id'); var id = $(this).data('id');
var handler = arguments.callee;
var oldName = $(this).data('name'); var oldName = $(this).data('name');
var content = $('#vm-' + id + '-name').html();
var self=this;
$(this).unbind('click').click(function(e){
e.preventDefault();
e.stopPropagation();
$(this).unbind('click').click(handler);
$('#vm-' + id + '-name-details').show();
$('#vm-' + id + '-name').html(content);
})
$('#vm-' + id + '-name-details').hide(); $('#vm-' + id + '-name-details').hide();
$('#vm-' + id + '-name').html('<input type="text" value="' + oldName + '" />\ $('#vm-' + id + '-name').html('<input type="text" value="' + oldName + '" />\
<input type="submit" value="' + gettext('Rename') + '" />'); <input type="submit" value="' + gettext('Rename') + '" />');
...@@ -79,6 +89,7 @@ $(function() { ...@@ -79,6 +89,7 @@ $(function() {
success: function(data) { success: function(data) {
$('#vm-' + id + '-name-details').removeAttr('style'); $('#vm-' + id + '-name-details').removeAttr('style');
$('#vm-' + id + '-name').text(data.name); $('#vm-' + id + '-name').text(data.name);
$(self).click(handler);
} }
}); });
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment