From 8b1979aa9bd20df1d4846a875f2ec2d7bce29b9d Mon Sep 17 00:00:00 2001 From: Oláh István Gergely Date: Wed, 26 Feb 2014 13:06:42 +0100 Subject: [PATCH] dashboard: fix rename button in node-details --- circle/dashboard/static/dashboard/node-details.js | 27 +++++++++++++++++++++++++++ circle/dashboard/templates/dashboard/group-detail.html | 2 +- circle/dashboard/templates/dashboard/node-detail.html | 16 ++++++++++++++-- 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 circle/dashboard/static/dashboard/node-details.js diff --git a/circle/dashboard/static/dashboard/node-details.js b/circle/dashboard/static/dashboard/node-details.js new file mode 100644 index 0000000..294a01e --- /dev/null +++ b/circle/dashboard/static/dashboard/node-details.js @@ -0,0 +1,27 @@ + + /* 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; + }); diff --git a/circle/dashboard/templates/dashboard/group-detail.html b/circle/dashboard/templates/dashboard/group-detail.html index ec75509..a33ba1b 100644 --- a/circle/dashboard/templates/dashboard/group-detail.html +++ b/circle/dashboard/templates/dashboard/group-detail.html @@ -15,7 +15,7 @@
{{ group.name }}
- +
diff --git a/circle/dashboard/templates/dashboard/node-detail.html b/circle/dashboard/templates/dashboard/node-detail.html index 61eb0fe..59b7bcb 100644 --- a/circle/dashboard/templates/dashboard/node-detail.html +++ b/circle/dashboard/templates/dashboard/node-detail.html @@ -4,7 +4,19 @@ {% block content %}
@@ -71,6 +83,6 @@ {% endblock %} {% block extra_js %} - + {% endblock %} -- libgit2 0.26.0