Commits

Kenneth Love  committed c5ab0e0

fixed bug with confirmation dialog and delete

  • Participants
  • Parent commits ffadd97

Comments (0)

Files changed (1)

File templates/key.html

 
 <script>
 	$(function() {
+		var flashes = $("#flashes");
+
 		$("#refresh").live('click', function(e) {
         	var link = $(this).attr('href'),
             	hash = link.replace("/key/", "");
 		});
 
 		$("#delete").live('click', function(e) {
+			var link = $(this).attr("href"),
+				confirmation = confirm('Are you sure you want to delete this key?');
+
 			e.preventDefault();
-			e.stopPropagation();
-
-			var link = $(this).attr("href"),
-				flashes = $("#flashes");
 
 			flashes.empty();
 
-			if (confirm('Are you sure you want to delete this key?')) {
+			if (confirmation) {
 				$.ajax({
 					url: link,
 					dataType: "json",
 					success: function(data) {
 						$("<li>").text(data['flash']).appendTo(flashes);
-						$("#keylist li.current").remove();
-						window.location.hash = '';
+						$("#refresh_keys").trigger('click');
 					}
 				});
 			}