Commit a123cd4a by Bence Dányi

webui: vm-rename fixed

parent 350e4d2a
...@@ -63,6 +63,7 @@ $(function() { ...@@ -63,6 +63,7 @@ $(function() {
var oldName = $(this).data('name'); var oldName = $(this).data('name');
var content = $('#vm-' + id + '-name').html(); var content = $('#vm-' + id + '-name').html();
var self=this; var self=this;
var url = $(this).data('url');
$(this).unbind('click').click(function(e){ $(this).unbind('click').click(function(e){
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
...@@ -72,7 +73,7 @@ $(function() { ...@@ -72,7 +73,7 @@ $(function() {
}) })
$('#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') + '" data-url="'+url+'"/>');
$('#vm-' + id + '-name').find('input[type="text"]').click(function(f) { $('#vm-' + id + '-name').find('input[type="text"]').click(function(f) {
f.preventDefault(); f.preventDefault();
f.stopPropagation(); f.stopPropagation();
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
{% endblock status %} {% endblock status %}
{% block actions %} {% block actions %}
<a href="#" class="rename-vm" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Edit name" %}"> <a href="#" class="rename-vm" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Edit name" %}" data-url="{% url one.views.vm_ajax_rename iid=vm.id %}">
<img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit name" %}" /> <img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit name" %}" />
</a> </a>
{% if vm.waiting %} {% if vm.waiting %}
......
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