Commit 3ff1fc25 authored by Efthymia Bika's avatar Efthymia Bika
Browse files

Replace plain confirm with foundation modal

parent 97a49ff2
......@@ -30,6 +30,25 @@
$("#backup-tab-link").trigger("click");
}
function show_delete_modal(backup) {
$("#del-modal-p").html("<p>Are you sure you want to delete "
+ backup.cloud + "/" + backup.name + '?</p>' +
"<p>NOTE: To actually remove backup sets from remote" +
" container you have to manually purge it.</p>");
$("#delete-modal").foundation("reveal", "open");
var i = 0;
$("#delete-modal").on('close.fndtn.reveal', function(e) {
if(e.namespace !== "fndtn.reveal") return;
i++;
$(this).click(function(event) {
// event is fired more than once so have to check
if(event.target.id == "del-modal-accept" && i == 1) {
delete_backup(backup);
}
});
});
}
function render_backup_sets(data) {
$("#backup_list").remove();
// backups is undefined the first time, when
......@@ -62,11 +81,7 @@
.attr("href", "#")
.attr("class", "right")
.click(function() {
if(confirm("Are you sure you want to delete " + backup.cloud + "/" + backup.name + '?' +
"\nNOTE: To actually remove backup sets from remote" +
" container you have to manually purge it.")) {
delete_backup(backup);
}
show_delete_modal(backup);
});
li.append(a_del);
......@@ -129,6 +144,20 @@
<div class="small-12 columns" id="backup-table">
</div>
</div>
<div id="delete-modal" class="reveal-modal medium"
data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<p id="del-modal-p"></p>
<a id="del-modal-cancel" class="button radius small"
onclick="$('#delete-modal').foundation('reveal', 'close');">
Cancel
</a>
<a id="del-modal-accept" class="button radius small alert right"
onclick="$('#delete-modal').foundation('reveal', 'close');">
Delete
</a>
<a class="close-reveal-modal" aria-label="Close">&#215;</a>
</div>
<script type="text/javascript">
$(document).foundation();
</script>
......
......@@ -7,6 +7,23 @@
load_data_from_file(CLOUDS_CONF_FILE, render_clouds);
function show_delete_cloud_modal(cloud) {
$("#del-cloud-modal-p").html("Are you sure you want to delete "
+ cloud.name + '?');
$("#delete-cloud-modal").foundation("reveal", "open");
var i = 0;
$("#delete-cloud-modal").on('close.fndtn.reveal', function(e) {
if(e.namespace !== "fndtn.reveal") return;
i++;
$(this).click(function(event) {
// event is fired more than once so have to check
if(event.target.id == "del-cloud-modal-accept" && i == 1) {
delete_cloud(cloud);
}
});
});
}
function render_clouds(data) {
$("#clouds_list").remove();
// clouds is undefined the first time, when
......@@ -39,9 +56,7 @@
.attr("href", "#")
.attr("class", "right")
.click(function() {
if(confirm("Are you sure you want to delete " + cloud.name + '?')) {
delete_cloud(cloud);
}
show_delete_cloud_modal(cloud);
});
li.append(a_del);
......@@ -290,5 +305,19 @@
</form>
</div>
</div>
<div id="delete-cloud-modal" class="reveal-modal medium"
data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<p id="del-cloud-modal-p"></p>
<a id="del-cloud-modal-cancel" class="button radius small"
onclick="$('#delete-cloud-modal').foundation('reveal', 'close');">
Cancel
</a>
<a id="del-cloud-modal-accept" class="button radius small alert right"
onclick="$('#delete-cloud-modal').foundation('reveal', 'close');">
Delete
</a>
<a class="close-reveal-modal" aria-label="Close">&#215;</a>
</div>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment