Commit 8b1979aa by Oláh István Gergely

dashboard: fix rename button in node-details

parent 0c944824
/* rename */
$("#node-details-h1-name, .node-details-rename-button").click(function() {
$("#node-details-h1-name").hide();
$("#node-details-rename").css('display', 'inline');
$("#node-details-rename-name").focus();
});
/* rename ajax */
$('#node-details-rename-submit').click(function() {
var name = $('#node-details-rename-name').val();
$.ajax({
method: 'POST',
url: location.href,
data: {'new_name': name},
headers: {"X-CSRFToken": getCookie('csrftoken')},
success: function(data, textStatus, xhr) {
$("#node-details-h1-name").html(data['new_name']).show();
$('#node-details-rename').hide();
// addMessage(data['message'], "success");
},
error: function(xhr, textStatus, error) {
addMessage("Error during renaming!", "danger");
}
});
return false;
});
...@@ -4,7 +4,19 @@ ...@@ -4,7 +4,19 @@
{% block content %} {% block content %}
<div class="body-content"> <div class="body-content">
<div class="page-header"> <div class="page-header">
<h1>{{ node.name }} <small>{{ node.get_connect_host }}</small></h1> <h1>
<div id="node-details-rename">
<form action="" method="POST" id="node-details-rename-form">
{% csrf_token %}
<input id="node-details-rename-name" class="form-control" name="new_name" type="text" value="{{ node.name }}"/>
<button type="submit" id="node-details-rename-submit" class="btn">{% trans "Rename" %}</button>
</form>
</div>
<div id="node-details-h1-name">
{{ node.name }}
</div>
</h1>
<small>{{ node.get_connect_host }}</small>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-4" id="node-info-pane"> <div class="col-md-4" id="node-info-pane">
...@@ -71,6 +83,6 @@ ...@@ -71,6 +83,6 @@
{% endblock %} {% endblock %}
{% block extra_js %} {% block extra_js %}
<script src="{{ STATIC_URL}}dashboard/node-list.js"></script> <script src="{{ STATIC_URL}}dashboard/node-details.js"></script>
{% endblock %} {% endblock %}
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