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/resource_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/resource_list.html')
-rw-r--r-- | src/templates/account/resource_list.html | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/src/templates/account/resource_list.html b/src/templates/account/resource_list.html deleted file mode 100644 index 65b46f1..0000000 --- a/src/templates/account/resource_list.html +++ /dev/null @@ -1,124 +0,0 @@ -{% extends "base.html" %} -{% block content %} -<div class="row"> -{% for resource in resources %} - <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>Resource {{resource.id}}</h3> - </div> - <ul class="list-group list-group-flush h-100"> - <li class="list-group-item">id: {{resource.id}}</li> - <li class="list-group-item">name: {{resource.name}}</li> - <li class="list-group-item">description: {{resource.description}}</li> - </ul> - <div class="card-footer"> - <button - class="btn btn-danger w-100" - onclick='delete_resource({{resource.id}});' - data-toggle="modal" - data-target="#resModal" - >Delete</button> - </div> - </div> - </div> -{% empty %} - <div class="col"> - <p>You don't have any resources. You can create a resource by designing a pod.</p> - </div> -{% endfor %} -</div> -<script> - var grb_mapping = {{grb_mapping|safe|default:"{}"}}; - var booking_mapping = {{booking_mapping|safe|default:"{}"}}; - var current_resource_id = -1; - function delete_resource(resource_id) { - document.getElementById("confirm_delete_button").removeAttribute("disabled"); - var configs = grb_mapping[resource_id]; - var warning = document.createTextNode("Are You Sure?"); - var warning_subtext = document.createTextNode("This cannot be undone"); - if(booking_mapping[resource_id]){ - var warning = document.createTextNode("This resource is being used. It cannot be deleted."); - var warning_subtext = document.createTextNode("If your booking just ended, you may need to give us a few minutes to clean it up before this can be removed."); - - document.getElementById("confirm_delete_button").disabled = true; - } - else if(configs.length > 0) { - list_configs(configs); - warning_text = "Are You Sure? The following Configurations will also be deleted."; - warning = document.createTextNode(warning_text); - } - - current_resource_id = resource_id; - set_modal_text(warning, warning_subtext); - } - - function set_modal_text(title, text) { - var clear = function(node) { - while(node.lastChild) { - node.removeChild(node.lastChild); - } - } - var warning_title = document.getElementById("config_warning"); - var warning_text = document.getElementById("warning_subtext"); - - clear(warning_title); - clear(warning_text); - - warning_title.appendChild(title); - warning_text.appendChild(text); - } - - function list_configs(configs) { - var list = document.getElementById("config_list"); - for(var i=0; i<configs.length; i++){ - var str = configs[i].name; - var list_item = document.createElement("LI"); - list_item.appendChild(document.createTextNode(str)); - list.appendChild(list_item); - } - } - - function submit_delete_form() { - var ajaxForm = $("#res_delete_form"); - var formData = ajaxForm.serialize(); - req = new XMLHttpRequest(); - var url = "delete/" + current_resource_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); - } -</script> -<div class="modal fade" id="resModal" 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 Resource?</h4> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"> - <span aria-hidden="true">×</span> - </button> - </div> - <form id="res_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="config_warning">Are You Sure?</h3> - <p id="warning_subtext">This cannot be undone</p> - <ul id="config_list"></ul> - <button class="btn btn-outline-secondary" data-dismiss="modal">Nevermind</button> - <button class="btn btn-danger" id="confirm_delete_button" data-dismiss="modal" onclick="submit_delete_form();">I'm Sure</button> - </div> - </div> - </div> - </div> - </div> -</div> - -{% endblock %} |