Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Delete now asks for confirmation.

  • Loading branch information...
commit 82db5783a787f61f9d23b71eaa08757338a77539 1 parent aa650df
Heinz N. Gies Licenser authored
Showing with 37 additions and 9 deletions.
  1. +23 −9 priv/js/application.js
  2. +14 −0 templates/base.dtl
32 priv/js/application.js
View
@@ -2,6 +2,8 @@ var ui = new Object();
!function ($) {
var center=$("#center");
+ var confirm = $(
+);
var machine_details = $(
"<div class='row-fluid'>" +
"<div class='span3'><h3>Machine Details</h3></div>" +
@@ -32,16 +34,28 @@ var ui = new Object();
function delete_vm() {
var id=$(".machine.active").data("id");
- $.ajax({
- url: "/my/machines/"+id,
- type: 'DELETE',
- dataType: 'json',
- success: function () {
- $("#" + id + "-menu").remove();
- activate_machine($(".machine").first().data("id"));
- }
- });
+ var go = $('<a href="#" class="btn btn-danger" data-dismiss="modal">Delete!</a>');
+ var cancle = $('<a href="#" class="btn" data-dismiss="modal">Cancle</a>');
+ var modal = $("#modal");
+ var btns = $("#modal .modal-footer");
+ $("#modal .modal-header h3").text("Delete VM");
+ $("#modal .modal-body p").text("You are about to delete a VM, this action can not be reversed! all data willbe lost forever!");
+ go.click(function(){
+ $.ajax({
+ url: "/my/machines/"+id,
+ type: 'DELETE',
+ dataType: 'json',
+ success: function () {
+ $("#" + id + "-menu").remove();
+ activate_machine($(".machine").first().data("id"));
+ }
+ });
+ });
+ btns.empty().
+ append(cancle).
+ append(go);
+ modal.modal();
}
function machine_add_fn() {
var pkg = $("#machine-new-package").val();
14 templates/base.dtl
View
@@ -44,6 +44,19 @@
{% empty %}
{% endfor %}
{% endif %}
+ <div class="modal" id="modal">
+ <div class="modal-header">
+ <button class="close" data-dismiss="modal">x</button>
+ <h3>blubber</h3>
+ </div>
+ <div class="modal-body">
+ <p></p>
+ </div>
+ <div class="modal-footer">
+
+ </div>
+ </div>
+
<div class="container-fluid">
<div class="row-fluid">
{% block body_content %}{% endblock %}
@@ -58,6 +71,7 @@
<script type="application/javascript" src="/js/bootstrap.js"></script>
<script type="application/javascript" src="/js/application.js"></script>
<script type="application/javascript">
+ $('#modal').hide();
{% block script %}{% endblock %}
</script>
</body>
Please sign in to comment.
Something went wrong with that request. Please try again.