diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2020-01-30 13:33:35 -0500 |
---|---|---|
committer | Parker Berberian <pberberian@iol.unh.edu> | 2020-01-30 16:12:18 -0500 |
commit | 078273eb7db5a481a4131d44a943f3c9e34b6b88 (patch) | |
tree | 9e6e569e18712d77b8a65c6ebf4dda50ade1b55a /src/templates/account/image_list.html | |
parent | 899e1a4baa95d0bc6f0eef34de66f0e257174878 (diff) |
Adds Template Overrides
Changes the structure of the template directories to allow
a new project to define their own set of override templates
that inherit from a common base.
I have slightly modified landing.html here as an example.
In comming changes we will try to move all the "laas" specific
content into the laas directory
Change-Id: I46151be182de901f870debb247b305ea34ae77ba
Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/templates/account/image_list.html')
-rw-r--r-- | src/templates/account/image_list.html | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/src/templates/account/image_list.html b/src/templates/account/image_list.html deleted file mode 100644 index 6263016..0000000 --- a/src/templates/account/image_list.html +++ /dev/null @@ -1,132 +0,0 @@ -{% extends "base.html" %} -{% block content %} -<h2>Images I Own</h2> -<div class="row"> -{% for image in images %} - <div class="col-12 col-md-6 col-lg-4 col-xl-3 mb-3"> - <div class="card h-100"> - <div class="card-header"> - <h3>Image {{image.id}}</h3> - </div> - <ul class="list-group list-group-flush h-100"> - <li class="list-group-item">id: {{image.id}}</li> - <li class="list-group-item">lab: {{image.from_lab.name}}</li> - <li class="list-group-item">name: {{image.name}}</li> - <li class="list-group-item">description: {{image.description}}</li> - <li class="list-group-item">host profile: {{image.host_type.name}}</li> - </ul> - <div class="card-footer"> - <button class="btn btn-danger w-100" onclick='delete_image({{image.id}});' - data-toggle="modal" data-target="#imageModal"> - Delete - </button> - </div> - </div> - </div> -{% empty %} - <div class="col"> - <p>You don't have any images. You can create an image by creating a snapshot.</p> - </div> -{% endfor %} -</div> - -<h2>Public Images</h2> -<div class="row"> - {% for image in public_images %} - <div class="col-12 col-md-6 col-lg-4 col-xl-3 mb-3"> - <div class="card h-100"> - <div class="card-header"> - <h3>Image {{image.id}}</h3> - </div> - <ul class="list-group list-group-flush h-100"> - <li class="list-group-item">id: {{image.id}}</li> - <li class="list-group-item">lab: {{image.from_lab.name}}</li> - <li class="list-group-item">name: {{image.name}}</li> - <li class="list-group-item">description: {{image.description}}</li> - <li class="list-group-item">host profile: {{image.host_type.name}}</li> - </ul> - </div> - </div> - {% empty %} - <div class="col"> - <p>There are no public images.</p> - </div> - {% endfor %} -</div> - -<script> - var current_image_id = -1; - var used_images = {{used_images|safe|default:"{}"}}; - function delete_image(image_id) { - current_image_id = image_id; - var warning_header = document.getElementById("warning_header"); - var warning_text = document.getElementById("warning_text"); - var delete_image_button = document.getElementById("final_delete_b"); - clear(warning_header); - clear(warning_text); - if(used_images[image_id]) { - warning_header.appendChild( - document.createTextNode("Cannot Delete") - ); - warning_text.appendChild( - document.createTextNode("This snapshot is being used in a booking.") - ); - delete_image_button.disabled = true; - } else { - warning_header.appendChild( - document.createTextNode("Are You Sure?") - ); - warning_text.appendChild( - document.createTextNode("This cannot be undone") - ); - delete_image_button.removeAttribute("disabled"); - } - } - - function submit_delete_form() { - var ajaxForm = $("#image_delete_form"); - var formData = ajaxForm.serialize(); - req = new XMLHttpRequest(); - var url = "delete/" + current_image_id; - req.open("POST", url, true); - req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - req.onerror = function() { alert("problem submitting form"); } - req.send(formData); - } - - function clear(node) { - while(node.lastChild) { - node.removeChild(node.lastChild); - } - } -</script> -<div class="modal fade" id="imageModal" tabindex="-1" role="dialog" aria-hidden="true"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <h4 class="modal-title d-inline float-left">Delete Configuration?</h4> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"> - <span aria-hidden="true">×</span> - </button> - </div> - <form id="image_delete_form"> - {% csrf_token %} - </form> - <div class="modal-footer d-flex flex-column"> - <div class="mb-2"> - <button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Close</button> - <button type="button" class="btn btn-danger" data-toggle="collapse" data-target="#warning">Delete</button> - </div> - <div class="collapse w-100 text-center border-top" id="warning"> - <div class="p-4"> - <h3 id="warning_header">Are You Sure?</h3> - <p id="warning_text">This cannot be undone</p> - <button class="btn btn-outline-secondary" data-dismiss="modal">Nevermind</button> - <button id="final_delete_b" class="btn btn-danger" data-dismiss="modal" onclick="submit_delete_form();">I'm Sure</button> - </div> - </div> - </div> - </div> - </div> -</div> -{% endblock %} |